py4sci

News

03/2013 PyGMO tries GSoC. Project pages

02/2013 V1.1.4 is out! Release notes

Get PyGMO: UNIX

First you need to prepare your system to run PyGMO. (and install third-party optional packages)

Then you may get PyGMO

As a last step, compile and install PyGMO

Get PyGMO: win32

Download the autoinstaller

Shortcuts

Algorithms

Problems

Topologies

Report a Bug

Go to our bugtracker

Request for support

Contact our mailinglist

Algorithms

A Quick Look

Algorithms in PyGMO are objects, constructed and then used to optimize a problem via their evolve method. The user can implement his own algorithm in Python (in which case they need to derive from PyGMO.algorithm.base). You may follow the Tutorial 3: Coding your own algorithm in Python. We also provide a number of algorithms that are considered useful for general purposes. Each algorithm can be associated only to problems of certain types: (Continuous, Integer or Mixed Integer)-(Constrained, Unconstrained)-(Single, Multi-objective).

Heuristic Optimization

Common Name Name in PyGMO Type Comments
Differential Evolution (DE) PyGMO.algorithm.de C-U-S The original algorithm
Self-adaptive DE (jDE) PyGMO.algorithm.jde C-U-S Self-adaptive F, CR
DE with p-best crossover (mde_pbx) PyGMO.algorithm.mde_pbx C-U-S Self-adaptive F, CR
Differential Evolution (DE) PyGMO.algorithm.de_1220 C-U-S Our own brew. self adaptive F, CR and variants
Particle Swarm Optimization (PSO) PyGMO.algorithm.pso C-U-S The PSO algorithm (canonical, with constriction factor, FIPS, etc.)
Particle Swarm Optimization (PSO) PyGMO.algorithm.pso_gen C-U-S Generational (also problems deriving from base_stochastic)
Simple Genetic Algorithm (SGA) PyGMO.algorithm.sga MI-U-S  
(N+1)-EA Evol. Algorithm (SEA) PyGMO.algorithm.sea I-U-M The multiobjective extension uses crowding distance operator
Non-dominated Sorting GA (NSGA2) PyGMO.algorithm.nsga_II C-U-M NSGA-II
Corana’s Simulated Annealing (SA) PyGMO.algorithm.sa_corana C-U-S  
Artificial Bee Colony (ABC) PyGMO.algorithm.bee_colony C-U-S  
Improved Harmony Search (IHS) PyGMO.algorithm.ihs MI-U-M Integer and Multiobjetive not tested yet
Monte Carlo Search (MC) PyGMO.algorithm.monte_carlo MI-C-S  
Monte Carlo Search (MC) PyGMO.algorithm.py_example MI-C-S Written directly in Python
Covariance Matrix Adaptation-ES PyGMO.algorithm.py_cmaes C-U-S Written directly in Python
Covariance Matrix Adaptation-ES PyGMO.algorithm.cmaes C-U-S  

Meta-algorithms

Common Name Name in PyGMO Type Comments
Monotonic Basin Hopping (MBH) PyGMO.algorithm.mbh N/A  
Multistart (MS) PyGMO.algorithm.ms N/A  
Penalty Function (PF)     Planned
Augmented Lagrangian (AL) PyGMO.algorithm.nlopt_auglag C-C-S Requires PyGMO to be compiled with nlopt option. Minimization assumed
Augmented Lagrangian (AL) PyGMO.algorithm.nlopt_auglag_eq C-C-S Requires PyGMO to be compiled with nlopt option. Minimization assumed

Local optimization

Common Name Name in PyGMO Type Comments
Compass Search (CS) PyGMO.algorithm.cs C-U-S  
Nelder-Mead simplex PyGMO.algorithm.scipy_fmin C-U-S SciPy required. Minimization assumed
Nelder-Mead simplex PyGMO.algorithm.gsl_nm C-U-S Requires PyGMO to be compiled with GSL option. Minimization assumed
Nelder-Mead simplex variant 2 PyGMO.algorithm.gsl_nm2 C-U-S Requires PyGMO to be compiled with GSL option. Minimization assumed
Nelder-Mead simplex variant 2r PyGMO.algorithm.gsl_nm2rand C-U-S Requires PyGMO to be compiled with GSL option. Minimization assumed
Subplex (a Nelder-Mead variant) PyGMO.algorithm.nlopt_sbplx C-C-S Requires PyGMO to be compiled with nlopt option. Minimization assumed
L-BFGS-B PyGMO.algorithm.scipy_l_bfgs_b C-U-S SciPy required. Minimization assumed
BFGS PyGMO.algorithm.gsl_bfgs2 C-U-S Requires PyGMO to be compiled with GSL option. Minimization assumed
BFGS 2 PyGMO.algorithm.gsl_bfgs C-U-S Requires PyGMO to be compiled with GSL option. Minimization assumed
Sequential Least SQuares Prog. PyGMO.algorithm.scipy_slsqp C-C-S SciPy required. Minimization assumed
Sequential Least SQuares Prog. PyGMO.algorithm.nlopt_slsqp C-C-S Requires PyGMO to be compiled with nlopt option. Minimization assumed
Truncated Newton Method PyGMO.algorithm.scipy_tnc C-U-S SciPy required. Minimization assumed
Conjugate Gradient (fr) PyGMO.algorithm.gsl_fr C-U-S Requires PyGMO to be compiled with GSL option. Minimization assumed
Conjugate Gradient (pr) PyGMO.algorithm.gsl_pr C-U-S Requires PyGMO to be compiled with GSL option. Minimization assumed
COBYLA PyGMO.algorithm.scipy_cobyla C-C-S SciPy required. Minimization assumed
COBYLA PyGMO.algorithm.nlopt_cobyla C-C-S Requires PyGMO to be compiled with nlopt option. Minimization assumed
BOBYQA PyGMO.algorithm.nlopt_bobyqa C-C-S Requires PyGMO to be compiled with nlopt option. Minimization assumed
Method of Moving Asymptotes PyGMO.algorithm.nlopt_mma C-C-S Requires PyGMO to be compiled with nlopt option. Minimization assumed
SNOPT PyGMO.algorithm.snopt C-C-S Requires PyGMO to be compiled with snopt option. Minimization assumed
IPOPT PyGMO.algorithm.ipopt C-C-S Requires PyGMO to be compiled with ipopt option. Minimization assumed

