pyvolutionary

This repository contains pyVolutionary, a package collecting metaheuristic algorithms

https://github.com/matteocacciola/pyvolutionary

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 96 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org, researchgate.net, sciencedirect.com, springer.com, wiley.com, nature.com, frontiersin.org, mdpi.com, ieee.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.9%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

This repository contains pyVolutionary, a package collecting metaheuristic algorithms

Basic Info
  • Host: GitHub
  • Owner: matteocacciola
  • License: gpl-3.0
  • Language: Python
  • Default Branch: master
  • Size: 1.11 MB
Statistics
  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 24
Created about 2 years ago · Last pushed 7 months ago
Metadata Files
Readme License Citation

README.md

pyVolutionary

pyVolutionary

GitHub Release GitHub commits since latest release GitHub last commit (branch) GitHub issues Wheel PyPI - Version PyPI - Python Version PyPI - Status PyPI - Downloads Downloads Downloads Downloads GitHub Release Date GitHub contributors Average time to resolve an issue Percentage of issues still open GitTutorial License: MIT

GitHub forks

Introduction

pyVolutionary stands as a versatile Python library dedicated to metaheuristic algorithms within the realm of evolutionary computation. Engineered for ease of use, flexibility, and speed, it exhibits robustness and efficiency, having undergone rigorous testing on large-scale problem instances. The primary objectives encompass the implementation of both classical and cutting-edge nature-inspired algorithms. The library is conceived as a user-friendly resource facilitating rapid access to optimization algorithms for researchers, fostering the dissemination of optimization knowledge to a broad audience without financial barriers.

Nature-inspired algorithms constitute a widely embraced tool for addressing optimization challenges. Over the course of their evolution, a plethora of variants have emerged (paper 1, paper 2), showcasing their adaptability and versatility across diverse domains and applications. Noteworthy advancements have been achieved through hybridization, modification, and adaptation of these algorithms. However, the implementation of nature-inspired algorithms can often pose a formidable challenge, characterized by complexity and tedium. pyVolutionary is specifically crafted to surmount this challenge, offering a streamlined and expedited approach to leveraging these algorithms without the need for arduous, time-consuming implementations from scratch.

The list of algorithms currently implemented in pyVolutionary can be consulted in the Algorithms section, where you can also find the corresponding references to the scientific papers as well as the corresponding demo for each algorithm.

A number of practical examples are provided in the Practical examples section.

The library is continuously updated with new algorithms and problems, and contributions are welcome.

Installation

pyVolutionary is available on PyPI, and can be installed via pip:

bash pip install pyvolutionary

Usage

Once installed, pyVolutionary can be imported into your Python scripts as follows:

python import pyvolutionary

Now, you can access the algorithms and problems included in the library. With pyVolutionary, you can solve both continuous and discrete optimization problems. It is also possible to solve mixed problems, i.e., problems with both continuous and discrete variables. In order to do so, you need to define a Task class, which inherits from the Task class of the library. The list of variables in the problem must be specified in the constructor of the class inheriting from Task. The following table describes the types of variables currently implemented in the library.

| Variable type | Class name | Description | Example | |------------------|---------------------------|----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------| | Continuous | ContinuousVariable | A continuous variable | ContinuousVariable(name="x0", lower_bound=-100.0, upper_bound=100.0) | | Continuous (set) | ContinuousMultiVariable | A set of continuous variables | ContinuousMultiVariable(name="x0", lower_bounds=[-100.0, -200.0], upper_bounds=[100.0, 50.0]) | | Discrete | DiscreteVariable | A discrete variable | DiscreteVariable(choices=["scale", "auto", 0.01, 0.1, 0.5, 1.0], name="gamma") | | Discrete (set) | DiscreteMultiVariable | A set of discrete variables | DiscreteMultiVariable(choices=[[0.1, 10, 100], ["scale", "auto", 0.01, 0.1, 0.5, 1.0]], name="params") | | Permutation | PermutationVariable | A permutation of the specified choices | PermutationVariable(items=[[60, 200], [180, 200], [80, 180]], name="routes") | | Binary | BinaryVariable | A type of variable used for problems where the data are binary | BinaryVariable(name="x", n_vars=10) | | Multi-objective | MultiObjectiveVariable | A type of variable used for multi-objective problems | MultiObjectiveVariable(name="x", lower_bounds=(-10, -10), upper_bounds=(10, 10)) |

An example of a custom Task class is the following:

