Skip to main content

fortoptim

Fortoptim is an optimization library based on python and fortran routines.

Installation

Prerequisite:

  • python 3.12
  • gfortran

from the gitlab repository

After cloning the repository, run in the project folder:

python -m pip install -e .

and compile the fortran source files with:

fortoptim-compile

pip

python -m pip install fortoptim
fortoptim-compile

Demonstration with MultiSwarmCooperativePSO on Ackley problem

import numpy as np

from fortoptim.optimizers.pso import MultiSwarmCooperativePSO
from fortoptim.problems import Ackley

dim = 2
lower = -32
upper = 32
constraints = [np.array([lower, upper])] * dim
problem = Ackley(dim=dim, constraints=constraints)

# initial population and velocity
n = 6
sub_swarm = [np.random.uniform(size=(n, dim), low=lower, high=upper) for i in range(4)]
# sub_swarm_velocity = [np.random.uniform(size=(n, dim), high=0.8) for i in range(4)]
sub_swarm_velocity = [np.zeros(shape=(n, dim)) for i in range(4)]

# initialize optimizer with default parameters
opti = MultiSwarmCooperativePSO(eps=0.0)

history = opti.minimize(problem, sub_swarm, sub_swarm_velocity, max_iter=10000)

x_plot = np.random.uniform(size=(200000, dim), low=lower, high=upper)

x_best, f_best = history.get_best_solution()
print(f"The best solution is {x_best} obtained at {f_best}.")

history.plot_loss_history(log=True, show=True)

Metadata

Release files for fortoptim 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fortoptim 0.0.10
File Size Uploaded Provenance Actions
fortoptim-0.0.10.tar.gz 22.8 kB Without provenance Details for fortoptim-0.0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fortoptim 0.0.10
File Interpreter ABI Platform Actions
fortoptim-0.0.10-py3-none-any.whl Python 3 none any Details for fortoptim-0.0.10-py3-none-any.whl

Total release size: 48.5 kB

Release files / fortoptim-0.0.10.tar.gz

Download URL fortoptim-0.0.10.tar.gz
Size 22.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b1d035b72085da2fbdef687dac7ee24d2356e26b5d2354b3ba0ac43ec2a74c3e
BLAKE2b-256 checksum
How to use checksums
a18c67a15f3d1a9fd8c0660bcc2eb56661b8df48a435c14882ab975f3ffc198c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / fortoptim-0.0.10-py3-none-any.whl

Download URL fortoptim-0.0.10-py3-none-any.whl
Size 25.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c3eb24df0054e923c70bc651eb4091e0a46dfef99d9f4ffe736d4f4b502ed16
BLAKE2b-256 checksum
How to use checksums
bb36ee9ee5f46cca6c1bb563dc0fecf3a2ec75ab8660c086f96c0fc6eac1edc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Security for fortoptim 0.0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page