Detailed Documentation

class PyGMO.algorithm._base

All algorithms derive from this class. It cannot be instantiated

evolve((_base)arg1, (population)arg2) → population :

Returns the evolved population

class PyGMO.algorithm.base

All Algorithms written in Python derive from this class

class PyGMO.algorithm.de(gen=100, f=0.8, cr=0.9, variant=2, ftol=1e-06, xtol=1e-06, screen_output=False)

Differential evolution algorithm.

__init__(gen=100, f=0.8, cr=0.9, variant=2, ftol=1e-06, xtol=1e-06, screen_output=False)

Constructs a Differential Evolution algorithm:

USAGE: algorithm.de(gen=1, f=0.5, cr=0.9, variant=2, ftol=1e-6, xtol=1e-6, screen_output = False)

  • gen: number of generations

  • f: weighting factor in [0,1] (if -1 self-adptation is used)

  • cr: crossover in [0,1] (if -1 self-adptation is used)

  • variant: algoritmic variant to use (one of [1 .. 10])
    1. DE/best/1/exp
    2. DE/rand/1/exp
    3. DE/rand-to-best/1/exp
    4. DE/best/2/exp
    5. DE/rand/2/exp
    6. DE/best/1/bin
    7. DE/rand/1/bin
    8. DE/rand-to-best/1/bin
    9. DE/best/2/bin
    10. DE/rand/2/bin
  • ftol stop criteria on f

  • xtol stop criteria on x

class PyGMO.algorithm.jde(gen=100, variant=2, variant_adptv=1, ftol=1e-06, xtol=1e-06, memory=False, screen_output=False)

Self-Adaptive Differential Evolution Algorithm: jDE.

__init__(gen=100, variant=2, variant_adptv=1, ftol=1e-06, xtol=1e-06, memory=False, screen_output=False)

Constructs a jDE algorithm (self-adaptive DE)

REF: “Self-adaptive differential evolution algorithm in constrained real-parameter optimization” J Brest, V Zumer, MS Maucec - Evolutionary Computation, 2006. http://dsp.szu.edu.cn/DSP2006/research/publication/yan/WebEdit/UploadFile/Self-adaptive%20Differential%20Evolution%20Algorithm%20for%20Constrained%20Real-Parameter%20Optimization.pdf

USAGE: algorithm.jde(gen=100, variant=2, variant_adptv=1, ftol=1e-6, xtol=1e-6, memory = False, screen_output = False)

  • gen: number of generations

  • variant: algoritmic variant to use (one of [1 .. 18])

    1. best/1/exp 2. rand/1/exp 3. rand-to-best/1/exp 4. best/2/exp 5. rand/2/exp 6. best/1/bin 7. rand/1/bin 8. rand-to-best/1/bin 9. best/2/bin 10. rand/2/bin 11. best/3/exp 12. best/3/bin 13. rand/3/exp 14. rand/3/bin 15. rand-to-current/2/exp 16. rand-to-current/2/bin 17. rand-to-best-and-current/2/exp 18. rand-to-best-and-current/2/bin

  • variant_adptv: adaptive scheme to use (one of [1..2])
    1. random param mutation 2. param mutation follows rand/3 scheme
  • ftol: stop criteria on f

  • xtol: stop criteria on x

  • memory: if True the algorithm internal state is saved and used for the next call

  • screen_output: activates screen output of the algorithm (do not use in archipealgo, otherwise the screen will be flooded with

  • different island outputs)

class PyGMO.algorithm.mde_pbx(gen=100, qperc=0.15, nexp=1.5, ftol=1e-06, xtol=1e-06, screen_output=False)

Self-Adaptive Differential Evolution Algorithm: mde_pbx.

__init__(gen=100, qperc=0.15, nexp=1.5, ftol=1e-06, xtol=1e-06, screen_output=False)

Constructs a mde_pbx algorithm (self-adaptive DE)

REF: “An Adaptive Differential Evolution Algorithm With Novel Mutation and Crossover Strategies for Global Numerical Optimization” - IEEE TRANSACTIONS ON SYSTEMS, MAN, AND CYBERNETICS?PART B: CYBERNETICS, VOL. 42, NO. 2, APRIL 20

USAGE: algorithm.mde_pbx(gen=100, qperc=0.15, nexp=1.5, ftol=1e-6, xtol=1e-6, screen_output = False)

  • gen: number of generations
  • qperc: percentage of population to choose the best vector
  • nexp: exponent for the powermean
  • ftol: stop criteria on f
  • xtol: stop criteria on x
  • screen_output: activates screen output of the algorithm (do not use in archipealgo, otherwise the screen will be flooded with
  • different island outputs)
class PyGMO.algorithm.de_1220(gen=100, variant_adptv=1, allowed_variants=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], memory=False, ftol=1e-06, xtol=1e-06, screen_output=False)

Differential Evolution Algorithm (our brew ...).

__init__(gen=100, variant_adptv=1, allowed_variants=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], memory=False, ftol=1e-06, xtol=1e-06, screen_output=False)

Constructs a Differential Evolution algorithm (our own brew). Self adaptation on F, CR and mutation variant.:

USAGE: algorithm.de_1220(gen=100, variant_adptv=1, allowed_variants = [i for i in range(1,19)], memory = False, ftol=1e-6, xtol=1e-6, screen_output = False)

  • gen: number of generations

  • variant_adptv: adaptiv scheme to use (one of [1..2])
    1. random param mutation 2. param mutation follows relative DE scheme
  • allowed_variants : a list of the algoritmic variants to mix and self-adapt. Allowed variants are ...

    1. best/1/exp 2. rand/1/exp 3. rand-to-best/1/exp 4. best/2/exp 5. rand/2/exp 6. best/1/bin 7. rand/1/bin 8. rand-to-best/1/bin 9. best/2/bin 10. rand/2/bin 11. best/3/exp 12. best/3/bin 13. rand/3/exp 14. rand/3/bin 15. rand-to-current/2/exp 16. rand-to-current/2/bin 17. rand-to-best-and-current/2/exp 18. rand-to-best-and-current/2/bin

  • ftol: stop criteria on f

  • xtol: stop criteria on x

  • memory: if True the algorithm internal state is saved and used for the next call