```python from pyvolutionary import ContinuousVariable, Task

class Sphere(Task): def objective_function(self, x: list[float]) -> float: x1, x2 = x f1 = x1 - 2 * x2 + 3 f2 = 2 * x1 + x2 - 8 return f1 ** 2 + f2 ** 2

Define the task with the bounds and the configuration of the optimizer

task = Sphere( variables=[ ContinuousVariable(name="x1", lowerbound=-100.0, upperbound=100.0), ContinuousVariable(name="x2", lowerbound=-100.0, upperbound=100.0), ], ) ```

You can pass the minmax parameter to the Task class to specify whether you want to minimize or maximize the function. Therefore, if you want to maximize the function, you can write:

```python from pyvolutionary import ContinuousVariable, Task

class Sphere(Task): def objective_function(self, x: list[float]) -> float: x1, x2 = x f1 = x1 - 2 * x2 + 3 f2 = 2 * x1 + x2 - 8 return -(f1 ** 2 + f2 ** 2)

task = Sphere( variables=[ ContinuousVariable(name="x1", lowerbound=-100.0, upperbound=100.0), ContinuousVariable(name="x2", lowerbound=-100.0, upperbound=100.0), ], minmax="max", ) ```

By default, the minmax parameter is set to min. If necessary (e.g., in the implementation of the objective function), additional data can be injected into the Task class by using the data parameter of the constructor. This data can be accessed by using the data attribute of the Task class (see combinatorial example below).

Finally, you can also specify the seed of the random number generator by using the seed parameter of the definition of the Task:

```python from pyvolutionary import ContinuousVariable, Task

class Sphere(Task): def objective_function(self, x: list[float]) -> float: x1, x2 = x f1 = x1 - 2 * x2 + 3 f2 = 2 * x1 + x2 - 8 return -(f1 ** 2 + f2 ** 2)

task = Sphere( variables=[ ContinuousVariable(name="x1", lowerbound=-100.0, upperbound=100.0), ContinuousVariable(name="x2", lowerbound=-100.0, upperbound=100.0), ], minmax="max", seed=42, ) ```

Continuous problems

For example, let us inspect how you can solve the continuous sphere problem with the Particle Swarm Optimization algorithm.

```python from pyvolutionary import ContinuousMultiVariable, ParticleSwarmOptimization, ParticleSwarmOptimizationConfig, Task

Define the problem, you can replace the following class with your custom problem to optimize

class Sphere(Task): def objective_function(self, x: list[float]) -> float: x1, x2 = x f1 = x1 - 2 * x2 + 3 f2 = 2 * x1 + x2 - 8 return f1 ** 2 + f2 ** 2

Define the task with the bounds and the configuration of the optimizer

task = Sphere( variables=[ContinuousMultiVariable(name="x", lowerbounds=[-100.0, -100.0], upperbound=[100.0, 100.0])], )

configuration = ParticleSwarmOptimizationConfig( populationsize=200, fitnesserror=10e-4, maxcycles=400, c1=0.1, c2=0.1, w=[0.35, 1], ) optimizationresult = ParticleSwarmOptimization(configuration).optimize(task) ```

You can also specify the mode of the solver by using the mode argument of the optimize method. For instance, if you want to run the Particle Swarm Optimization algorithm in parallel with threads, you can write:

python optimization_result = ParticleSwarmOptimization(configuration).optimize(task, mode="thread")

The possible values of the mode parameter are: - serial: the algorithm is run in serial mode; - process: the algorithm is run in parallel with processes; - thread: the algorithm is run in parallel with threads.

In case of process and thread modes, you can also specify the number of processes or threads to use by using the n_jobs argument of the optimize method:

python optimization_result = ParticleSwarmOptimization(configuration).optimize(task, mode="thread", workers=4)

The optimization result is a dictionary containing the following keys: - evolution: a list of the agents found at each generation - rates: a list of the fitness values of the agents found at each generation - best_solution: the best agent found by the algorithm

Explicitly, the evolution key contains a list of Population, i.e. a dictionary which agents key contains a list of Agent. The latter is a dictionary composed by the following basic keys: - position: the position of the agent - fitness: the fitness value of the agent - cost: the cost of the agent

```python from pydantic import BaseModel

class Agent(BaseModel): position: list[float] cost: float fitness: float ```

These are the basic information, but each algorithm can add more information to the agent, such as the velocity in the case of PSO.

Discrete problems

A typical problem involving discrete variables is the optimization of the hyperparameters of a Machine Learning model, such as a Support Vector Classifier (SVC). You can use pyVolutionary to accomplish this task. In the following, we provide an example using the Particle Swarm Optimization (PSO) as the optimizer.