class PyGMO.algorithm.pso(gen=1, omega=0.7298, eta1=2.05, eta2=2.05, vcoeff=0.5, variant=5, neighb_type=2, neighb_param=4)

Particle Swarm Optimization (steady-state)

__init__(gen=1, omega=0.7298, eta1=2.05, eta2=2.05, vcoeff=0.5, variant=5, neighb_type=2, neighb_param=4)

Constructs a Particle Swarm Optimization (steady-state). The position update is applied immediately after the velocity update

REF (for variants 5-6): http://cswww.essex.ac.uk/staff/rpoli/papers/PoliKennedyBlackwellSI2007.pdf

REF (for variants 1-4): Kennedy, J.; Eberhart, R. (1995). “Particle Swarm Optimization”. Proceedings of IEEE International Conference on Neural Networks. IV. pp. 1942?1948.

USAGE: algorithm.pso(gen=1, omega = 0.7298, eta1 = 2.05, eta2 = 2.05, vcoeff = 0.5, variant = 5, neighb_type = 2, neighb_param = 4)

  • gen: number of generations

  • omega: constriction factor (or particle inertia weight) in [0,1]

  • eta1: Cognitive component in [0,4]

  • eta2: Social component in [0,4]

  • vcoeff: Maximum velocity coefficient (w.r.t. the box-bounds width) in [0,1]

  • variant: algoritmic variant to use (one of [1 .. 6])
    1. PSO canonical (with inertia weight)

    2. PSO canonical (with inertia weight

      and equal random weights of social and cognitive components)

    3. PSO variant (with inertia weight

      same random number for all components.)

    4. PSO variant (with inertia weight

      same random number for all components and equal weights of social and cognitive components)

    5. PSO canonical (with constriction factor)

    6. Fully Informed Particle Swarm (FIPS)

  • neighb_type: defines the particle neighbourhood (used for the social component)
    1. gbest neighbourhood topology (fully connected)
    2. lbest neighbourhood topology (ring)
    3. Von-Neumann neighbourhood topology (square lattice)
    4. Randomly-varying neighbourhood topology
  • neighb_param: if the lbest topology is selected, it represents each particle’s indegree

    (also outdegree) in the swarm topology. Particles have neighbours up to a radius of k = neighb_param / 2 in the ring. If the Randomly-varying neighbourhood topology is selected, neighb_param represents each particle’s maximum outdegree in the swarm topology. The minimum outdegree is 1 (the particle always connects back to itself).

class PyGMO.algorithm.pso_gen(gen=1, omega=0.7298, eta1=2.05, eta2=2.05, vcoeff=0.5, variant=5, neighb_type=2, neighb_param=4)

Particle Swarm Optimization (generational)

__init__(gen=1, omega=0.7298, eta1=2.05, eta2=2.05, vcoeff=0.5, variant=5, neighb_type=2, neighb_param=4)

Constructs a Particle Swarm Optimization (generational). The position update is applied only at the end of an entire loop over the population (swarm). Use this version for stochastic problems.

USAGE: algorithm.pso_gen(gen=1, omega = 0.7298, eta1 = 2.05, eta2 = 2.05, vcoeff = 0.5, variant = 5, neighb_type = 2, neighb_param = 4])

  • gen: number of generations

  • omega: constriction factor (or particle inertia weight) in [0,1]

  • eta1: Cognitive component in [0,4]

  • eta2: Social component in [0,4]

  • vcoeff: Maximum velocity coefficient (w.r.t. the box-bounds width) in [0,1]

  • variant: algoritmic variant to use (one of [1 .. 6])
    1. PSO canonical (with inertia weight)

    2. PSO canonical (with inertia weight

      and equal random weights of social and cognitive components)

    3. PSO variant (with inertia weight

      same random number for all components.)

    4. PSO variant (with inertia weight

      same random number for all components and equal weights of social and cognitive components)

    5. PSO canonical (with constriction factor)

    6. Fully Informed Particle Swarm (FIPS)

  • neighb_type: defines the particle neighbourhood (used for the social component)
    1. gbest neighbourhood topology (fully connected)
    2. lbest neighbourhood topology (ring)
    3. Von-Neumann neighbourhood topology (square lattice)
    4. Randomly-varying neighbourhood topology
  • neighb_param: if the lbest topology is selected, it represents each particle’s indegree

    (also outdegree) in the swarm topology. Particles have neighbours up to a radius of k = neighb_param / 2 in the ring. If the Randomly-varying neighbourhood topology is selected, neighb_param represents each particle’s maximum outdegree in the swarm topology. The minimum outdegree is 1 (the particle always connects back to itself).

class PyGMO.algorithm.sea(gen=100, limit=20)

(N+1)-EA - A Simple Evolutionary Algorithm

__init__(gen=100, limit=20)

Constructs a simple (N+1)-EA: A Simple Evolutionary Algorithm

USAGE: algorithm.ea(gen = 1) SEE : Oliveto, Pietro S., Jun He, and Xin Yao. “Time complexity of evolutionary algorithms for combinatorial optimization: A decade of results.” International Journal of Automation and Computing 4.3 (2007): 281-293.

  • gen: number of ‘generations’ (each generation is one function evaluation)
class PyGMO.algorithm.sga(gen=1, cr=0.95, m=0.02, elitism=1, mutation=PyGMO.algorithm._algorithm._mutation_type.GAUSSIAN, width=0.1, selection=PyGMO.algorithm._algorithm._selection_type.ROULETTE, crossover=PyGMO.algorithm._algorithm._crossover_type.EXPONENTIAL)

A simple genetic algorithm (generational)

__init__(gen=1, cr=0.95, m=0.02, elitism=1, mutation=PyGMO.algorithm._algorithm._mutation_type.GAUSSIAN, width=0.1, selection=PyGMO.algorithm._algorithm._selection_type.ROULETTE, crossover=PyGMO.algorithm._algorithm._crossover_type.EXPONENTIAL)

Constructs a Simple Genetic Algorithm (generational)

USAGE: algorithm.sga(self, gen=1, cr=.95, m=.02, elitism=1, mutation=sga.mutation.GAUSSIAN, width = 0.1, selection=sga.selection.ROULETTE, crossover=sga.crossover.EXPONENTIAL)

  • gen: number of generations

  • cr: crossover factor in [0,1]

  • m: mutation probability (for each component) [0,1]

  • elitism: number of generation after which the best is reinserted

  • mutation: mutation type (one of [RANDOM, GAUSSIAN])

  • width: the mutation width (in case of a GAUSSIAN bell

    this is the std normalized with the width)

  • selection: selection startegy (one of [ROULETTE, BEST20])

  • crossover: crossover strategy (one of [BINOMIAL, EXPONENTIAL])

PyGMO.algorithm.sga.mutation.RANDOM

Random mutation (width is set by the width argument in PyGMO.algorithm.sga)

PyGMO.algorithm.sga.mutation.GAUSSIAN

Gaussian mutation (bell shape standard deviation is set by the width argument in PyGMO.algorithm.sga multiplied by the box-bounds width)

PyGMO.algorithm.sga.selection.ROULETTE

Roulette selection mechanism

PyGMO.algorithm.sga.selection.BEST20

Best 20% individuals are inserted over and over again

PyGMO.algorithm.sga.crossover.BINOMIAL

Binomial crossover

PyGMO.algorithm.sga.crossover.EXPONENTIAL

Exponential crossover

class PyGMO.algorithm.nsga_II(gen=100, cr=0.95, eta_c=10, m=0.01, eta_m=10)

The NSGA-II algorithm

__init__(gen=100, cr=0.95, eta_c=10, m=0.01, eta_m=10)

Constructs a Non-dominated Sorting Genetic Algorithm (NSGA_II)