```python from typing import Any from sklearn.svm import SVC from sklearn.modelselection import traintest_split from sklearn.preprocessing import StandardScaler from sklearn import datasets, metrics

from pyvolutionary import ( best_agent, ContinuousVariable, DiscreteVariable, ParticleSwarmOptimization, ParticleSwarmOptimizationConfig, Task, )

Load the data set; In this example, the breast cancer dataset is loaded.

X, y = datasets.loadbreastcancer(returnXy=True)

Create training and test split

Xtrain, Xtest, ytrain, ytest = traintestsplit(X, y, testsize=0.3, randomstate=1, stratify=y)

sc = StandardScaler() Xtrainstd = sc.fittransform(Xtrain) Xteststd = sc.transform(X_test)

class SvmOptimizedProblem(Task): def objectivefunction(self, x: list[Any]): xtransformed = self.transformsolution(x) C, kernel = xtransformed["C"], xtransformed["kernel"] degree, gamma = xtransformed["degree"], x_transformed["gamma"]

    svc = SVC(C=C, kernel=kernel, degree=degree, gamma=gamma, probability=True, random_state=1)
    svc.fit(X_train_std, y_train)
    y_predict = svc.predict(X_test_std)
    return metrics.accuracy_score(y_test, y_predict)

task = SvmOptimizedProblem( variables=[ ContinuousVariable(lowerbound=0.01, upperbound=1000., name="C"), DiscreteVariable(choices=["linear", "poly", "rbf", "sigmoid"], name="kernel"), DiscreteVariable(choices=[*range(1, 6)], name="degree"), DiscreteVariable(choices=["scale", "auto", 0.01, 0.05, 0.1, 0.5, 1.0], name="gamma"), ], minmax="max", )

configuration = ParticleSwarmOptimizationConfig( populationsize=200, fitnesserror=10e-4, max_cycles=100, c1=0.1, c2=0.1, w=[0.35, 1], )

result = ParticleSwarmOptimization(configuration).optimize(task) best = best_agent(result.evolution[-1].agents, task.minmax)

print(f"Best parameters: {task.transform_solution(best.position)}") print(f"Best accuracy: {best.cost}") ```

You can replace the PSO with any other algorithm implemented in the library.

Combinatorial problems

Within the framework of pyVolutionary for addressing the Traveling Salesman Problem (TSP), a solution is a plausible route signifying a tour that encompasses visiting all cities precisely once and returning to the initial city. Typically, this solution is articulated as a permutation of the cities, wherein each city features exactly once in the permutation.

As an illustration, consider a TSP scenario involving 5 cities denoted as A, B, C, D, and E. A potential solution might be denoted by the permutation [A, B, D, E, C], illustrating the order in which the cities are visited. This interpretation indicates that the tour initiates at city A, proceeds to city B, then D, E, and ultimately C before looping back to city A.

The following code snippet illustrates how to solve the TSP with the Virus Colony Search Optimization algorithm.

```python from typing import Any import numpy as np from pyvolutionary import ( best_agent, Task, PermutationVariable, VirusColonySearchOptimization, VirusColonySearchOptimizationConfig, ) from pyvolutionary.helpers import distance

class TspProblem(Task): def objectivefunction(self, x: list[Any]) -> float: xtransformed = self.transformsolution(x) routes = xtransformed["routes"] citypos = self.data["citypositions"] nroutes = len(routes) return np.sum([distance( citypos[route], citypos[routes[(idx + 1) % nroutes]] ) for idx, route in enumerate(routes)])

citypositions = [ [60, 200], [180, 200], [80, 180], [140, 180], [20, 160], [100, 160], [200, 160], [140, 140], [40, 120], [100, 120], [180, 100], [60, 80], [120, 80], [180, 60], [20, 40], [100, 40], [200, 40], [20, 20], [60, 20], [160, 20] ] task = TspProblem( variables=[PermutationVariable(name="routes", items=list(range(0, len(citypositions))))], data={"citypositions": citypositions}, ) configuration = VirusColonySearchOptimizationConfig( populationsize=10, fitnesserror=0.01, maxcycles=100, lamda=0.1, sigma=2.5, ) result = VirusColonySearchOptimization(configuration).optimize(task) best = bestagent(result.evolution[-1].agents, task.minmax)

print(f"Best real scheduling: {task.transform_solution(best.position)}") print(f"Best fitness: {best.cost}") ```

Multi-objective problems

pyVolutionary also supports multi-objective problems. A multi-objective problem is a problem with more than one objective function. All the objective functions are then "mixed" together by means of a weight vector. The latter has to be specified within the configuration of the Task class. The following problem is an example of a multi-objective problem solved by pyVolutionary with the Forest Optimization Algorithm (the latter can be replaced with any other algorithm implemented in the library):