USAGE: algorithm.nsga__II(self, gen=100, cr = 0.95, eta_c = 10, m = 0.01, eta_m = 10)

  • gen: number of generations
  • cr: crossover factor [0,1[
  • eta_c: Distribution index for crossover
  • m: mutation probability [0,1]
  • eta_m: Distribution index for mutation
class PyGMO.algorithm.sa_corana(iter=10000, Ts=10, Tf=0.1, steps=1, bin_size=20, range=1)

Simulated annealing, Corana’s version with adaptive neighbourhood.

__init__(iter=10000, Ts=10, Tf=0.1, steps=1, bin_size=20, range=1)

Constructs Corana’s Simulated Annealing

USAGE: algorithm.sa_corana(iter = 10000, Ts = 10, Tf = .1, steps = 1, bin_size = 20, range = 1)

NOTE: as this version of simulated annealing loops through the chromosome, the iter number needs to be selected large enough to allow the temperature schedule to actuallt make sense. For example if your problem has D dimensions then in order to have at least N temperature adjustments (from Ts to Tf) one should select iter = D * N * steps * bin_size.

  • iter: number of total iterations
  • Ts: starting temperature
  • Tf: final temperature ( > Ts)
  • steps: number of steps adjustments
  • bin_size: size of the bin used to evaluate the step adjustment
  • range: initial size of the neighbourhood (in [0,1])
class PyGMO.algorithm.bee_colony(gen=100, limit=20)

Artificial Bee Colony optimization (ABC) algorithm.

__init__(gen=100, limit=20)

Constructs an Artificial Bee Colony Algorithm

USAGE: algorithm.bee_colony(gen = 100, limit = 20)

  • gen: number of ‘generations’ (each generation 2*NP function evaluations

    are made where NP is the population size)

  • limit: number of tries after which a source of food is dropped if not improved

class PyGMO.algorithm.ms(algorithm=Algorithm name: Differential Evolution - gen:100 F: 0.8 CR: 0.9 variant:2 ftol:1e-06 xtol:1e-06, iter=1)

Multistart.

__init__(algorithm=Algorithm name: Differential Evolution - gen:100 F: 0.8 CR: 0.9 variant:2 ftol:1e-06 xtol:1e-06, iter=1)

Constructs a Multistart Algorithm

USAGE: algorithm.ms(algorithm = algorithm.de(), iter = 1)

NOTE: starting from pop1, at each iteration a random pop2 is evolved with the selected algorithm and its final best replaces the worst of pop1

  • algorithm: PyGMO algorithm to be multistarted
  • iter: number of multistarts
PyGMO.algorithm.ms.screen_output

When True, the algorithms produces output on screen

PyGMO.algorithm.ms.algorithm

Algorithm to be multistarted

class PyGMO.algorithm.mbh(algorithm=Algorithm name: Compass Search - max_eval:1 stop_range:0.01 start_range:0.1 reduction_coeff:0.5, stop=5, perturb=0.05, screen_output=False)

Monotonic Basin Hopping.

__init__(algorithm=Algorithm name: Compass Search - max_eval:1 stop_range:0.01 start_range:0.1 reduction_coeff:0.5, stop=5, perturb=0.05, screen_output=False)

Constructs a Monotonic Basin Hopping Algorithm (generalized to accept any algorithm)

USAGE: algorithm.mbh(algorithm = algorithm.cs(), stop = 5, perturb = 5e-2);

NOTE: Starting from pop, algorithm is applied to the perturbed pop returning pop2. If pop2 is better than pop then pop=pop2 and a counter is reset to zero. If pop2 is not better the counter is incremented. If the counter is larger than stop, optimization is terminated

  • algorithm: ‘local’ optimiser

  • stop: number of no improvements before halting the optimization

  • perturb: non-dimentional perturbation width (can be a list, in which case

    it has to have the same dimension of the problem mbh will be applied to)

  • screen_output: activates screen output of the algorithm (do not use in archipealgo, otherwise the screen will be flooded with

  • different island outputs)

PyGMO.algorithm.mbh.screen_output

When True, the algorithms produces output on screen

PyGMO.algorithm.mbh.algorithm

Algorithm to perform mbh ‘local’ search

class PyGMO.algorithm.cs(max_eval=1, stop_range=0.01, start_range=0.1, reduction_coeff=0.5)

Compass search solver.

__init__(max_eval=1, stop_range=0.01, start_range=0.1, reduction_coeff=0.5)

Constructs a Compass Search Algorithm

USAGE: algorithm.cs(max_eval = 1, stop_range = 0.01, start_range = 0.1, reduction_coeff = 0.5);

  • max_eval: maximum number of function evaluations

  • stop_range: when the range is reduced to a value smaller than stop_range cs stops

  • start_range: starting range (non-dimensional wrt ub-lb)

  • reduction_coeff: the range is multiplied by reduction_coeff whenever no improvment is made

    across one chromosome

class PyGMO.algorithm.ihs(iter=100, hmcr=0.85, par_min=0.35, par_max=0.99, bw_min=1e-05, bw_max=1)

Improved harmony search.

__init__(iter=100, hmcr=0.85, par_min=0.35, par_max=0.99, bw_min=1e-05, bw_max=1)

Constructs an Improved Harmony Search Algorithm

USAGE: algorithm.ihs(iter = 100, hmcr = 0.85, par_min = 0.35, par_max = 0.99, bw_min = 1E-5, bw_max = 1);

  • iter: number of iterations (improvisations)
  • hmcr: rate of choosing from memory (in ]0,1[)
  • par_min: minimum pitch adjustment rate (in ]0,1[)
  • par_max: maximum pitch adjustment rate (in ]0,1[, > par_min)
  • bw_min: minimum distance bandwidth
  • bw_max: maximum distance bandwidth (> bw_min)
class PyGMO.algorithm.monte_carlo(iter=10000)

Monte-Carlo search.

__init__(iter=10000)

Constructs a Monte Carlo Algorithm

USAGE: algorithm.monte_carlo(iter = 10000)

NOTE: At the end of each iteration, the randomly generated
point substitutes the worst in the population if better
  • iter: number of Monte Carlo runs
class PyGMO.algorithm.py_example(iter=10)

Monte-Carlo (random sampling) algorithm implemented purely in Python.

__init__(iter=10)

Constructs a Monte-Carlo (random sampling) algorithm

USAGE: algorithm.py_example(iter = 10)

NOTE: At the end of each iteration, the randomly generated
point substitutes the worst individual in the population if better
  • iter: number of random samples
class PyGMO.algorithm.py_cmaes(gen=500, cc=-1, cs=-1, c1=-1, cmu=-1, sigma0=0.5, ftol=1e-06, xtol=1e-06, memory=False, screen_output=False)

Covariance Matrix Adaptation Evolutionary Strategy (Python)

__init__(gen=500, cc=-1, cs=-1, c1=-1, cmu=-1, sigma0=0.5, ftol=1e-06, xtol=1e-06, memory=False, screen_output=False)

Constructs a Covariance Matrix Adaptation Evolutionary Strategy (Python)

USAGE: algorithm.py_cmaes(gen = 500, cc = -1, cs = -1, c1 = -1, cmu = -1, sigma0=0.5, ftol = 1e-6, xtol = 1e-6, memory = False, screen_output = False)

NOTE: In our variant of the algorithm, particle memory is used to extract the elite and reinsertion is made aggressively ..... getting rid of the worst guy). Also, the bounds of the problem are enforced, as to allow PaGMO machinery to work. Fine control on each iteration can be achieved by calling the algo with gen=1 (algo state is stored, cmaes will continue at next call ... without initializing again all its state!!)

  • gen: number of generations
  • cc: time constant for C cumulation (in [0,1]) if -1 automatic values are set
  • cs: time constant for sigma cumulation (in [0,1]) if -1 automatic values are set
  • c1: learning rate for rank-1 update (in [0,1]) if -1 automatic values are set
  • cmu: learning rate for rank-mu update (in [0,1]) if -1 automatic values are set
  • sigma0: starting step (std)
  • xtol: stopping criteria on the x tolerance
  • ftol: stopping criteria on the f tolerance
  • memory: when True the algorithm preserves memory of covariance, step and more between successive runs
  • screen_output: activates screen_output (output at each generation)
class PyGMO.algorithm.cmaes(gen=500, cc=-1, cs=-1, c1=-1, cmu=-1, sigma0=0.5, ftol=1e-06, xtol=1e-06, memory=False, screen_output=False)

Covariance Matrix Adaptation Evolutionary Startegy

__init__(gen=500, cc=-1, cs=-1, c1=-1, cmu=-1, sigma0=0.5, ftol=1e-06, xtol=1e-06, memory=False, screen_output=False)

Constructs a Covariance Matrix Adaptation Evolutionary Strategy (C++)

USAGE: algorithm.cmaes(gen = 500, cc = -1, cs = -1, c1 = -1, cmu = -1, sigma0=0.5, ftol = 1e-6, xtol = 1e-6, memory = False, screen_output = False)

NOTE: In our variant of the algorithm, particle memory is used to extract the elite and reinsertion is made aggressively ..... getting rid of the worst guy). Also, the bounds of the problem are enforced, as to allow PaGMO machinery to work. Fine control on each iteration can be achieved by calling the algo with memory=True and gen=1

  • gen: number of generations
  • cc: time constant for C cumulation (in [0,1]) if -1 automatic values are set
  • cs: time constant for sigma cumulation (in [0,1]) if -1 automatic values are set
  • c1: learning rate for rank-1 update (in [0,1]) if -1 automatic values are set
  • cmu: learning rate for rank-mu update (in [0,1]) if -1 automatic values are set
  • sigma0: starting step (std)
  • xtol: stopping criteria on the x tolerance
  • ftol: stopping criteria on the f tolerance
  • memory: if True the algorithm internal state is saved and used for the next call
  • screen_output: activates screen output of the algorithm (do not use in archipealgo, otherwise the screen will be flooded with
  • different island outputs)
class PyGMO.algorithm.scipy_fmin(maxiter=1, xtol=0.0001, ftol=0.0001, maxfun=None, full_output=0, disp=0, retall=0)

Wrapper around SciPy’s fmin optimiser (Uses a Nelder-Mead simplex algorithm to find the minimum of function of one or more variables.)

__init__(maxiter=1, xtol=0.0001, ftol=0.0001, maxfun=None, full_output=0, disp=0, retall=0)

Constructs a Nelder-Mead Simplex algorithm (SciPy)

USAGE: algorithm.scipy_fmin(maxiter=1, xtol=0.0001, ftol=0.0001, maxfun=None, full_output=0, disp=0, retall=0)

  • maxiter: Maximum number of iterations to perform
  • xtol: Relative error in xopt acceptable for convergence
  • ftol: Relative error in func(xopt) acceptable for convergence
  • maxfun: Maximum number of function evaluations to make
  • full_output: Set to True if fval and warnflag outputs are desired
  • disp: Set to True to print convergence messages
  • retall: Set to True to return list of solutions at each iteration
class PyGMO.algorithm.scipy_l_bfgs_b(maxfun=1, m=10, factr=10000000.0, pgtol=1e-05, epsilon=1e-08, screen_output=False)

Wrapper around SciPy’s fmin_l_bfgs_b optimiser (uses L-BFGS-B algorithm)

__init__(maxfun=1, m=10, factr=10000000.0, pgtol=1e-05, epsilon=1e-08, screen_output=False)

Constructs a L-BFGS-B algorithm (SciPy)

NOTE: gradient is numerically approximated

USAGE: algorithm.scipy_l_bfgs_b(maxfun = 15000, m = 10, factr = 10000000.0, pgtol = 1e-05, epsilon = 1e-08, screen_output = False):

  • maxfun: maximum number of function evaluations

  • m: the maximum number of variable metric corrections

    used to define the limited memory matrix. (the limited memory BFGS method does not store the full hessian but uses this many terms in an approximation to it).

  • factr: The iteration stops when

    (f_k - f_{k+1})/max{|f_k|,|f_{k+1}|,1} <= factr*epsmch where epsmch is the machine precision, which is automatically generated by the code. Typical values for factr: 1e12 for low accuracy; 1e7 for moderate accuracy; 10.0 for extremely high accuracy.

  • pgtol: The iteration will stop when

    max{|proj g_i | i = 1, ..., n} <= pgtol where pg_i is the ith component of the projected gradient.

  • epsilon: step size used when approx_grad is true, for numerically

    calculating the gradient

  • screen_output: Set to True to print iterations

class PyGMO.algorithm.scipy_slsqp(max_iter=100, acc=1e-08, epsilon=1.4901161193847656e-08, screen_output=False)

Wrapper around SciPy’s slsqp optimiser.

__init__(max_iter=100, acc=1e-08, epsilon=1.4901161193847656e-08, screen_output=False)

Constructs a Sequential Least SQuares Programming algorithm

NOTE: gradient is numerically approximated

USAGE: algorithm.scipy_slsqp(max_iter = 100,acc = 1E-6,epsilon = 1.49e-08, screen_output = False))

  • max_iter: The maximum number of iterations.
  • acc: Requested accuracy.
  • epsilon: The step size for finite-difference derivative estimates.
  • screen_output: Set to True to print iterations
class PyGMO.algorithm.scipy_tnc(maxfun=15000, xtol=-1, ftol=-1, pgtol=1e-05, epsilon=1e-08, screen_output=False)

Wrapper around SciPy’s tnc optimiser.

__init__(maxfun=15000, xtol=-1, ftol=-1, pgtol=1e-05, epsilon=1e-08, screen_output=False)

Constructs a Truncated Newton Method algorithm (SciPy)

NOTE: gradient is numerically approximated

USAGE: algorithm.scipy_tnc(maxfun = 1, xtol = -1, ftol = -1, pgtol = 1e-05, epsilon = 1e-08, screen_output = False)

  • maxfun: Maximum number of function evaluation.

  • xtol: Precision goal for the value of x in the stopping criterion

    (after applying x scaling factors). If xtol < 0.0, xtol is set to sqrt(machine_precision). Defaults to -1.

  • ftol: Precision goal for the value of f in the stoping criterion.

    If ftol < 0.0, ftol is set to 0.0 defaults to -1.

  • pgtol: Precision goal for the value of the projected gradient in the

    stopping criterion (after applying x scaling factors). If pgtol < 0.0, pgtol is set to 1e-2 * sqrt(accuracy). Setting it to 0.0 is not recommended. Defaults to -1.

  • epsilon: The stepsize in a finite difference approximation for the objfun

  • screen_output: Set to True to print iterations

PyGMO.algorithm.scipy_tnc.screen_output

When True, the algorithms produces output on screen

class PyGMO.algorithm.scipy_cobyla(max_fun=1, rho_end=1e-05, screen_output=False)

Wrapper around SciPy’s cobyla optimiser.

__init__(max_fun=1, rho_end=1e-05, screen_output=False)

Constructs a Constrained Optimization BY Linear Approximation (COBYLA) algorithm (SciPy)

NOTE: equality constraints are transformed into two inequality constraints automatically

USAGE: algorithm.scipy_cobyla(max_fun = 1,rho_end = 1E-5,screen_output = False)

  • maxfun: Maximum number of function evaluations.
  • rhoend: Final accuracy in the optimization (not precisely guaranteed). This is a lower bound on the size of the trust region.
  • screen_output: Set to True to print iterations
PyGMO.algorithm.scipy_cobyla.screen_output

When True, the algorithms produces output on screen

class PyGMO.algorithm.nlopt_cobyla(max_iter=100, ftol=1e-06, xtol=1e-06)

NLopt’s COBYLA algorithm.

__init__(max_iter=100, ftol=1e-06, xtol=1e-06)

Constructs a Constrained Optimization BY Linear Approximation (COBYLA) algorithm (NLOPT)

USAGE: algorithm.nlopt_cobyla(max_iter = 100, ftol = 1e-6, xtol = 1e-6)

  • max_iter: stop-criteria (number of iterations)
  • ftol: stop-criteria (absolute on the obj-fun)
  • xtol: stop-criteria (absolute on the chromosome)
class PyGMO.algorithm.nlopt_bobyqa(max_iter=100, ftol=1e-06, xtol=1e-06)

NLopt’s BOBYQA algorithm.