```python import numpy as np from pyvolutionary import Task, MultiObjectiveVariable, ForestOptimizationAlgorithm, ForestOptimizationAlgorithmConfig

class MultiObjectiveBenchmark(Task): # Link: https://en.wikipedia.org/wiki/Testfunctionsforoptimization def objectivefunction(self, solution): def booth(x, y): return (x + 2 * y - 7) ** 2 + (2 * x + y - 5) ** 2

    def bukin(x, y):
        return 100 * np.sqrt(np.abs(y - 0.01 * x ** 2)) + 0.01 * np.abs(x + 10)

    def matyas(x, y):
        return 0.26 * (x ** 2 + y ** 2) - 0.48 * x * y

    return [booth(solution[0], solution[1]), bukin(solution[0], solution[1]), matyas(solution[0], solution[1])]

Define the task with the bounds and the configuration of the optimizer

task = MultiObjectiveBenchmark( variables=[MultiObjectiveVariable(name="x", lowerbounds=(-10, -10), upperbounds=(10, 10))], objective_weights=[0.4, 0.1, 0.5], )

configuration = ForestOptimizationAlgorithmConfig( populationsize=200, fitnesserror=10e-4, maxcycles=400, lifetime=5, arealimit=50, localseedingchanges=1, globalseedingchanges=2, transfer_rate=0.5, )

optimization_result = ForestOptimizationAlgorithm(configuration).optimize(task) ```

Constrained problems

pyVolutionary also supports constrained problems. They are implemented as usual, but the objective function has to specify the constraints, thus returning the cost of the constrained solution. Here is an example of a constrained problem solved by pyVolutionary with the Ant Lion Optimization algorithm (the latter can be replaced with any other algorithm implemented in the library):

```python import numpy as np from pyvolutionary import Task, ContinuousMultiVariable, AntLionOptimization, AntLionOptimizationConfig

Link: https://onlinelibrary.wiley.com/doi/pdf/10.1002/9781119136507.app2

class ConstrainedBenchmark(Task): def objective_function(self, solution): def g1(x): return 2 * x[0] + 2 * x[1] + x[9] + x[10] - 10

    def g2(x):
        return 2 * x[0] + 2 * x[2] + x[9] + x[10] - 10

    def g3(x):
        return 2 * x[1] + 2 * x[2] + x[10] + x[11] - 10

    def g4(x):
        return -8 * x[0] + x[9]

    def g5(x):
        return -8 * x[1] + x[10]

    def g6(x):
        return -8 * x[2] + x[11]

    def g7(x):
        return -2 * x[3] - x[4] + x[9]

    def g8(x):
        return -2 * x[5] - x[6] + x[10]

    def g9(x):
        return -2 * x[7] - x[8] + x[11]

    def violate(value):
        return 0 if value <= 0 else value

    fx = 5 * np.sum(solution[:4]) - 5 * np.sum(solution[:4] ** 2) - np.sum(solution[4:])

    fx += violate(g1(solution)) ** 2 + violate(g2(solution)) + violate(g3(solution)) + (
        2 * violate(g4(solution)) + violate(g5(solution)) + violate(g6(solution))
    ) + violate(g7(solution)) + violate(g8(solution)) + violate(g9(solution))
    return fx

Define the task with the bounds and the configuration of the optimizer

lowerbounds = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] upperbounds = [1, 1, 1, 1, 1, 1, 1, 1, 1, 100, 100, 100, 1] task = ConstrainedBenchmark( variables=([ContinuousMultiVariable(name="x", lowerbounds=lowerbounds, upperbounds=upperbounds)]) )

configuration = AntLionOptimizationConfig(populationsize=200, fitnesserror=10e-4, maxcycles=400) optimizationresult = AntLionOptimization(configuration).optimize(task) ```

A multi-objective constrained problem can be also managed by pyVolutionary. In this case, the objective function must return a list of costs, and the constraints must be specified in the objective function of the Task class as well.

Extending the library

pyVolutionary is designed to be easily extensible. You can add your own algorithms and problems to the library by following the instructions below.

Adding a new algorithm

To add a new algorithm, you need to create a new class that inherits from the OptimizationAbstract class. The new class must implement the optimization_step method, where you can implement your new metaheuristic algorithm.

The constructor of the new class must accept a config parameter, which is a Pydantic model extending the BaseOptimizationConfig class. This class contains the parameters of the algorithm, such as the population size, the number of generations, etc.

```python from pydantic import BaseModel

class BaseOptimizationConfig(BaseModel): populationsize: int fitnesserror: float | None = None max_cycles: int ```