__init__(max_iter=100, ftol=1e-06, xtol=1e-06)

Constructs a BOBYQA algorithm (Bound Optimization BY Quadratic Approximation) (NLOPT)

USAGE: algorithm.nlopt_bobyqa(max_iter = 100, ftol = 1e-6, xtol = 1e-6)

  • max_iter: stop-criteria (number of iterations)
  • ftol: stop-criteria (absolute on the obj-fun)
  • xtol: stop-criteria (absolute on the chromosome)
class PyGMO.algorithm.nlopt_sbplx(max_iter=100, ftol=1e-06, xtol=1e-06)

NLopt’s Sbplx algorithm.

__init__(max_iter=100, ftol=1e-06, xtol=1e-06)

Constructs a Subplex (a variant of Nelder-Mead that uses Nelder-Mead on a sequence of subspaces) (NLOPT)

USAGE: algorithm.nlopt_sbplx(max_iter = 100, ftol = 1e-6, xtol = 1e-6)

  • max_iter: stop-criteria (number of iterations)
  • ftol: stop-criteria (absolute on the obj-fun)
  • xtol: stop-criteria (absolute on the chromosome)
class PyGMO.algorithm.nlopt_mma(max_iter=100, ftol=1e-06, xtol=1e-06)

NLopt’s MMA algorithm.

__init__(max_iter=100, ftol=1e-06, xtol=1e-06)

Constructs a Method of Moving Asymptotes (MMA) algorithm (NLOPT)

USAGE: algorithm.nlopt_mma(max_iter = 100, ftol = 1e-6, xtol = 1e-6)

  • max_iter: stop-criteria (number of iterations)
  • ftol: stop-criteria (absolute on the obj-fun)
  • xtol: stop-criteria (absolute on the chromosome)
class PyGMO.algorithm.nlopt_auglag(aux_algo_id=1, max_iter=100, ftol=1e-06, xtol=1e-06, aux_max_iter=100, aux_ftol=1e-06, aux_xtol=1e-06)

NLopt’s Augmented agrangian algorithm.

__init__(aux_algo_id=1, max_iter=100, ftol=1e-06, xtol=1e-06, aux_max_iter=100, aux_ftol=1e-06, aux_xtol=1e-06)

Constructs an Augmented agrangian Algotihm (NLOPT)

USAGE: algorithm.nlopt_mma(aux_algo_id = 1, max_iter = 100, ftol = 1e-6, xtol = 1e-6, aux_max_iter = 100, aux_ftol = 1e-6, aux_xtol = 1e-6)

  • aux_algo_id: auxiliary optimizer id

    1: SBPLX 2: COBYLA 3: BOBYQA 4: Low Storage BFGS

  • max_iter: stop-criteria (number of iterations)

  • ftol: stop-criteria (absolute on the obj-fun)

  • xtol: stop-criteria (absolute on the chromosome)

  • aux_max_iter: stop-criteria for the auxiliary optimizer (number of iterations)

  • aux_ftol: stop-criteria for the auxiliary optimizer (absolute on the obj-fun)

  • aux_xtol: stop-criteria for the auxiliary optimizer (absolute on the chromosome)

class PyGMO.algorithm.nlopt_auglag_eq(aux_algo_id=1, max_iter=100, ftol=1e-06, xtol=1e-06, aux_max_iter=100, aux_ftol=1e-06, aux_xtol=1e-06)

NLopt’s Augmented agrangian algorithm (using penalties only for the equalities).

__init__(aux_algo_id=1, max_iter=100, ftol=1e-06, xtol=1e-06, aux_max_iter=100, aux_ftol=1e-06, aux_xtol=1e-06)

Constructs an Augmented agrangian Algotihm (using penalties only for the equalities) (NLOPT)

USAGE: algorithm.nlopt_auglag_eq(aux_algo_id = 1, max_iter = 100, ftol = 1e-6, xtol = 1e-6, aux_max_iter = 100, aux_ftol = 1e-6, aux_xtol = 1e-6)

  • aux_algo_id: auxiliary (local) optimizer id

    1: COBYLA 2: MMA

  • max_iter: stop-criteria (number of iterations)

  • ftol: stop-criteria (absolute on the obj-fun)

  • xtol: stop-criteria (absolute on the chromosome)

  • aux_max_iter: stop-criteria for the auxiliary optimizer (number of iterations)

  • aux_ftol: stop-criteria for the auxiliary optimizer (absolute on the obj-fun)

  • aux_xtol: stop-criteria for the auxiliary optimizer (absolute on the chromosome)

class PyGMO.algorithm.nlopt_slsqp(max_iter=100, ftol=1e-06, xtol=1e-06)

NLopt’s SLSQP algorithm.

__init__(max_iter=100, ftol=1e-06, xtol=1e-06)

Constructs a Sequential Least SQuares Programming algorithm (SLSQP) algorithm (NLOPT)

USAGE: algorithm.nlopt_slsqp(max_iter = 100, ftol = 1e-6, xtol = 1e-6)

  • max_iter: stop-criteria (number of iterations)
  • ftol: stop-criteria (absolute on the obj-fun)
  • xtol: stop-criteria (absolute on the chromosome)
class PyGMO.algorithm.gsl_nm2rand(max_iter=100, step_size=1e-08, tol=1e-08)

GSL Nelder-Mead simplex method, version 2 with randomised initial simplex.

__init__(max_iter=100, step_size=1e-08, tol=1e-08)

Constructs a Nelder-Mead algorithm (Variant2 + randomly oriented initial simplex) (GSL)

USAGE: algorithm.gsl_nm2rand(max_iter = 100, step_size = 1e-8, tol = 1e-8);

  • max_iter: maximum number of iterations
  • step_size: size of the first trial step.
  • tol: accuracy of the line minimisation.
class PyGMO.algorithm.gsl_nm2(max_iter=100, step_size=1e-08, tol=1e-08)

GSL Nelder-Mead simplex method, version 2.

__init__(max_iter=100, step_size=1e-08, tol=1e-08)

Constructs a Nelder-Mead algorithm (Variant2) (GSL)