The examples listed in the following section can be used as a reference for the implementation of a new algorithm.

Once you created your new classes, you can run the algorithm by calling the optimize method, which takes as input a Task object and returns a dictionary as above described.

Utilities

pyVolutionary provides a set of utilities to facilitate the use of the library.

HyperTuner Hyper-parameter tuning

pyVolutionary provides a HyperTuner class to perform hyperparameter tuning of a model, by means of the algorithms implemented in the library. The class can be used to replace the GridSearchCV of scikit-learn:

```python from opfunu.cec_based.cec2017 import F52017

from pyvolutionary import ContinuousMultiVariable, Task, BiogeographyBasedOptimization, HyperTuner

f1 = F52017(30, f_bias=0)

class Problem(Task): # Link: https://en.wikipedia.org/wiki/Testfunctionsforoptimization def objectivefunction(self, solution): return f1.evaluate(solution)

Define the task with the bounds and the configuration of the optimizer

task = Problem( variables=[ContinuousMultiVariable(name="x", lowerbounds=f1.lb, upperbounds=f1.ub)], )

paramsbbogrid = { "maxcycles": [10, 20, 30, 40], "populationsize": [50, 100, 150], "nelites": [3, 4, 5, 6], "pm": [0.01, 0.02, 0.05] }

model = BiogeographyBasedOptimization() tuner = HyperTuner(model, paramsbbogrid)

tuner.execute(task=task)

print(f"Best row {tuner.bestrow}") print(f"Best score {tuner.bestscore}") print(f"Best parameters {tuner.best_parameters}")

bestresult = tuner.resolve() print(f"Best solution after tuning {bestresult.best_solution}")

tuner.exportresults("csv") tuner.exportresults("dataframe") tuner.export_results("json") ```

Multitasking

pyVolutionary provides a Multitask class to perform multitasking optimization. The class can become very precious when you need to optimize multiple tasks with multiple algorithms in parallel. In case, for instance, of multiple tasks with the same algorithm, you can use the Multitask class to run the optimization in parallel. Furthermore, the Multitask class can be used to run multiple tasks with different algorithms in parallel. Here is an example of how to use the Multitask class:

```python from opfunu.cec_based.cec2017 import F52017, F102017, F292017

from pyvolutionary import ( ContinuousMultiVariable, Task, NuclearReactionOptimization, Multitask, NuclearReactionOptimizationConfig, MountainGazelleOptimization, MountainGazelleOptimizationConfig, GrasshopperOptimization, GrasshopperOptimizationConfig, GizaPyramidConstructionOptimization, GizaPyramidConstructionOptimizationConfig, )

f1 = F52017(30, fbias=0) f2 = F102017(30, fbias=0) f3 = F292017(30, f_bias=0)

class Problem1(Task): def objective_function(self, solution): return f1.evaluate(solution)

class Problem2(Task): def objective_function(self, solution): return f3.evaluate(solution)

class Problem3(Task): def objective_function(self, solution): return f1.evaluate(solution)

task1 = Problem1( variables=[ContinuousMultiVariable(name="x", lowerbounds=f1.lb, upperbounds=f1.ub)], ) task2 = Problem2( variables=[ContinuousMultiVariable(name="x", lowerbounds=f2.lb, upperbounds=f2.ub)], ) task3 = Problem3( variables=[ContinuousMultiVariable(name="x", lowerbounds=f3.lb, upperbounds=f3.ub)], )

model1 = NuclearReactionOptimization( config=NuclearReactionOptimizationConfig(maxcycles=10000, populationsize=50) ) model2 = MountainGazelleOptimization( config=MountainGazelleOptimizationConfig(maxcycles=10000, populationsize=50) ) model3 = GrasshopperOptimization( config=GrasshopperOptimizationConfig(maxcycles=10000, populationsize=50, cmin=0.00004, cmax=2.0,) ) model4 = GizaPyramidConstructionOptimization( config=GizaPyramidConstructionOptimizationConfig( maxcycles=10000, populationsize=50, theta=14, friction=[1, 10], prob_substitution=0.5, ) )

multitask = Multitask( algorithms=(model1, model2, model3, model4), tasks=(task1, task2, task3), modes=("thread", ), n_workers=4 )

multitask.execute(ntrials=2, njobs=2, debug=True)

multitask.exportresults("csv") multitask.exportresults("dataframe") multitask.export_results("json") ```

Agent characteristics

The characteristics of an agent can be extracted by using two functions: - agent_trend: it returns the trend of the agent at each iteration - agent_position: it returns the position of the agent at each iteration

python agent_trend(optimization_result: OptimizationResult, idx: int, iters: list[int] | None = None) -> list[float] agent_position(optimization_result: OptimizationResult, idx: int, iters: list[int] | None = None) -> list[list[float]]

where: - optimization_result: the result from the optimization algorithm - idx: the index of the agent to consider - iters: a list of the iterations to consider. If None, all the iterations are considered.

The two methods return a list of the cost or location in the space search, respectively, of the considered agent at each of the specified iterations.

Best agent characteristics

Specifically for the best agent, you can use two functions in order to locate its position in the space search and to extract the trend of its cost, at each iteration:

python best_agent_trend(optimization_result: OptimizationResult, iters: list[int] | None = None) -> list[float] best_agent_position(optimization_result: OptimizationResult, iters: list[int] | None = None) -> list[list[float]]

Algorithms

The following algorithms are currently implemented in pyVolutionary:

| Algorithm | Class | Year | Paper | Example | |--------------------------------------------------------|------------------------------------------|------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------| | African Vulture Optimization | AfricanVultureOptimization | 2022 | paper | example | | Ant Colony Optimization | AntColonyOptimization | 2008 | paper | example | | Ant Lion Optimization | AntLionOptimization | 2015 | paper | example | | Aquila Optimization | AquilaOptimization | 2021 | paper | example | | Archimede Optimization | ArchimedeOptimization | 2021 | paper | example | | Artificial Bee Colony Optimization | BeeColonyOptimization | 2007 | paper | example | | Bacterial Foraging Optimization | BacterialForagingOptimization | 2002 | paper | example | | Bat Optimization | BatOptimization | 2010 | paper | example | | Battle Royale Optimization | BattleRoyaleOptimization | 2021 | paper | example | | Biogeography-Based Optimization | BiogeographyBasedOptimization | 2008 | paper | example | | Brain Storm Optimization (Original) | BrainStormOptimization | 2011 | paper | example | | Brain Storm Optimization (Improved) | ImprovedBrainStormOptimization | 2017 | paper | example | | Brown-Bear Optimization | BrownBearOptimization | 2023 | paper | example | | Camel Caravan Optimization | CamelCaravanOptimization | 2016 | paper | example | | Cat Swarm Optimization | CatSwarmOptimization | 2006 | paper | example | | Chaos Game Optimization | ChaosGameOptimization | 2021 | paper | example | | Chernobyl Disaster Optimization | ChernobylDisasterOptimization | 2023 | paper | example | | Coati Optimization | CoatiOptimization | 2023 | paper | example | | Coral Reef Optimization | CoralReefOptimization | 2014 | paper | example | | Coyotes Optimization | CoyotesOptimization | 2018 | paper | example | | Coronavirus Herd Immunity Optimization | CoronavirusHerdImmunityOptimization | 2021 | paper | example | | Cuckoo Search Optimization | CuckooSearchOptimization | 2009 | paper | example | | Dragonfly Optimization | DragonflyOptimization | 2016 | paper | example | | Dwarf Mongoose Optimization | DwarfMongooseOptimization | 2022 | paper | example | | Earthworms Optimization | EarthwormsOptimization | 2015 | paper | example | | Egret Swarm Optimization | EgretSwarmOptimization | 2022 | paper | example | | Electromagnetic Field Optimization | ElectromagneticFieldOptimization | 2016 | paper | example | | Elephant Herd Optimization | ElephantHerdOptimization | 2015 | paper | example | | Energy Valley Optimization | EnergyValleyOptimization | 2023 | paper | example | | Fick's Law Optimization | FicksLawOptimization | 2023 | paper | example | | Firefly Swarm Optimization | FireflySwarmOptimization | 2009 | paper | example | | Fire Hawk Optimization | FireHawkOptimization | 2022 | paper | example | | Fireworks Optimization | FireworksOptimization | 2010 | paper | example | | Fish School Search Optimization | FishSchoolSearchOptimization | 2008 | paper | example | | Flower Pollination Algorithm Optimization | FlowerPollinationAlgorithmOptimization | 2012 | paper | example | | Forensic Based Investigation Optimization | ForensicBasedInvestigationOptimization | 2020 | paper | example | | Forest Optimization Algorithm | ForestOptimizationAlgorithm | 2014 | paper | example | | Fox Optimization | FoxOptimization | 2023 | paper | example | | Gaining Sharing Knowledge-based Algorithm Optimization | GainingSharingKnowledgeOptimization | 2020 | paper | example | | Genetic Algorithm Optimization | GeneticAlgorithmOptimization | 1989 | paper | example | | Germinal Center Optimization | GerminalCenterOptimization | 2018 | paper | example | | Giant Trevally Optimization | GiantTrevallyOptimization | 2022 | paper | example | | Giza Pyramid Construction Optimization | GizaPyramidConstructionOptimization | 2021 | paper | example | | Golden Jackal Optimization | GoldenJackalOptimization | 2022 | paper | example | | Grasshopper Optimization Algorithm | GrasshopperOptimization | 2017 | paper | example | | Grey Wolf Optimization | GreyWolfOptimization | 2014 | paper | example | | Harmony Search Optimization | HarmonySearchOptimization | 2001 | paper | example | | Heap Based Optimization | HeapBasedOptimization | 2020 | paper | example | | Henry Gas Solubility Optimization | HenryGasSolubilityOptimization | 2019 | paper | example | | Hunger Games Search Optimization | HungerGamesSearchOptimization | 2021 | paper | example | | Imperialist Competitive Optimization | ImperialistCompetitiveOptimization | 2013 | paper | example | | Invasive Weed Optimization | InvasiveWeedOptimization | 2006 | paper | example | | Krill Herd Optimization | KrillHerdOptimization | 2012 | paper | example | | Levy Flight Jaya Swarm Optimization | LeviFlightJayaSwarmOptimization | 2021 | paper | example | | Marine Predators Optimization | MarinePredatorsOptimization | 2020 | paper | example | | Monarch Butterfly Optimization | MonarchButterflyOptimization | 2019 | paper | example | | Moth-Flame Optimization | MothFlameOptimization | 2015 | paper | example | | Mountain Gazelle Optimization | MountainGazelleOptimization | 2022 | paper | example | | Multi-verse Optimization | MultiverseOptimization | 2016 | paper | example | | Nuclear Reaction Optimization | NuclearReactionOptimization | 2019 | paper | example | | Osprey Optimization | OspreyOptimization | 2023 | paper | example | | Particle Swarm Optimization | ParticleSwarmOptimization | 1995 | paper | example | | Pathfinder Algorithm Optimization | PathfinderAlgorithmOptimization | 2019 | paper | example | | Pelican Optimization | PelicanOptimization | 2022 | paper | example | | Runge Kutta Optimization | RungeKuttaOptimization | 2021 | paper | example | | Salp Swarm Optimization | SalpSwarmOptimization | 2017 | paper | example | | Seagull Optimization | SeagullOptimization | 2019 | paper | example | | Serval Optimization | ServalOptimization | 2022 | paper | example | | Siberian Tiger Optimization | SiberianTigerOptimization | 2022 | paper | example | | Sine Cosine Algorithm | SineCosineAlgorithmOptimization | 2016 | paper | example | | (Q-learning embedded) Sine Cosine Algorithm | QleSineCosineAlgorithmOptimization | 2016 | paper | example | | Spotted Hyena Optimization | SpottedHyenaOptimization | 2017 | paper | example | | Success History Intelligent Optimization | SuccessHistoryIntelligentOptimization | 2022 | paper | example | | Swarm Hill Climbing Optimization | SwarmHillClimbingOptimization | 1993 | paper | example | | Tasmanian Devil Optimization | TasmanianDevilOptimization | 2022 | paper | example | | Tuna Swarm Optimization | TunaSwarmOptimization | 2021 | paper | example | | Virus Colony Search Optimization | VirusColonySearchOptimization | 2016 | paper | example | | Walrus Optimization | WalrusOptimization | 2022 | paper | example | | War Strategy Optimization | WarStrategyOptimization | 2022 | paper | example | | Water Cycle Optimization | WaterCycleOptimization | 2012 | paper | example | | Whales Optimization | WhalesOptimization | 2016 | paper | example | | Wildebeest Herd Optimization | WildebeestHerdOptimization | 2019 | paper | example | | Wind Driven Optimization | WindDrivenOptimization | 2013 | paper | example | | Zebra Optimization | ZebraOptimization | 2022 | paper | example |