USAGE: algorithm.gsl_nm2(max_iter = 100, step_size = 1e-8, tol = 1e-8)

  • max_iter: maximum number of iterations
  • step_size: size of the first trial step.
  • tol: accuracy of the line minimisation.
class PyGMO.algorithm.gsl_nm(max_iter=100, step_size=1e-08, tol=1e-08)

GSL Nelder-Mead simplex method.

__init__(max_iter=100, step_size=1e-08, tol=1e-08)

Constructs a Nelder-Mead Algorithm (GSL)

USAGE: algorithm.gsl_nm(max_iter = 100, step_size = 1e-8, tol = 1e-8);

  • max_iter: maximum number of iterations
  • step_size: size of the first trial step.
  • tol: accuracy of the line minimisation.
class PyGMO.algorithm.gsl_pr(max_iter=100, step_size=1e-08, tol=1e-08, grad_step_size=0.01, grad_tol=0.0001)

GSL Polak-Ribiere algorithm.

__init__(max_iter=100, step_size=1e-08, tol=1e-08, grad_step_size=0.01, grad_tol=0.0001)

Constructs a Polak-Ribiere conjugate gradient (GSL)

USAGE: algorithm.gsl_pr2(max_iter = 100, step_size = 1e-8, tol = 1e-8, grad_step_size = 0.01, grad_tol = 0.0001);

  • max_iter: maximum number of iterations
  • step_size: size of the first trial step.
  • tol: accuracy of the line minimisation.
  • grad_step_size: step size for the numerical computation of the gradient.
  • grad_tol: tolerance when testing the norm of the gradient as stopping criterion.
class PyGMO.algorithm.gsl_fr(max_iter=100, step_size=1e-08, tol=1e-08, grad_step_size=0.01, grad_tol=0.0001)

GSL Fletcher-Reeves algorithm.

__init__(max_iter=100, step_size=1e-08, tol=1e-08, grad_step_size=0.01, grad_tol=0.0001)

Constructs a Fletcher-Reeves conjugate gradient (GSL)

USAGE: algorithm.gsl_fr(max_iter = 100, step_size = 1e-8, tol = 1e-8, grad_step_size = 0.01, grad_tol = 0.0001)

  • max_iter: maximum number of iterations
  • step_size: size of the first trial step.
  • tol: accuracy of the line minimisation.
  • grad_step_size: step size for the numerical computation of the gradient.
  • grad_tol: tolerance when testing the norm of the gradient as stopping criterion.
class PyGMO.algorithm.gsl_bfgs2(max_iter=100, step_size=1e-08, tol=1e-08, grad_step_size=0.01, grad_tol=0.0001)

GSL BFGS2 algorithm.

__init__(max_iter=100, step_size=1e-08, tol=1e-08, grad_step_size=0.01, grad_tol=0.0001)

Constructs a BFGS2 Algorithm (GSL)

NOTE: in GSL, BFGS2 is a more efficient version of BFGS

USAGE: algorithm.gsl_bfgs2(max_iter = 100, step_size = 1e-8, tol = 1e-8, grad_step_size = 0.01, grad_tol = 0.0001);

  • max_iter: maximum number of iterations
  • step_size: size of the first trial step.
  • tol: accuracy of the line minimisation.
  • grad_step_size: step size for the numerical computation of the gradient.
  • grad_tol: tolerance when testing the norm of the gradient as stopping criterion.
class PyGMO.algorithm.gsl_bfgs(max_iter=100, step_size=1e-08, tol=1e-08, grad_step_size=0.01, grad_tol=0.0001)

GSL BFGS algorithm.

__init__(max_iter=100, step_size=1e-08, tol=1e-08, grad_step_size=0.01, grad_tol=0.0001)

Constructs a BFGS Algorithm (GSL)

USAGE: algorithm.gsl_bfgs(max_iter = 100, step_size = 1e-8, tol = 1e-8, grad_step_size = 0.01, grad_tol = 0.0001)

  • max_iter: maximum number of iterations
  • step_size: size of the first trial step.
  • tol: accuracy of the line minimisation.
  • grad_step_size: step size for the numerical computation of the gradient.
  • grad_tol: tolerance when testing the norm of the gradient as stopping criterion.
class PyGMO.algorithm.snopt(major_iter=100, feas_tol=1e-06, opt_tol=1e-06, screen_output=False)

Snopt solver.

__init__(major_iter=100, feas_tol=1e-06, opt_tol=1e-06, screen_output=False)

Constructs SNOPT Algorithm

USAGE: algorithm.snopt(major_iter = 100, feas_tol = 1e-6, opt_tol = 1e-6, screen_output = False);

  • major_iter: Maximum number of major iterations
  • feas_tol: Feasibility tolerance
  • opt_tol: Optimality tolerance
  • screen_output: Activates output on screen
PyGMO.algorithm.snopt.screen_output

When True, the algorithms produces output on screen

class PyGMO.algorithm.ipopt(max_iter=100, constr_viol_tol=1e-08, dual_inf_tol=1e-08, compl_inf_tol=1e-08, nlp_scaling_method=True, obj_scaling_factor=1.0, mu_init=0.1, screen_output=False)

Ipopt solver.

__init__(max_iter=100, constr_viol_tol=1e-08, dual_inf_tol=1e-08, compl_inf_tol=1e-08, nlp_scaling_method=True, obj_scaling_factor=1.0, mu_init=0.1, screen_output=False)

Constructs an Interior Point OPTimization Algorithm (IPOPT)

USAGE: algorithm.ipopt(major_iter = 100, constr_viol_tol = 1e-08, dual_inf_tol = 1e-08, compl_inf_tol = 1e-08, screen_output = False);

  • max_iter: Maximum number of major iterations
  • constr_viol_tol: Constraint violation tolerance
  • dual_inf_tol: Dual infeasibility tolerance
  • compl_inf_tol: Complementary feasibility tolerance
  • nlp_scaling_method Select if the “gradient-based” scaling of the NLP should be used
  • obj_scaling_factor Scaling factor for the objective function.
  • mu_init Initial value for the barrier parameter.
  • screen_output: Activates output on screen
PyGMO.algorithm.ipopt.screen_output

When True, the algorithms produces output on screen