Practical examples

The following examples show how to use pyVolutionary to solve some practical problems.

| Problem | Example | |------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------| | Employee Rostering Problem | example | | Healthcare Workflow Optimization Problem | example | | Job Shop Scheduling Problem | example | | Location Optimization Problem | example | | Maintenance Scheduling Problem | example | | Production Optimization Problem | example | | Shortest Path Problem | example | | Supply Chain Problem | example |

Owner

  • Name: matteocacciola
  • Login: matteocacciola
  • Kind: user

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: pyVolutionary
message: Please cite this software using these metadata.
type: software
authors:
  - given-names: Matteo
    family-names: Cacciola
    email: matteo.cacciola@gmail.com
    orcid: 'https://orcid.org/0000-0001-7795-4396'
identifiers:
  - type: url
    value: 'https://github.com/matteocacciola/pyvolutionary'
    description: The URL of the GitHub repository
repository-code: 'https://github.com/matteocacciola/pyvolutionary'
url: 'https://pypi.org/project/pyVolutionary/'
abstract: >-
  pyVolutionary is a package collecting metaheuristic
  algorithms, available for free usage and able to solve a
  wide range of optimization problems.
keywords:
  - Evolutionary Computation
  - Heuristic algorithms
  - Optimization problems
  - Natural Computation
  - Python
  - Artificial Intelligence
license: GPL-3.0-only
version: 2.6.5
date-released: '2024-09-16'

GitHub Events

Total
  • Release event: 4
  • Watch event: 1
  • Push event: 10
  • Create event: 4
Last Year
  • Release event: 4
  • Watch event: 1
  • Push event: 10
  • Create event: 4

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 71
  • Total Committers: 1
  • Avg Commits per committer: 71.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 10
  • Committers: 1
  • Avg Commits per committer: 10.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Matteo Cacciola m****a@g****m 71

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: 1 day
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 8.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • vsedov (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 287 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 24
  • Total maintainers: 1
pypi.org: pyvolutionary

pyVolutionary is a package collecting metaheuristic algorithms, available for free usage and able to solve a wide range of optimization problems.

  • Versions: 24
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 287 Last month
Rankings
Dependent packages count: 10.1%
Average: 38.2%
Dependent repos count: 66.4%
Maintainers (1)
Last synced: 7 months ago

Dependencies

poetry.lock pypi
  • alabaster 0.7.13
  • annotated-types 0.6.0
  • astroid 3.0.2
  • babel 2.14.0
  • certifi 2023.11.17
  • cfgv 3.4.0
  • charset-normalizer 3.3.2
  • colorama 0.4.6
  • contourpy 1.2.0
  • coverage 7.4.0
  • cycler 0.12.1
  • dill 0.3.7
  • distlib 0.3.8
  • docutils 0.18.1
  • filelock 3.13.1
  • fonttools 4.47.0
  • identify 2.5.33
  • idna 3.6
  • imagesize 1.4.1
  • iniconfig 2.0.0
  • install 1.3.5
  • isort 5.13.2
  • jinja2 3.1.2
  • joblib 1.3.2
  • kiwisolver 1.4.5
  • markdown-it-py 3.0.0
  • markupsafe 2.1.3
  • matplotlib 3.8.2
  • mccabe 0.7.0
  • mdit-py-plugins 0.4.0
  • mdurl 0.1.2
  • myst-parser 2.0.0
  • nodeenv 1.8.0
  • numpy 1.26.3
  • packaging 23.2
  • pillow 10.2.0
  • platformdirs 4.1.0
  • pluggy 1.3.0
  • pre-commit 3.6.0
  • pydantic 2.5.3
  • pydantic-core 2.14.6
  • pygments 2.17.2
  • pylint 3.0.3
  • pyparsing 3.1.1
  • pytest 7.4.4
  • python-dateutil 2.8.2
  • python-json-logger 2.0.7
  • pyyaml 6.0.1
  • requests 2.31.0
  • requests-mock 1.11.0
  • scikit-learn 1.3.2
  • scipy 1.11.4
  • setuptools 69.0.3
  • six 1.16.0
  • snowballstemmer 2.2.0
  • sphinx 7.2.6
  • sphinx-rtd-theme 1.3.0
  • sphinxcontrib-applehelp 1.0.7
  • sphinxcontrib-devhelp 1.0.5
  • sphinxcontrib-htmlhelp 2.0.4
  • sphinxcontrib-jquery 4.1
  • sphinxcontrib-jsmath 1.0.1
  • sphinxcontrib-qthelp 1.0.6
  • sphinxcontrib-serializinghtml 1.1.9
  • sphynx 0.0.3
  • structlog 21.5.0
  • threadpoolctl 3.2.0
  • tomlkit 0.12.3
  • typing-extensions 4.9.0
  • urllib3 2.1.0
  • virtualenv 20.25.0
  • wrapt 1.16.0
pyproject.toml pypi
  • coverage ^7.3.2
  • install ^1.3.5
  • matplotlib ^3.8.1
  • numpy ^1.26.1
  • pydantic ^2.4.2
  • python >=3.11,<3.13
  • scikit-learn ^1.3.2
  • sphynx ^0.0.3