# mystic.models module documentation

## abstract_model module

Base classes for mystic’s provided models::

  AbstractFunction – evaluates f(x) for given evaluation points x AbstractModel – generates f(x,p) for given coefficients p

class AbstractFunction(ndim=None)

  Bases: `object`

  Base class for mystic functions

  The ‘function’ method must be overwritten, thus allowing calls to the class instance to mimic calls to the function object.

  For example, if function is overwritten with the Rosenbrock function:

        >>> rosen = Rosenbrock(ndim=3)
        >>> rosen([1,1,1])
        0.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __call__(*args, **kwds)

    Call self as a function.

  __firstlineno__ = 20
  __static_attributes__ = ('minima', 'minimizer', 'minimizers', 'minimum', 'ndim')
  function(coeffs)

    takes a list of coefficients x, returns f(x)

  minimizers = None

class AbstractModel(name='dummy', metric=<function AbstractModel.<lambda>>, sigma=1.0)

  Bases: `object`

  Base class for mystic models

  The ‘evaluate’ and ‘ForwardFactory’ methods must be overwritten, thus providing a standard interface for generating a forward model factory and evaluating a forward model. Additionally, two common ways to generate a cost function are built into the model. For “standard models”, the cost function generator will work with no modifications.

  See mystic.models.poly for a few basic examples.

  Provides a base class for mystic models.

  Inputs::

    name – a name string for the model metric – the cost metric object [default => lambda x: numpy.sum(x*x)] sigma – a scaling factor applied to the raw cost

  CostFactory(target, pts)

    generates a cost function instance from list of coefficients and evaluation points

  CostFactory2(pts, datapts, nparams)

    generates a cost function instance from datapoints and evaluation points

  ForwardFactory(coeffs)

    generates a forward model instance from a list of coefficients

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 97
  __static_attributes__ = ('__cost__', '__forward__', '__metric__', '__name__', '__sigma__')
  evaluate(coeffs, x)

    takes list of coefficients & evaluation points, returns f(x)

## br8 module

Bevington & Robinson’s model of dual exponential decay

References

1. “Data Reduction and Error Analysis for the Physical Sciences”, Bevington & Robinson, Second Edition, McGraw-Hill, New York (1992).

class BevingtonDecay(name='decay', metric=<function BevingtonDecay.<lambda>>)

  Bases: `AbstractModel`

  Computes dual exponential decay [1]. y = a1 + a2 Exp[-t / a4] + a3 Exp[-t/a5]

  Provides a base class for mystic models.

  Inputs::

    name – a name string for the model metric – the cost metric object [default => lambda x: numpy.sum(x*x)] sigma – a scaling factor applied to the raw cost

  CostFactory(target, pts)

    generates a cost function instance from list of coefficients & evaluation points

  CostFactory2(pts, datapts, nparams)

    generates a cost function instance from datapoints & evaluation points

  ForwardFactory(coeffs)

    generates a dual decay model instance from a list of coefficients

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 25
  __static_attributes__ = ('__cost__',)
  evaluate(coeffs, evalpts)

    evaluate dual exponential decay with given coeffs over given evalpts coeffs = (a1,a2,a3,a4,a5)

cost(params)

## circle module

2d array representation of a circle

References

None

class Circle(packing=None, name='circle', sigma=1.0)

  Bases: `AbstractModel`

  Computes 2D array representation of a circle where the circle minimally bounds the 2D data points

  data points with [minimal, sparse, or dense] packing=[~0.2, ~1.0, or ~5.0] setting packing = None will constrain all points to the circle’s radius

  Provides a base class for mystic models.

  Inputs::

    name – a name string for the model metric – the cost metric object [default => lambda x: numpy.sum(x*x)] sigma – a scaling factor applied to the raw cost

  CostFactory(target, npts=None)

    generate a cost function from target coefficients

    Parameters:

      - target (list[float]) – (x, y, and radius) defining the target circle

      - npts (int, default=None) – number of points to generate

    Returns:

      a function returning cost of minimum enclosing circle for npts

    Notes

    default `npts` is `packing * floor(pi * radius**2)`

  CostFactory2(datapts)

    generate a cost function from a 2D array of data points

    Parameters:

      datapts (array[float,float]) – (x,y) location of points in target circle

    Returns:

      a function returning cost of minimum enclosing circle for datapts

  ForwardFactory(coeffs)

    generate a circle instance from a sequence of coefficients

    Parameters:

      coeffs (list[float]) – (x, y, and radius) defining a circle

    Returns:

      a function returning a 2D array of points contained within the circle

  __annotate_func__ = None
  __annotations_cache__ = {}
  __call__(x, y, r, *args, **kwds)

    Call self as a function.

  __firstlineno__ = 28
  __static_attributes__ = ('__cost__', '__packing__')
  forward(coeffs, npts=None)

    generate a 2D array of points contained within a circle

    Parameters:

      - coeffs (list[float]) – (x, y, and radius) defining a circle

      - npts (int, default=None) – number of points to generate

    Returns:

      a 2D array of points contained within the defined circle

    Notes

    default `npts` is `packing * floor(pi * radius**2)`

gencircle(coeffs, interval=0.02)

  generate a 2D array representation of a circle of given coeffs coeffs = (x,y,r)

gendata(coeffs, npts=20)

  Generate a 2D dataset of npts enclosed in circle of given coeffs, where coeffs = (x,y,r).

  NOTE: if npts == None, constrain all points to circle of given radius

## dejong module

This is part of Storn’s “Differential Evolution” test suite, as defined in [2], with ‘De Jong’ function definitions drawn from [3].

References

1. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” Journal of Global Optimization 11: 341-359, 1997.

2. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” TR-95-012, ICSI, 1995. http://www.icsi.berkeley.edu/~storn/TR-95-012.pdf

3. Ingber, L. and Rosen, B. “Genetic Algorithms and Very Fast Simulated Reannealing: A Comparison” J. of Mathematical and Computer Modeling 16(11), 87-100, 1992.

class Quartic(ndim=30)

  Bases: `AbstractFunction`

  a De Jong quartic function generator

  De Jong’s quartic function [1,2,3] is designed to test the behavior of minimizers in the presence of noise. The function’s global minumum depends on the expectation value of a random variable, and also includes several randomly distributed local minima.

  The generated function f(x) is a modified version of equation (20) of [2], where len(x) >= 0.

  This is part of Storn’s “Differential Evolution” test suite, as defined in [2], with ‘De Jong’ function definitions drawn from [3].

  References

  1. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” Journal of Global Optimization 11: 341-359, 1997.

  2. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” TR-95-012, ICSI, 1995. http://www.icsi.berkeley.edu/~storn/TR-95-012.pdf

  3. Ingber, L. and Rosen, B. “Genetic Algorithms and Very Fast Simulated Reannealing: A Comparison” J. of Mathematical and Computer Modeling 16(11), 87-100, 1992.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 199
  __static_attributes__ = ()
  function(coeffs)

    evaluates an N-dimensional quartic function for a list of coeffs

    f(x) = sum_(i=0)^(N-1) (x_(i)^4 * (i+1) + k_i)

    Where k_i is a random variable with uniform distribution bounded by [0,1).

    Inspect with mystic_model_plotter using::

      mystic.models.quartic -b “-3:3:.1, -3:3:.1” -d -x 1

    The minimum is f(x)=N*E[k] for x_i=0.0, where E[k] is the expectation of k, and thus E[k]=0.5 for a uniform distribution bounded by [0,1).

  minimizers = None

class Rosenbrock(ndim=2, axis=None)

  Bases: `AbstractFunction`

  a Rosenbrock’s Saddle function generator

  Rosenbrock’s Saddle function [1,2,3] has the reputation of being a difficult minimization problem. In two dimensions, the function is a saddle with an inverted basin, where the global minimum occurs along the rim of the inverted basin.

  The generated function f(x) is a modified version of equation (18) of [2], where len(x) >= 0.

  This is part of Storn’s “Differential Evolution” test suite, as defined in [2], with ‘De Jong’ function definitions drawn from [3].

  References

  1. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” Journal of Global Optimization 11: 341-359, 1997.

  2. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” TR-95-012, ICSI, 1995. http://www.icsi.berkeley.edu/~storn/TR-95-012.pdf

  3. Ingber, L. and Rosen, B. “Genetic Algorithms and Very Fast Simulated Reannealing: A Comparison” J. of Mathematical and Computer Modeling 16(11), 87-100, 1992.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 72
  __static_attributes__ = ('axis',)
  derivative(coeffs)

    evaluates an N-dimensional Rosenbrock derivative for a list of coeffs

    The minimum is f’(x)=[0.0]*n at x=[1.0]*n, where len(x) >= 2.

  function(coeffs)

    evaluates an N-dimensional Rosenbrock saddle for a list of coeffs

    f(x) = sum_(i=0)^(N-2) 100*(x_(i+1) - x_(i)^(2))^(2) + (1 - x_(i))^(2)

    Inspect with mystic_model_plotter using::

      mystic.models.rosen -b “-3:3:.1, -1:5:.1, 1” -d -x 1

    The minimum is f(x)=0.0 at x_i=1.0 for all i

  hessian(coeffs)

    evaluates an N-dimensional Rosenbrock hessian for the given coeffs

    The function f’’(x) requires len(x) >= 2.

  hessian_product(coeffs, p)

    evaluates an N-dimensional Rosenbrock hessian product for p and the given coeffs

    The hessian product requires both p and coeffs to have len >= 2.

  minimizers = [1.0]

class Shekel(ndim=2)

  Bases: `AbstractFunction`

  a Shekel’s Foxholes function generator

  Shekel’s Foxholes function [1,2,3] has a generally flat surface with several narrow wells. The function’s global minimum is at (-32, -32), with local minima at (i,j) in (-32, -16, 0, 16, 32).

  The generated function f(x) is a modified version of equation (21) of [2], where len(x) == 2.

  This is part of Storn’s “Differential Evolution” test suite, as defined in [2], with ‘De Jong’ function definitions drawn from [3].

  References

  1. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” Journal of Global Optimization 11: 341-359, 1997.

  2. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” TR-95-012, ICSI, 1995. http://www.icsi.berkeley.edu/~storn/TR-95-012.pdf

  3. Ingber, L. and Rosen, B. “Genetic Algorithms and Very Fast Simulated Reannealing: A Comparison” J. of Mathematical and Computer Modeling 16(11), 87-100, 1992.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 237
  __static_attributes__ = ()
  function(coeffs)

    evaluates a 2-D Shekel’s Foxholes function for a list of coeffs

    f(x) = 1 / (0.002 + f_0(x))

    Where: f_0(x) = sum_(i=0)^(24) 1 / (i + sum_(j=0)^(1) (x_j - a_ij)^(6)) with a_ij=(-32,-16,0,16,32). for j=0 and i=(0,1,2,3,4), a_i0=a_k0 with k=i mod 5 also j=1 and i=(0,5,10,15,20), a_i1=a_k1 with k=i+k’ and k’=(1,2,3,4).

    Inspect with mystic_model_plotter using::

      mystic.models.shekel -b “-50:50:1, -50:50:1” -d -x 1

    The minimum is f(x)=0 for x=(-32,-32)

  minimizers = [(-32, -32), (-16, -32), (0, -32), (16, -32), (32, -32), (-32, -16), (-16, -16), (0, -16), (16, -16), (32, -16), (-32, 0), (-16, 0), (0, 0), (16, 0), (32, 0), (-32, 16), (-16, 16), (0, 16), (16, 16), (32, 16), (-32, 32), (-16, 32), (0, 32), (16, 32), (32, 32)]

class Sphere(ndim=3)

  Bases: `AbstractFunction`

  a De Jong spherical function generator

  De Jong’s spherical function [1,2,3] is considered to be a simple task for every serious minimization method. The minimum is located at the center of the N-dimensional spehere. There are no local minima.

  The generated function f(x) is identical to equation (17) of [2], where len(x) >= 0.

  This is part of Storn’s “Differential Evolution” test suite, as defined in [2], with ‘De Jong’ function definitions drawn from [3].

  References

  1. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” Journal of Global Optimization 11: 341-359, 1997.

  2. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” TR-95-012, ICSI, 1995. http://www.icsi.berkeley.edu/~storn/TR-95-012.pdf

  3. Ingber, L. and Rosen, B. “Genetic Algorithms and Very Fast Simulated Reannealing: A Comparison” J. of Mathematical and Computer Modeling 16(11), 87-100, 1992.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 38
  __static_attributes__ = ()
  function(coeffs)

    evaluates an N-dimensional spherical function for a list of coeffs

    f(x) = sum_(i=0)^(N-1) x_(i)^2

    Inspect with mystic_model_plotter using::

      mystic.models.sphere -b “-5:5:.1, -5:5:.1” -d

    The minimum is f(x)=0.0 at x_i=0.0 for all i

  minimizers = [0.0]

class Step(ndim=5)

  Bases: `AbstractFunction`

  a De Jong step function generator

  De Jong’s step function [1,2,3] has several plateaus, which pose difficulty for many optimization algorithms. Degenerate global minima occur for all x_i on the lowest plateau, with degenerate local minima on all other plateaus.

  The generated function f(x) is a modified version of equation (19) of [2], where len(x) >= 0.

  This is part of Storn’s “Differential Evolution” test suite, as defined in [2], with ‘De Jong’ function definitions drawn from [3].

  References

  1. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” Journal of Global Optimization 11: 341-359, 1997.

  2. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” TR-95-012, ICSI, 1995. http://www.icsi.berkeley.edu/~storn/TR-95-012.pdf

  3. Ingber, L. and Rosen, B. “Genetic Algorithms and Very Fast Simulated Reannealing: A Comparison” J. of Mathematical and Computer Modeling 16(11), 87-100, 1992.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 151
  __static_attributes__ = ()
  function(coeffs)

    evaluates an N-dimensional step function for a list of coeffs

    f(x) = f_0(x) + p_i(x), with i=0,1

    Where for abs(x_i) <= 5.12: f_0(x) = 30 + sum_(i=0)^(N-1) floor x_i and for x_i > 5.12: p_0(x) = 30 * (1 + (x_i - 5.12)) and for x_i < 5.12: p_1(x) = 30 * (1 + (5.12 - x_i)) Otherwise, f_0(x) = 0 and p_i(x)=0 for i=0,1.

    Inspect with mystic_model_plotter using::

      mystic.models.step -b “-10:10:.2, -10:10:.2” -d -x 1

    The minimum is f(x)=(30 - 6*N) for all x_i=[-5.12,-5)

  minimizers = None

quartic(coeffs)

  evaluates an N-dimensional quartic function for a list of coeffs

  f(x) = sum_(i=0)^(N-1) (x_(i)^4 * (i+1) + k_i)

  Where k_i is a random variable with uniform distribution bounded by [0,1).

  Inspect with mystic_model_plotter using::

    mystic.models.quartic -b “-3:3:.1, -3:3:.1” -d -x 1

  The minimum is f(x)=N*E[k] for x_i=0.0, where E[k] is the expectation of k, and thus E[k]=0.5 for a uniform distribution bounded by [0,1).

rosen(coeffs)

  evaluates an N-dimensional Rosenbrock saddle for a list of coeffs

  f(x) = sum_(i=0)^(N-2) 100*(x_(i+1) - x_(i)^(2))^(2) + (1 - x_(i))^(2)

  Inspect with mystic_model_plotter using::

    mystic.models.rosen -b “-3:3:.1, -1:5:.1, 1” -d -x 1

  The minimum is f(x)=0.0 at x_i=1.0 for all i

rosen0der(coeffs)

  evaluates an N-dimensional Rosenbrock saddle for a list of coeffs

  f(x) = sum_(i=0)^(N-2) 100*(x_(i+1) - x_(i)^(2))^(2) + (1 - x_(i))^(2)

  Inspect with mystic_model_plotter using::

    mystic.models.rosen -b “-3:3:.1, -1:5:.1, 1” -d -x 1

  The minimum is f(x)=0.0 at x_i=1.0 for all i

shekel(coeffs)

  evaluates a 2-D Shekel’s Foxholes function for a list of coeffs

  f(x) = 1 / (0.002 + f_0(x))

  Where: f_0(x) = sum_(i=0)^(24) 1 / (i + sum_(j=0)^(1) (x_j - a_ij)^(6)) with a_ij=(-32,-16,0,16,32). for j=0 and i=(0,1,2,3,4), a_i0=a_k0 with k=i mod 5 also j=1 and i=(0,5,10,15,20), a_i1=a_k1 with k=i+k’ and k’=(1,2,3,4).

  Inspect with mystic_model_plotter using::

    mystic.models.shekel -b “-50:50:1, -50:50:1” -d -x 1

  The minimum is f(x)=0 for x=(-32,-32)

sphere(coeffs)

  evaluates an N-dimensional spherical function for a list of coeffs

  f(x) = sum_(i=0)^(N-1) x_(i)^2

  Inspect with mystic_model_plotter using::

    mystic.models.sphere -b “-5:5:.1, -5:5:.1” -d

  The minimum is f(x)=0.0 at x_i=0.0 for all i

step(coeffs)

  evaluates an N-dimensional step function for a list of coeffs

  f(x) = f_0(x) + p_i(x), with i=0,1

  Where for abs(x_i) <= 5.12: f_0(x) = 30 + sum_(i=0)^(N-1) floor x_i and for x_i > 5.12: p_0(x) = 30 * (1 + (x_i - 5.12)) and for x_i < 5.12: p_1(x) = 30 * (1 + (5.12 - x_i)) Otherwise, f_0(x) = 0 and p_i(x)=0 for i=0,1.

  Inspect with mystic_model_plotter using::

    mystic.models.step -b “-10:10:.2, -10:10:.2” -d -x 1

  The minimum is f(x)=(30 - 6*N) for all x_i=[-5.12,-5)

## functions module

convert bound instances into functions

ackley(x)

  evaluates Ackley’s function for a list of coeffs

  f(x) = f_0(x) + f_1(x)

  Where: f_0(x) = -20 * exp(-0.2 * sqrt(1/N * sum_(i=0)^(N-1) x_(i)^(2))) and: f_1(x) = -exp(1/N * sum_(i=0)^(N-1) cos(2 * pi * x_(i))) + 20 + exp(1)

  Inspect with mystic_model_plotter using::

    mystic.models.ackley -b “-10:10:.1, -10:10:.1” -d

  The minimum is f(x)=0.0 at x_i=0.0 for all i

branins(x)

  evaluates Branins’s function for a list of coeffs

  f(x) = f_0(x) + f_1(x)

  Where: f_0(x) = a * (x_1 - b * x_(0)^(2) + c * x_0 - d)^2 and f_1(x) = e * (1 - f) * cos(x_0) + e and a=1, b=5.1/(4*pi^2), c=5/pi, d=6, e=10, f=1/(8*pi)

  Inspect with mystic_model_plotter using::

    mystic.models.branins -b “-10:20:.1, -5:25:.1” -d -x 1

  The minimum is f(x)=0.397887 at x=((2 +/- (2*i)+1)*pi, 2.275 + 10*i*(i+1)/2) for all i

corana(x)

  evaluates a 4-D Corana’s parabola function for a list of coeffs

  f(x) = sum_(i=0)^(3) f_0(x)

  Where for abs(x_i - z_i) < 0.05: f_0(x) = 0.15*(z_i - 0.05*sign(z_i))^(2) * d_i and otherwise: f_0(x) = d_i * x_(i)^(2), with z_i = floor(abs(x_i/0.2)+0.49999)*sign(x_i)*0.2 and d_i = 1,1000,10,100.

  For len(x) == 1, x = x_0,0,0,0; for len(x) == 2, x = x_0,0,x_1,0; for len(x) == 3, x = x_0,0,x_1,x_2; for len(x) >= 4, x = x_0,x_1,x_2,x_3.

  Inspect with mystic_model_plotter using::

    mystic.models.corana -b “-1:1:.01, -1:1:.01” -d -x 1

  The minimum is f(x)=0 for abs(x_i) < 0.05 for all i.

easom(x)

  evaluates Easom’s function for a list of coeffs

  f(x) = -cos(x_0) * cos(x_1) * exp(-((x_0-pi)^2+(x_1-pi)^2))

  Inspect with mystic_model_plotter using::

    mystic.models.easom -b “-5:10:.1, -5:10:.1” -d

  The minimum is f(x)=-1.0 at x=(pi,pi)

ellipsoid(x)

  evaluates the rotated hyper-ellipsoid function for a list of coeffs

  f(x) = sum_(i=0)^(N-1) (sum_(j=0)^(i) x_j)^2

  Inspect with mystic_model_plotter using::

    mystic.models.ellipsoid -b “-5:5:.1, -5:5:.1” -d

  The minimum is f(x)=0.0 at x_i=0.0 for all i

fosc3d(x)

  evaluates the fOsc3D function for a list of coeffs

  f(x) = f_0(x) + p(x)

  Where: f_0(x) = -4 * exp(-x_(0)^2 - x_(1)^2) + sin(6*x_(0)) * sin(5*x_(1)) with for x_1 < 0: p(x) = 100.*x_(1)^2 and otherwise: p(x) = 0.

  Inspect with mystic_model_plotter using::

    mystic.models.fosc3d -b “-5:5:.1, 0:5:.1” -d

  The minimum is f(x)=-4.501069742528923 at x=(-0.215018, 0.240356)

goldstein(x)

  evaluates Goldstein-Price’s function for a list of coeffs

  f(x) = (1 + (x_0 + x_1 + 1)^2 * f_0(x)) * (30 + (2*x_0 - 3*x_1)^2 * f_1(x))

  Where: f_0(x) = 19 - 14*x_0 + 3*x_(0)^2 - 14*x_1 + 6*x_(0)*x_(1) + 3*x_(1)^2 and f_1(x) = 18 - 32*x_0 + 12*x_(0)^2 + 48*x_1 - 36*x_(0)*x_(1) + 27*x_(1)^2

  Inspect with mystic_model_plotter using::

    mystic.models.goldstein -b “-5:5:.1, -5:5:.1” -d -x 1

  The minimum is f(x)=3.0 at x=(0,-1)

griewangk(x)

  evaluates an N-dimensional Griewangk’s function for a list of coeffs

  f(x) = f_0(x) - f_1(x) + 1

  Where: f_0(x) = sum_(i=0)^(N-1) x_(i)^(2) / 4000. and: f_1(x) = prod_(i=0)^(N-1) cos( x_i / (i+1)^(1/2) )

  Inspect with mystic_model_plotter using::

    mystic.models.griewangk -b “-10:10:.1, -10:10:.1” -d -x 5

  The minimum is f(x)=0.0 for x_i=0.0

michal(x)

  evaluates Michalewicz’s function for a list of coeffs

  f(x) = -sum_(i=0)^(N-1) sin(x_i) * (sin((i+1) * (x_i)^(2) / pi))^(20)

  Inspect with mystic_model_plotter using::

    mystic.models.michal -b “0:3.14:.1, 0:3.14:.1, 1.28500168, 1.92305311, 1.72047194” -d

  For x=(2.20289811, 1.57078059, 1.28500168, 1.92305311, 1.72047194, …)[:N] and c=(-0.801303, -1.0, -0.959092, -0.896699, -1.030564, …)[:N], the minimum is f(x)=sum(c) for all x_i=(0,pi)

nmin51(x)

  evaluates the NMinimize51 function for a list of coeffs

  f(x) = f_0(x) + f_1(x)

  Where: f_0(x) = exp(sin(50*x_0)) + sin(60*exp(x_1)) + sin(70*sin(x_0)) and f_1(x) = sin(sin(80*x_1)) - sin(10*(x_0 + x_1)) + (x_(0)^2 + x_(1)^2)/4

  Inspect with mystic_model_plotter using::

    mystic.models.nmin51 -b “-5:5:.1, 0:5:.1” -d

  The minimum is f(x)=-3.306869 at x=(-0.02440313,0.21061247)

paviani(x)

  evaluates Paviani’s function for a list of coeffs

  f(x) = f_0(x) - f_1(x)

  Where: f_0(x) = sum_(i=0)^(N-1) (ln(x_i - 2)^2 + ln(10 - x_i)^2) and f_1(x) = prod_(i=0)^(N-1) x_(i)^(.2)

  Inspect with mystic_model_plotter using::

    mystic.models.paviani -b “2:10:.1, 2:10:.1” -d

  For N=1, the minimum is f(x)=2.133838 at x_i=8.501586, for N=3, the minimum is f(x)=7.386004 at x_i=8.589578, for N=5, the minimum is f(x)=9.730525 at x_i=8.740743, for N=8, the minimum is f(x)=-3.411859 at x_i=9.086900, for N=10, the minimum is f(x)=-45.778470 at x_i=9.350241.

peaks(x)

  evaluates an 2-dimensional peaks function for a list of coeffs

  f(x) = f_0(x) - f_1(x) - f_2(x)

  Where: f_0(x) = 3 * (1 - x_0)^2 * exp(-x_0^2 - (x_1 + 1)^2) and f_1(x) = 10 * (.2 * x_0 - x_0^3 - x_1^5) * exp(-x_0^2 - x_1^2) and f_2(x) = exp(-(x_0 + 1)^2 - x_1^2) / 3

  Inspect with mystic_model_plotter using::

    mystic.models.peaks -b “-5:5:.1, -5:5:.1” -d

  The minimum is f(x)=-6.551133332835841 at x=(0.22827892, -1.62553496)

powers(x)

  evaluates the sum of different powers function for a list of coeffs

  f(x) = sum_(i=0)^(N-1) abs(x_(i))^(i+2)

  Inspect with mystic_model_plotter using::

    mystic.models.powers -b “-5:5:.1, -5:5:.1” -d

  The minimum is f(x)=0.0 at x_i=0.0 for all i

quartic(x)

  evaluates an N-dimensional quartic function for a list of coeffs

  f(x) = sum_(i=0)^(N-1) (x_(i)^4 * (i+1) + k_i)

  Where k_i is a random variable with uniform distribution bounded by [0,1).

  Inspect with mystic_model_plotter using::

    mystic.models.quartic -b “-3:3:.1, -3:3:.1” -d -x 1

  The minimum is f(x)=N*E[k] for x_i=0.0, where E[k] is the expectation of k, and thus E[k]=0.5 for a uniform distribution bounded by [0,1).

rastrigin(x)

  evaluates Rastrigin’s function for a list of coeffs

  f(x) = 10 * N + sum_(i=0)^(N-1) (x_(i)^2 - 10 * cos(2 * pi * x_(i)))

  Inspect with mystic_model_plotter using::

    mystic.models.rastrigin -b “-5:5:.1, -5:5:.1” -d

  The minimum is f(x)=0.0 at x_i=0.0 for all i

rosen(x)

  evaluates an N-dimensional Rosenbrock saddle for a list of coeffs

  f(x) = sum_(i=0)^(N-2) 100*(x_(i+1) - x_(i)^(2))^(2) + (1 - x_(i))^(2)

  Inspect with mystic_model_plotter using::

    mystic.models.rosen -b “-3:3:.1, -1:5:.1, 1” -d -x 1

  The minimum is f(x)=0.0 at x_i=1.0 for all i

rosen0der(x)

  evaluates an N-dimensional Rosenbrock saddle for a list of coeffs

  f(x) = sum_(i=0)^(N-2) 100*(x_(i+1) - x_(i)^(2))^(2) + (1 - x_(i))^(2)

  Inspect with mystic_model_plotter using::

    mystic.models.rosen -b “-3:3:.1, -1:5:.1, 1” -d -x 1

  The minimum is f(x)=0.0 at x_i=1.0 for all i

rosen1der(x)

  evaluates an N-dimensional Rosenbrock derivative for a list of coeffs

  The minimum is f’(x)=[0.0]*n at x=[1.0]*n, where len(x) >= 2.

schwefel(x)

  evaluates Schwefel’s function for a list of coeffs

  f(x) = sum_(i=0)^(N-1) -x_i * sin(sqrt(abs(x_i)))

  Where abs(x_i) <= 500.

  Inspect with mystic_model_plotter using::

    mystic.models.schwefel -b “-500:500:10, -500:500:10” -d

  The minimum is f(x)=-(N+1)*418.98288727243374 at x_i=420.9687465 for all i

shekel(x)

  evaluates a 2-D Shekel’s Foxholes function for a list of coeffs

  f(x) = 1 / (0.002 + f_0(x))

  Where: f_0(x) = sum_(i=0)^(24) 1 / (i + sum_(j=0)^(1) (x_j - a_ij)^(6)) with a_ij=(-32,-16,0,16,32). for j=0 and i=(0,1,2,3,4), a_i0=a_k0 with k=i mod 5 also j=1 and i=(0,5,10,15,20), a_i1=a_k1 with k=i+k’ and k’=(1,2,3,4).

  Inspect with mystic_model_plotter using::

    mystic.models.shekel -b “-50:50:1, -50:50:1” -d -x 1

  The minimum is f(x)=0 for x=(-32,-32)

sphere(x)

  evaluates an N-dimensional spherical function for a list of coeffs

  f(x) = sum_(i=0)^(N-1) x_(i)^2

  Inspect with mystic_model_plotter using::

    mystic.models.sphere -b “-5:5:.1, -5:5:.1” -d

  The minimum is f(x)=0.0 at x_i=0.0 for all i

step(x)

  evaluates an N-dimensional step function for a list of coeffs

  f(x) = f_0(x) + p_i(x), with i=0,1

  Where for abs(x_i) <= 5.12: f_0(x) = 30 + sum_(i=0)^(N-1) floor x_i and for x_i > 5.12: p_0(x) = 30 * (1 + (x_i - 5.12)) and for x_i < 5.12: p_1(x) = 30 * (1 + (5.12 - x_i)) Otherwise, f_0(x) = 0 and p_i(x)=0 for i=0,1.

  Inspect with mystic_model_plotter using::

    mystic.models.step -b “-10:10:.2, -10:10:.2” -d -x 1

  The minimum is f(x)=(30 - 6*N) for all x_i=[-5.12,-5)

venkat91(x)

  evaluates Venkataraman’s sinc function for a list of coeffs

  f(x) = -20 * sin(r(x))/r(x)

  Where: r(x) = sqrt((x_0 - 4)^2 + (x_1 - 4)^2 + 0.1)

  Inspect with mystic_model_plotter using::

    mystic.models.venkat91 -b “-10:10:.1, -10:10:.1” -d

  The minimum is f(x)=-19.668329370585823 at x=(4.0, 4.0)

wavy1(x)

  evaluates the wavy1 function for a list of coeffs

  f(x) = abs(x + 3*sin(x + pi) + pi)

  Inspect with mystic_model_plotter using::

    mystic.models.wavy1 -b “-20:20:.5, -20:20:.5” -d -r numpy.add

  The minimum is f(x)=0.0 at x_i=-pi for all i

wavy2(x)

  evaluates the wavy2 function for a list of coeffs

  f(x) = 4*sin(x)+sin(4*x)+sin(8*x)+sin(16*x)+sin(32*x)+sin(64*x)

  Inspect with mystic_model_plotter using::

    mystic.models.wavy2 -b “-10:10:.2, -10:10:.2” -d -r numpy.add

  The function has degenerate global minima of f(x)=-6.987594 at x_i = 4.489843526 + 2*k*pi for all i, and k is an integer

zimmermann(x)

  evaluates a Zimmermann function for a list of coeffs

  f(x) = max(f_0(x), p_i(x)), with i = 0,1,2,3

  Where: f_0(x) = 9 - x_0 - x_1 with for x_0 < 0: p_0(x) = -100 * x_0 and for x_1 < 0: p_1(x) = -100 * x_1 and for c_2(x) > 16 and c_3(x) > 14: p_i(x) = 100 * c_i(x), with i = 2,3 c_2(x) = (x_0 - 3)^2 + (x_1 - 2)^2 c_3(x) = x_0 * x_1 Otherwise, p_i(x)=0 for i=0,1,2,3 and c_i(x)=0 for i=2,3.

  Inspect with mystic_model_plotter using::

    mystic.models.zimmermann -b “-5:10:.1, -5:10:.1” -d -x 1

  The minimum is f(x)=0.0 at x=(7.0,2.0)

## lorentzian module

Lorentzian peak model

References

None

class Lorentzian(name='lorentz', metric=<function Lorentzian.<lambda>>, sigma=1.0)

  Bases: `AbstractModel`

  Computes lorentzian

  Provides a base class for mystic models.

  Inputs::

    name – a name string for the model metric – the cost metric object [default => lambda x: numpy.sum(x*x)] sigma – a scaling factor applied to the raw cost

  ForwardFactory(coeffs)

    generates a lorentzian model instance from a list of coefficients

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 23
  __static_attributes__ = ()
  evaluate(coeffs, evalpts)

    evaluate lorentzian with given coeffs over given evalpts coeffs = (a1,a2,a3,A0,E0,G0,n)

gendata(params, xmin, xmax, npts=4000)

  Generate a lorentzian dataset of npts between [min,max] from given params

histogram(data, binwidth, xmin, xmax)

  generate bin-centered histogram of provided data return bins of given binwidth (and histogram) generated between [xmin,xmax]

## mogi module

Mogi’s model of surface displacements from a point spherical source in an elastic half space

References

1. Mogi, K. “Relations between the eruptions of various volcanoes and the deformations of the ground surfaces around them”, Bull. Earthquake. Res. Inst., 36, 99-134, 1958.

class Mogi(name='mogi', metric=<function Mogi.<lambda>>, sigma=1.0)

  Bases: `AbstractModel`

  Computes surface displacements Ux, Uy, Uz in meters from a point spherical pressure source in an elastic half space [1].

  Provides a base class for mystic models.

  Inputs::

    name – a name string for the model metric – the cost metric object [default => lambda x: numpy.sum(x*x)] sigma – a scaling factor applied to the raw cost

  CostFactory(target, pts)

    generates a cost function instance from list of coefficients & evaluation points

  CostFactory2(pts, datapts, nparams)

    generates a cost function instance from datapoints & evaluation points

  ForwardFactory(coeffs)

    generates a mogi source instance from a list of coefficients

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 25
  __static_attributes__ = ()
  evaluate(coeffs, evalpts)

    evaluate a single Mogi peak over a 2D (2 by N) numpy array of evalpts, where coeffs = (x0,y0,z0,dV)

## nag module

This is drawn from examples in the NAG Library, with the ‘peaks’ function definition found in [1].

References

1. Numerical Algorithms Group, “NAG Library”, Oxford UK, Mark 24, 2013. http://www.nag.co.uk/numeric/CL/nagdoc_cl24/pdf/E05/e05jbc.pdf

class Peaks(ndim=2)

  Bases: `AbstractFunction`

  a peaks function generator

  A peaks function [1] is essentially flat, with three wells and three peaks near the origin. The global minimum is separated from the local minima by peaks.

  The generated function f(x) is identical to the ‘peaks’ function in section 10 of [1], and requires len(x) == 2.

  This is drawn from examples in the NAG Library, with the ‘peaks’ function definition found in [1].

  References

  1. Numerical Algorithms Group, “NAG Library”, Oxford UK, Mark 24, 2013. http://www.nag.co.uk/numeric/CL/nagdoc_cl24/pdf/E05/e05jbc.pdf

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 23
  __static_attributes__ = ()
  function(coeffs)

    evaluates an 2-dimensional peaks function for a list of coeffs

    f(x) = f_0(x) - f_1(x) - f_2(x)

    Where: f_0(x) = 3 * (1 - x_0)^2 * exp(-x_0^2 - (x_1 + 1)^2) and f_1(x) = 10 * (.2 * x_0 - x_0^3 - x_1^5) * exp(-x_0^2 - x_1^2) and f_2(x) = exp(-(x_0 + 1)^2 - x_1^2) / 3

    Inspect with mystic_model_plotter using::

      mystic.models.peaks -b “-5:5:.1, -5:5:.1” -d

    The minimum is f(x)=-6.551133332835841 at x=(0.22827892, -1.62553496)

  minimizers = [(0.22827892, -1.62553496), (-1.34739625, 0.20451886), (0.29644556, 0.3201962)]

peaks(coeffs)

  evaluates an 2-dimensional peaks function for a list of coeffs

  f(x) = f_0(x) - f_1(x) - f_2(x)

  Where: f_0(x) = 3 * (1 - x_0)^2 * exp(-x_0^2 - (x_1 + 1)^2) and f_1(x) = 10 * (.2 * x_0 - x_0^3 - x_1^5) * exp(-x_0^2 - x_1^2) and f_2(x) = exp(-(x_0 + 1)^2 - x_1^2) / 3

  Inspect with mystic_model_plotter using::

    mystic.models.peaks -b “-5:5:.1, -5:5:.1” -d

  The minimum is f(x)=-6.551133332835841 at x=(0.22827892, -1.62553496)

## pohlheim module

This is part of Pohlheim’s “GEATbx” test suite in [1], with function definitions drawn from [1], [2], [3], [4], [5], [6], and [7].

References

1. Pohlheim, H. “GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with MATLAB”, Version 3.80, 2006. http://www.geatbx.com/docu

2. Schwefel, H.-P. “Numerical Optimization of Computer Models”, John Wiley and Sons, Chichester UK, 1981.

3. Ackley, D.H. “A Connectionist Machine for Genetic Hillclimbing”, Kluwer Academic Publishers, Boston MA, 1987.

4. Michalewicz, Z. “Genetic Algorithms + Data Structures = Evolution Programs”, Springer-Verlag, Berlin, Heidelberg, New York, 1992.

5. Branin, F.K. “A Widely Convergent Method for Finding Multiple Solutions of Simultaneous Nonlinear Equations”, IBM J. Res. Develop., 504-522, Sept 1972.

6. Easom, E.E. “A Survey of Global Optimization Techniques”, M. Eng. Thesis, U. Louisville, Louisville KY, 1990.

7. Goldstein, A.A. and Price, I.F. “On Descent from Local Minima”, Math. Comput., (25) 115, 1971.

class Ackley(ndim=2)

  Bases: `AbstractFunction`

  an Ackley’s path function generator

  At a very coarse level, Ackley’s path function [1,3] is a slightly parabolic plane, with a sharp cone-shaped depression at the origin. The global minimum is found at the origin. There are several local minima evenly distributed across the function surface, where the surface modulates similarly to cosine.

  The generated function f(x) is identical to function (10) of [1], where len(x) >= 0.

  This is part of Pohlheim’s “GEATbx” test suite in [1], with function definitions drawn from [1], [2], [3], [4], [5], [6], and [7].

  References

  1. Pohlheim, H. “GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with MATLAB”, Version 3.80, 2006. http://www.geatbx.com/docu

  2. Schwefel, H.-P. “Numerical Optimization of Computer Models”, John Wiley and Sons, Chichester UK, 1981.

  3. Ackley, D.H. “A Connectionist Machine for Genetic Hillclimbing”, Kluwer Academic Publishers, Boston MA, 1987.

  4. Michalewicz, Z. “Genetic Algorithms + Data Structures = Evolution Programs”, Springer-Verlag, Berlin, Heidelberg, New York, 1992.

  5. Branin, F.K. “A Widely Convergent Method for Finding Multiple Solutions of Simultaneous Nonlinear Equations”, IBM J. Res. Develop., 504-522, Sept 1972.

  6. Easom, E.E. “A Survey of Global Optimization Techniques”, M. Eng. Thesis, U. Louisville, Louisville KY, 1990.

  7. Goldstein, A.A. and Price, I.F. “On Descent from Local Minima”, Math. Comput., (25) 115, 1971.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 169
  __static_attributes__ = ()
  function(coeffs)

    evaluates Ackley’s function for a list of coeffs

    f(x) = f_0(x) + f_1(x)

    Where: f_0(x) = -20 * exp(-0.2 * sqrt(1/N * sum_(i=0)^(N-1) x_(i)^(2))) and: f_1(x) = -exp(1/N * sum_(i=0)^(N-1) cos(2 * pi * x_(i))) + 20 + exp(1)

    Inspect with mystic_model_plotter using::

      mystic.models.ackley -b “-10:10:.1, -10:10:.1” -d

    The minimum is f(x)=0.0 at x_i=0.0 for all i

  minimizers = None

class Branins(ndim=2)

  Bases: `AbstractFunction`

  a Branins’s rcos function generator

  Branins’s function [1,5] is very similar to Rosenbrock’s saddle function. However unlike Rosenbrock’s saddle, Branins’s function has a degenerate global minimum.

  The generated function f(x) is identical to function (13) of [1], where len(x) >= 0.

  This is part of Pohlheim’s “GEATbx” test suite in [1], with function definitions drawn from [1], [2], [3], [4], [5], [6], and [7].

  References

  1. Pohlheim, H. “GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with MATLAB”, Version 3.80, 2006. http://www.geatbx.com/docu

  2. Schwefel, H.-P. “Numerical Optimization of Computer Models”, John Wiley and Sons, Chichester UK, 1981.

  3. Ackley, D.H. “A Connectionist Machine for Genetic Hillclimbing”, Kluwer Academic Publishers, Boston MA, 1987.

  4. Michalewicz, Z. “Genetic Algorithms + Data Structures = Evolution Programs”, Springer-Verlag, Berlin, Heidelberg, New York, 1992.

  5. Branin, F.K. “A Widely Convergent Method for Finding Multiple Solutions of Simultaneous Nonlinear Equations”, IBM J. Res. Develop., 504-522, Sept 1972.

  6. Easom, E.E. “A Survey of Global Optimization Techniques”, M. Eng. Thesis, U. Louisville, Louisville KY, 1990.

  7. Goldstein, A.A. and Price, I.F. “On Descent from Local Minima”, Math. Comput., (25) 115, 1971.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 246
  __static_attributes__ = ()
  function(coeffs)

    evaluates Branins’s function for a list of coeffs

    f(x) = f_0(x) + f_1(x)

    Where: f_0(x) = a * (x_1 - b * x_(0)^(2) + c * x_0 - d)^2 and f_1(x) = e * (1 - f) * cos(x_0) + e and a=1, b=5.1/(4*pi^2), c=5/pi, d=6, e=10, f=1/(8*pi)

    Inspect with mystic_model_plotter using::

      mystic.models.branins -b “-10:20:.1, -5:25:.1” -d -x 1

    The minimum is f(x)=0.397887 at x=((2 +/- (2*i)+1)*pi, 2.275 + 10*i*(i+1)/2) for all i

  minimizers = None

class DifferentPowers(ndim=2)

  Bases: `AbstractFunction`

  a Pohlheim’s sum of different powers function generator

  Pohlheim’s sum of different powers function [1] is unimodal, and similar to the hyper-ellipsoid and De Jong’s sphere. The global minimum is at the origin, at the center of a broad basin.

  The generated function f(x) is identical to function (9) of [1], where len(x) >= 0.

  This is part of Pohlheim’s “GEATbx” test suite in [1], with function definitions drawn from [1], [2], [3], [4], [5], [6], and [7].

  References

  1. Pohlheim, H. “GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with MATLAB”, Version 3.80, 2006. http://www.geatbx.com/docu

  2. Schwefel, H.-P. “Numerical Optimization of Computer Models”, John Wiley and Sons, Chichester UK, 1981.

  3. Ackley, D.H. “A Connectionist Machine for Genetic Hillclimbing”, Kluwer Academic Publishers, Boston MA, 1987.

  4. Michalewicz, Z. “Genetic Algorithms + Data Structures = Evolution Programs”, Springer-Verlag, Berlin, Heidelberg, New York, 1992.

  5. Branin, F.K. “A Widely Convergent Method for Finding Multiple Solutions of Simultaneous Nonlinear Equations”, IBM J. Res. Develop., 504-522, Sept 1972.

  6. Easom, E.E. “A Survey of Global Optimization Techniques”, M. Eng. Thesis, U. Louisville, Louisville KY, 1990.

  7. Goldstein, A.A. and Price, I.F. “On Descent from Local Minima”, Math. Comput., (25) 115, 1971.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 138
  __static_attributes__ = ()
  function(coeffs)

    evaluates the sum of different powers function for a list of coeffs

    f(x) = sum_(i=0)^(N-1) abs(x_(i))^(i+2)

    Inspect with mystic_model_plotter using::

      mystic.models.powers -b “-5:5:.1, -5:5:.1” -d

    The minimum is f(x)=0.0 at x_i=0.0 for all i

  minimizers = [0.0]

class Easom(ndim=2)

  Bases: `AbstractFunction`

  a Easom’s function generator

  Easom’s function [1,6] is a unimodal function that exaluates to zero everywhere except in the region around the global minimum. The global minimum is at the bottom of a sharp well.

  The generated function f(x) is identical to function (14) of [1], where len(x) >= 0.

  This is part of Pohlheim’s “GEATbx” test suite in [1], with function definitions drawn from [1], [2], [3], [4], [5], [6], and [7].

  References

  1. Pohlheim, H. “GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with MATLAB”, Version 3.80, 2006. http://www.geatbx.com/docu

  2. Schwefel, H.-P. “Numerical Optimization of Computer Models”, John Wiley and Sons, Chichester UK, 1981.

  3. Ackley, D.H. “A Connectionist Machine for Genetic Hillclimbing”, Kluwer Academic Publishers, Boston MA, 1987.

  4. Michalewicz, Z. “Genetic Algorithms + Data Structures = Evolution Programs”, Springer-Verlag, Berlin, Heidelberg, New York, 1992.

  5. Branin, F.K. “A Widely Convergent Method for Finding Multiple Solutions of Simultaneous Nonlinear Equations”, IBM J. Res. Develop., 504-522, Sept 1972.

  6. Easom, E.E. “A Survey of Global Optimization Techniques”, M. Eng. Thesis, U. Louisville, Louisville KY, 1990.

  7. Goldstein, A.A. and Price, I.F. “On Descent from Local Minima”, Math. Comput., (25) 115, 1971.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 288
  __static_attributes__ = ()
  function(coeffs)

    evaluates Easom’s function for a list of coeffs

    f(x) = -cos(x_0) * cos(x_1) * exp(-((x_0-pi)^2+(x_1-pi)^2))

    Inspect with mystic_model_plotter using::

      mystic.models.easom -b “-5:10:.1, -5:10:.1” -d

    The minimum is f(x)=-1.0 at x=(pi,pi)

  minimizers = [(3.141592653589793, 3.141592653589793)]

class GoldsteinPrice(ndim=2)

  Bases: `AbstractFunction`

  a Goldstein-Price’s function generator

  Goldstein-Price’s function [1,7] provides a function with several peaks surrounding a roughly flat valley. There are a few shallow scorings across the valley, where the global minimum is found at the intersection of the deepest of the two scorings. Local minima occur at other intersections of scorings.

  The generated function f(x) is identical to function (15) of [1], where len(x) >= 0.

  This is part of Pohlheim’s “GEATbx” test suite in [1], with function definitions drawn from [1], [2], [3], [4], [5], [6], and [7].

  References

  1. Pohlheim, H. “GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with MATLAB”, Version 3.80, 2006. http://www.geatbx.com/docu

  2. Schwefel, H.-P. “Numerical Optimization of Computer Models”, John Wiley and Sons, Chichester UK, 1981.

  3. Ackley, D.H. “A Connectionist Machine for Genetic Hillclimbing”, Kluwer Academic Publishers, Boston MA, 1987.

  4. Michalewicz, Z. “Genetic Algorithms + Data Structures = Evolution Programs”, Springer-Verlag, Berlin, Heidelberg, New York, 1992.

  5. Branin, F.K. “A Widely Convergent Method for Finding Multiple Solutions of Simultaneous Nonlinear Equations”, IBM J. Res. Develop., 504-522, Sept 1972.

  6. Easom, E.E. “A Survey of Global Optimization Techniques”, M. Eng. Thesis, U. Louisville, Louisville KY, 1990.

  7. Goldstein, A.A. and Price, I.F. “On Descent from Local Minima”, Math. Comput., (25) 115, 1971.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 319
  __static_attributes__ = ()
  function(coeffs)

    evaluates Goldstein-Price’s function for a list of coeffs

    f(x) = (1 + (x_0 + x_1 + 1)^2 * f_0(x)) * (30 + (2*x_0 - 3*x_1)^2 * f_1(x))

    Where: f_0(x) = 19 - 14*x_0 + 3*x_(0)^2 - 14*x_1 + 6*x_(0)*x_(1) + 3*x_(1)^2 and f_1(x) = 18 - 32*x_0 + 12*x_(0)^2 + 48*x_1 - 36*x_(0)*x_(1) + 27*x_(1)^2

    Inspect with mystic_model_plotter using::

      mystic.models.goldstein -b “-5:5:.1, -5:5:.1” -d -x 1

    The minimum is f(x)=3.0 at x=(0,-1)

  minimizers = [(0, -1), (-0.6, -0.4), (1.8, 0.2)]

class HyperEllipsoid(ndim=2)

  Bases: `AbstractFunction`

  a Pohlheim’s rotated hyper-ellipsoid function generator

  Pohlheim’s rotated hyper-ellipsoid function [1] is continuous, convex, and unimodal. The global minimum is located at the center of the N-dimensional axis parallel hyper-ellipsoid.

  The generated function f(x) is identical to function (1b) of [1], where len(x) >= 0.

  This is part of Pohlheim’s “GEATbx” test suite in [1], with function definitions drawn from [1], [2], [3], [4], [5], [6], and [7].

  References

  1. Pohlheim, H. “GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with MATLAB”, Version 3.80, 2006. http://www.geatbx.com/docu

  2. Schwefel, H.-P. “Numerical Optimization of Computer Models”, John Wiley and Sons, Chichester UK, 1981.

  3. Ackley, D.H. “A Connectionist Machine for Genetic Hillclimbing”, Kluwer Academic Publishers, Boston MA, 1987.

  4. Michalewicz, Z. “Genetic Algorithms + Data Structures = Evolution Programs”, Springer-Verlag, Berlin, Heidelberg, New York, 1992.

  5. Branin, F.K. “A Widely Convergent Method for Finding Multiple Solutions of Simultaneous Nonlinear Equations”, IBM J. Res. Develop., 504-522, Sept 1972.

  6. Easom, E.E. “A Survey of Global Optimization Techniques”, M. Eng. Thesis, U. Louisville, Louisville KY, 1990.

  7. Goldstein, A.A. and Price, I.F. “On Descent from Local Minima”, Math. Comput., (25) 115, 1971.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 77
  __static_attributes__ = ()
  function(coeffs)

    evaluates the rotated hyper-ellipsoid function for a list of coeffs

    f(x) = sum_(i=0)^(N-1) (sum_(j=0)^(i) x_j)^2

    Inspect with mystic_model_plotter using::

      mystic.models.ellipsoid -b “-5:5:.1, -5:5:.1” -d

    The minimum is f(x)=0.0 at x_i=0.0 for all i

  minimizers = [0.0]

class Michalewicz(ndim=5)

  Bases: `AbstractFunction`

  a Michalewicz’s function generator

  Michalewicz’s function [1,4] in general evaluates to zero. However, there are long narrow channels that create local minima. At the intersection of the channels, the function additionally has sharp dips – one of which is the global minimum.

  The generated function f(x) is identical to function (12) of [1], where len(x) >= 0.

  This is part of Pohlheim’s “GEATbx” test suite in [1], with function definitions drawn from [1], [2], [3], [4], [5], [6], and [7].

  References

  1. Pohlheim, H. “GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with MATLAB”, Version 3.80, 2006. http://www.geatbx.com/docu

  2. Schwefel, H.-P. “Numerical Optimization of Computer Models”, John Wiley and Sons, Chichester UK, 1981.

  3. Ackley, D.H. “A Connectionist Machine for Genetic Hillclimbing”, Kluwer Academic Publishers, Boston MA, 1987.

  4. Michalewicz, Z. “Genetic Algorithms + Data Structures = Evolution Programs”, Springer-Verlag, Berlin, Heidelberg, New York, 1992.

  5. Branin, F.K. “A Widely Convergent Method for Finding Multiple Solutions of Simultaneous Nonlinear Equations”, IBM J. Res. Develop., 504-522, Sept 1972.

  6. Easom, E.E. “A Survey of Global Optimization Techniques”, M. Eng. Thesis, U. Louisville, Louisville KY, 1990.

  7. Goldstein, A.A. and Price, I.F. “On Descent from Local Minima”, Math. Comput., (25) 115, 1971.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 210
  __static_attributes__ = ()
  function(coeffs)

    evaluates Michalewicz’s function for a list of coeffs

    f(x) = -sum_(i=0)^(N-1) sin(x_i) * (sin((i+1) * (x_i)^(2) / pi))^(20)

    Inspect with mystic_model_plotter using::

      mystic.models.michal -b “0:3.14:.1, 0:3.14:.1, 1.28500168, 1.92305311, 1.72047194” -d

    For x=(2.20289811, 1.57078059, 1.28500168, 1.92305311, 1.72047194, …)[:N] and c=(-0.801303, -1.0, -0.959092, -0.896699, -1.030564, …)[:N], the minimum is f(x)=sum(c) for all x_i=(0,pi)

  minimizers = None

class Rastrigin(ndim=2)

  Bases: `AbstractFunction`

  a Rastrigin’s function generator

  Rastrigin’s function [1] is essentially De Jong’s sphere with the addition of cosine modulation to produce several regularly distributed local minima. The global minimum is at the origin.

  The generated function f(x) is identical to function (6) of [1], where len(x) >= 0.

  This is part of Pohlheim’s “GEATbx” test suite in [1], with function definitions drawn from [1], [2], [3], [4], [5], [6], and [7].

  References

  1. Pohlheim, H. “GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with MATLAB”, Version 3.80, 2006. http://www.geatbx.com/docu

  2. Schwefel, H.-P. “Numerical Optimization of Computer Models”, John Wiley and Sons, Chichester UK, 1981.

  3. Ackley, D.H. “A Connectionist Machine for Genetic Hillclimbing”, Kluwer Academic Publishers, Boston MA, 1987.

  4. Michalewicz, Z. “Genetic Algorithms + Data Structures = Evolution Programs”, Springer-Verlag, Berlin, Heidelberg, New York, 1992.

  5. Branin, F.K. “A Widely Convergent Method for Finding Multiple Solutions of Simultaneous Nonlinear Equations”, IBM J. Res. Develop., 504-522, Sept 1972.

  6. Easom, E.E. “A Survey of Global Optimization Techniques”, M. Eng. Thesis, U. Louisville, Louisville KY, 1990.

  7. Goldstein, A.A. and Price, I.F. “On Descent from Local Minima”, Math. Comput., (25) 115, 1971.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 108
  __static_attributes__ = ()
  function(coeffs)

    evaluates Rastrigin’s function for a list of coeffs

    f(x) = 10 * N + sum_(i=0)^(N-1) (x_(i)^2 - 10 * cos(2 * pi * x_(i)))

    Inspect with mystic_model_plotter using::

      mystic.models.rastrigin -b “-5:5:.1, -5:5:.1” -d

    The minimum is f(x)=0.0 at x_i=0.0 for all i

  minimizers = None

class Schwefel(ndim=2)

  Bases: `AbstractFunction`

  a Schwefel’s function generator

  Schwefel’s function [1,2] has alternating rows of peaks and valleys, with the global minimum near the edge of the bounded parameter space. This funciton can be misleading for optimizers as the next best local minima are near the other corners of the bounded parameter space. The intensity of the peaks and valleys increases as one moves away from the origin.

  The generated function f(x) is identical to function (7) of [1], where len(x) >= 0.

  This is part of Pohlheim’s “GEATbx” test suite in [1], with function definitions drawn from [1], [2], [3], [4], [5], [6], and [7].

  References

  1. Pohlheim, H. “GEATbx: Genetic and Evolutionary Algorithm Toolbox for use with MATLAB”, Version 3.80, 2006. http://www.geatbx.com/docu

  2. Schwefel, H.-P. “Numerical Optimization of Computer Models”, John Wiley and Sons, Chichester UK, 1981.

  3. Ackley, D.H. “A Connectionist Machine for Genetic Hillclimbing”, Kluwer Academic Publishers, Boston MA, 1987.

  4. Michalewicz, Z. “Genetic Algorithms + Data Structures = Evolution Programs”, Springer-Verlag, Berlin, Heidelberg, New York, 1992.

  5. Branin, F.K. “A Widely Convergent Method for Finding Multiple Solutions of Simultaneous Nonlinear Equations”, IBM J. Res. Develop., 504-522, Sept 1972.

  6. Easom, E.E. “A Survey of Global Optimization Techniques”, M. Eng. Thesis, U. Louisville, Louisville KY, 1990.

  7. Goldstein, A.A. and Price, I.F. “On Descent from Local Minima”, Math. Comput., (25) 115, 1971.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 42
  __static_attributes__ = ()
  function(coeffs)

    evaluates Schwefel’s function for a list of coeffs

    f(x) = sum_(i=0)^(N-1) -x_i * sin(sqrt(abs(x_i)))

    Where abs(x_i) <= 500.

    Inspect with mystic_model_plotter using::

      mystic.models.schwefel -b “-500:500:10, -500:500:10” -d

    The minimum is f(x)=-(N+1)*418.98288727243374 at x_i=420.9687465 for all i

  minimizers = None

ackley(coeffs)

  evaluates Ackley’s function for a list of coeffs

  f(x) = f_0(x) + f_1(x)

  Where: f_0(x) = -20 * exp(-0.2 * sqrt(1/N * sum_(i=0)^(N-1) x_(i)^(2))) and: f_1(x) = -exp(1/N * sum_(i=0)^(N-1) cos(2 * pi * x_(i))) + 20 + exp(1)

  Inspect with mystic_model_plotter using::

    mystic.models.ackley -b “-10:10:.1, -10:10:.1” -d

  The minimum is f(x)=0.0 at x_i=0.0 for all i

branins(coeffs)

  evaluates Branins’s function for a list of coeffs

  f(x) = f_0(x) + f_1(x)

  Where: f_0(x) = a * (x_1 - b * x_(0)^(2) + c * x_0 - d)^2 and f_1(x) = e * (1 - f) * cos(x_0) + e and a=1, b=5.1/(4*pi^2), c=5/pi, d=6, e=10, f=1/(8*pi)

  Inspect with mystic_model_plotter using::

    mystic.models.branins -b “-10:20:.1, -5:25:.1” -d -x 1

  The minimum is f(x)=0.397887 at x=((2 +/- (2*i)+1)*pi, 2.275 + 10*i*(i+1)/2) for all i

easom(coeffs)

  evaluates Easom’s function for a list of coeffs

  f(x) = -cos(x_0) * cos(x_1) * exp(-((x_0-pi)^2+(x_1-pi)^2))

  Inspect with mystic_model_plotter using::

    mystic.models.easom -b “-5:10:.1, -5:10:.1” -d

  The minimum is f(x)=-1.0 at x=(pi,pi)

ellipsoid(coeffs)

  evaluates the rotated hyper-ellipsoid function for a list of coeffs

  f(x) = sum_(i=0)^(N-1) (sum_(j=0)^(i) x_j)^2

  Inspect with mystic_model_plotter using::

    mystic.models.ellipsoid -b “-5:5:.1, -5:5:.1” -d

  The minimum is f(x)=0.0 at x_i=0.0 for all i

goldstein(coeffs)

  evaluates Goldstein-Price’s function for a list of coeffs

  f(x) = (1 + (x_0 + x_1 + 1)^2 * f_0(x)) * (30 + (2*x_0 - 3*x_1)^2 * f_1(x))

  Where: f_0(x) = 19 - 14*x_0 + 3*x_(0)^2 - 14*x_1 + 6*x_(0)*x_(1) + 3*x_(1)^2 and f_1(x) = 18 - 32*x_0 + 12*x_(0)^2 + 48*x_1 - 36*x_(0)*x_(1) + 27*x_(1)^2

  Inspect with mystic_model_plotter using::

    mystic.models.goldstein -b “-5:5:.1, -5:5:.1” -d -x 1

  The minimum is f(x)=3.0 at x=(0,-1)

michal(coeffs)

  evaluates Michalewicz’s function for a list of coeffs

  f(x) = -sum_(i=0)^(N-1) sin(x_i) * (sin((i+1) * (x_i)^(2) / pi))^(20)

  Inspect with mystic_model_plotter using::

    mystic.models.michal -b “0:3.14:.1, 0:3.14:.1, 1.28500168, 1.92305311, 1.72047194” -d

  For x=(2.20289811, 1.57078059, 1.28500168, 1.92305311, 1.72047194, …)[:N] and c=(-0.801303, -1.0, -0.959092, -0.896699, -1.030564, …)[:N], the minimum is f(x)=sum(c) for all x_i=(0,pi)

powers(coeffs)

  evaluates the sum of different powers function for a list of coeffs

  f(x) = sum_(i=0)^(N-1) abs(x_(i))^(i+2)

  Inspect with mystic_model_plotter using::

    mystic.models.powers -b “-5:5:.1, -5:5:.1” -d

  The minimum is f(x)=0.0 at x_i=0.0 for all i

rastrigin(coeffs)

  evaluates Rastrigin’s function for a list of coeffs

  f(x) = 10 * N + sum_(i=0)^(N-1) (x_(i)^2 - 10 * cos(2 * pi * x_(i)))

  Inspect with mystic_model_plotter using::

    mystic.models.rastrigin -b “-5:5:.1, -5:5:.1” -d

  The minimum is f(x)=0.0 at x_i=0.0 for all i

schwefel(coeffs)

  evaluates Schwefel’s function for a list of coeffs

  f(x) = sum_(i=0)^(N-1) -x_i * sin(sqrt(abs(x_i)))

  Where abs(x_i) <= 500.

  Inspect with mystic_model_plotter using::

    mystic.models.schwefel -b “-500:500:10, -500:500:10” -d

  The minimum is f(x)=-(N+1)*418.98288727243374 at x_i=420.9687465 for all i

## poly module

1d model representation for polynomials

References

1. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” Journal of Global Optimization 11: 341-359, 1997.

2. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” TR-95-012, ICSI, 1995. http://www.icsi.berkeley.edu/~storn/TR-95-012.pdf

3. Storn, R. “Constrained Optimization” Dr. Dobb’s Journal, May, 119-123, 1995.

class Chebyshev(order=8, name='poly', metric=<function Chebyshev.<lambda>>, sigma=1.0)

  Bases: `Polynomial`

  Chebyshev polynomial models and functions, including specific methods for Tn(z) n=2,4,6,8,16, Equation (27-33) of [2]

  NOTE: default is T8(z)

  Provides a base class for mystic models.

  Inputs::

    name – a name string for the model metric – the cost metric object [default => lambda x: numpy.sum(x*x)] sigma – a scaling factor applied to the raw cost

  CostFactory(target, pts)

    generates a cost function instance from list of coefficients & evaluation points

  CostFactory2(pts, datapts, nparams)

    generates a cost function instance from datapoints & evaluation points

  ForwardFactory(coeffs)

    generates a 1-D polynomial instance from a list of coefficients

  __annotate_func__ = None
  __annotations_cache__ = {}
  __call__(*args, **kwds)

    Call self as a function.

  __firstlineno__ = 61
  __static_attributes__ = ('coeffs',)
  cost(trial, M=61)

    The costfunction for order-n Chebyshev fitting. M evaluation points between [-1, 1], and two end points

  forward(x)

    forward Chebyshev function

class Polynomial(name='poly', metric=<function Polynomial.<lambda>>, sigma=1.0)

  Bases: `AbstractModel`

  1-D Polynomial models and functions

  Provides a base class for mystic models.

  Inputs::

    name – a name string for the model metric – the cost metric object [default => lambda x: numpy.sum(x*x)] sigma – a scaling factor applied to the raw cost

  ForwardFactory(coeffs)

    generates a 1-D polynomial instance from a list of coefficients using numpy.poly1d(coeffs)

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 36
  __static_attributes__ = ('__forward__',)
  evaluate(coeffs, x)

    takes list of coefficients & evaluation points, returns f(x) thus, [a3, a2, a1, a0] yields a3 x^3 + a2 x^2 + a1 x^1 + a0

chebyshev16cost(trial, M=61)

  The costfunction for order-n Chebyshev fitting. M evaluation points between [-1, 1], and two end points

chebyshev2cost(trial, M=61)

  The costfunction for order-n Chebyshev fitting. M evaluation points between [-1, 1], and two end points

chebyshev4cost(trial, M=61)

  The costfunction for order-n Chebyshev fitting. M evaluation points between [-1, 1], and two end points

chebyshev6cost(trial, M=61)

  The costfunction for order-n Chebyshev fitting. M evaluation points between [-1, 1], and two end points

chebyshevcostfactory(target)

## schittkowski module

This is part of Hock and Schittkowski’s test suite in [1], with function definitions drawn from [1] and [2].

References

1. Hock, W. and Schittkowski, K. “Test Examples for Nonlinear Programming Codes”, Lecture Notes in Economics and Mathematical Systems, Vol. 187, Springer, 1981. http://www.ai7.uni-bayreuth.de/test_problem_coll.pdf

2. Paviani, D.A. “A new method for the solution of the general nonlinear programming problem”, Ph.D. dissertation, The University of Texas, Austin, TX, 1969.

class Paviani(ndim=10)

  Bases: `AbstractFunction`

  a Paviani’s function generator

  Paviani’s function [1,2] is a relatively flat basin that quickly jumps to infinity for x_i >= 10 or x_i <= 2. The global minimum is located near the corner of one of the basin corners. There are local minima in the corners ajacent to the global minima.

  The generated function f(x) is identical to function (110) of [1], where len(x) >= 0.

  This is part of Hock and Schittkowski’s test suite in [1], with function definitions drawn from [1] and [2].

  References

  1. Hock, W. and Schittkowski, K. “Test Examples for Nonlinear Programming Codes”, Lecture Notes in Economics and Mathematical Systems, Vol. 187, Springer, 1981. http://www.ai7.uni-bayreuth.de/test_problem_coll.pdf

  2. Paviani, D.A. “A new method for the solution of the general nonlinear programming problem”, Ph.D. dissertation, The University of Texas, Austin, TX, 1969.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 29
  __static_attributes__ = ()
  function(coeffs)

    evaluates Paviani’s function for a list of coeffs

    f(x) = f_0(x) - f_1(x)

    Where: f_0(x) = sum_(i=0)^(N-1) (ln(x_i - 2)^2 + ln(10 - x_i)^2) and f_1(x) = prod_(i=0)^(N-1) x_(i)^(.2)

    Inspect with mystic_model_plotter using::

      mystic.models.paviani -b “2:10:.1, 2:10:.1” -d

    For N=1, the minimum is f(x)=2.133838 at x_i=8.501586, for N=3, the minimum is f(x)=7.386004 at x_i=8.589578, for N=5, the minimum is f(x)=9.730525 at x_i=8.740743, for N=8, the minimum is f(x)=-3.411859 at x_i=9.086900, for N=10, the minimum is f(x)=-45.778470 at x_i=9.350241.

  minimizers = None

paviani(coeffs)

  evaluates Paviani’s function for a list of coeffs

  f(x) = f_0(x) - f_1(x)

  Where: f_0(x) = sum_(i=0)^(N-1) (ln(x_i - 2)^2 + ln(10 - x_i)^2) and f_1(x) = prod_(i=0)^(N-1) x_(i)^(.2)

  Inspect with mystic_model_plotter using::

    mystic.models.paviani -b “2:10:.1, 2:10:.1” -d

  For N=1, the minimum is f(x)=2.133838 at x_i=8.501586, for N=3, the minimum is f(x)=7.386004 at x_i=8.589578, for N=5, the minimum is f(x)=9.730525 at x_i=8.740743, for N=8, the minimum is f(x)=-3.411859 at x_i=9.086900, for N=10, the minimum is f(x)=-45.778470 at x_i=9.350241.

## storn module

This is part of Storn’s “Differential Evolution” test suite, as defined in [2], with ‘Corana’ function definitions drawn from [3,4], ‘Griewangk’ function definitions drawn from [5], and ‘Zimmermann’ function definitions drawn from [6].

References

1. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” Journal of Global Optimization 11: 341-359, 1997.

2. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” TR-95-012, ICSI, 1995. http://www.icsi.berkeley.edu/~storn/TR-95-012.pdf

3. Ingber, L. “Simulated Annealing: Practice Versus Theory” J. of Mathematical and Computer Modeling 18(11), 29-57, 1993.

4. Corana, A. and Marchesi, M. and Martini, C. and Ridella, S. “Minimizing Multimodal Functions of Continuous Variables with the ‘Simulated Annealing Algorithm’” ACM Transactions on Mathematical Software, March, 272-280, 1987.

5. Griewangk, A.O. “Generalized Descent for Global Optimization” Journal of Optimization Theory and Applications 34: 11-39, 1981.

6. Zimmermann, W. “Operations Research” Oldenbourg Munchen, Wien, 1990.

class Corana(ndim=4)

  Bases: `AbstractFunction`

  a Corana’s parabola function generator

  Corana’s parabola function [1,2,3,4] defines a paraboloid whose axes are parallel to the coordinate axes. This funciton has a large number of wells that increase in depth with proximity to the origin. The global minimum is a plateau around the origin.

  The generated function f(x) is a modified version of equation (22) of [2], where len(x) <= 4.

  This is part of Storn’s “Differential Evolution” test suite, as defined in [2], with ‘Corana’ function definitions drawn from [3,4], ‘Griewangk’ function definitions drawn from [5], and ‘Zimmermann’ function definitions drawn from [6].

  References

  1. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” Journal of Global Optimization 11: 341-359, 1997.

  2. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” TR-95-012, ICSI, 1995. http://www.icsi.berkeley.edu/~storn/TR-95-012.pdf

  3. Ingber, L. “Simulated Annealing: Practice Versus Theory” J. of Mathematical and Computer Modeling 18(11), 29-57, 1993.

  4. Corana, A. and Marchesi, M. and Martini, C. and Ridella, S. “Minimizing Multimodal Functions of Continuous Variables with the ‘Simulated Annealing Algorithm’” ACM Transactions on Mathematical Software, March, 272-280, 1987.

  5. Griewangk, A.O. “Generalized Descent for Global Optimization” Journal of Optimization Theory and Applications 34: 11-39, 1981.

  6. Zimmermann, W. “Operations Research” Oldenbourg Munchen, Wien, 1990.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 41
  __static_attributes__ = ()
  function(coeffs)

    evaluates a 4-D Corana’s parabola function for a list of coeffs

    f(x) = sum_(i=0)^(3) f_0(x)

    Where for abs(x_i - z_i) < 0.05: f_0(x) = 0.15*(z_i - 0.05*sign(z_i))^(2) * d_i and otherwise: f_0(x) = d_i * x_(i)^(2), with z_i = floor(abs(x_i/0.2)+0.49999)*sign(x_i)*0.2 and d_i = 1,1000,10,100.

    For len(x) == 1, x = x_0,0,0,0; for len(x) == 2, x = x_0,0,x_1,0; for len(x) == 3, x = x_0,0,x_1,x_2; for len(x) >= 4, x = x_0,x_1,x_2,x_3.

    Inspect with mystic_model_plotter using::

      mystic.models.corana -b “-1:1:.01, -1:1:.01” -d -x 1

    The minimum is f(x)=0 for abs(x_i) < 0.05 for all i.

  minimizers = None

class Griewangk(ndim=10)

  Bases: `AbstractFunction`

  a Griewangk’s function generator

  Griewangk’s function [1,2,5] is a multi-dimensional cosine function that provides several periodic local minima, with the global minimum at the origin. The local minima are fractionally more shallow than the global minimum, such that when viewed at a very coarse scale the function appears as a multi-dimensional parabola similar to De Jong’s sphere.

  The generated function f(x) is a modified version of equation (23) of [2], where len(x) >= 0.

  This is part of Storn’s “Differential Evolution” test suite, as defined in [2], with ‘Corana’ function definitions drawn from [3,4], ‘Griewangk’ function definitions drawn from [5], and ‘Zimmermann’ function definitions drawn from [6].

  References

  1. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” Journal of Global Optimization 11: 341-359, 1997.

  2. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” TR-95-012, ICSI, 1995. http://www.icsi.berkeley.edu/~storn/TR-95-012.pdf

  3. Ingber, L. “Simulated Annealing: Practice Versus Theory” J. of Mathematical and Computer Modeling 18(11), 29-57, 1993.

  4. Corana, A. and Marchesi, M. and Martini, C. and Ridella, S. “Minimizing Multimodal Functions of Continuous Variables with the ‘Simulated Annealing Algorithm’” ACM Transactions on Mathematical Software, March, 272-280, 1987.

  5. Griewangk, A.O. “Generalized Descent for Global Optimization” Journal of Optimization Theory and Applications 34: 11-39, 1981.

  6. Zimmermann, W. “Operations Research” Oldenbourg Munchen, Wien, 1990.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 102
  __static_attributes__ = ()
  function(coeffs)

    evaluates an N-dimensional Griewangk’s function for a list of coeffs

    f(x) = f_0(x) - f_1(x) + 1

    Where: f_0(x) = sum_(i=0)^(N-1) x_(i)^(2) / 4000. and: f_1(x) = prod_(i=0)^(N-1) cos( x_i / (i+1)^(1/2) )

    Inspect with mystic_model_plotter using::

      mystic.models.griewangk -b “-10:10:.1, -10:10:.1” -d -x 5

    The minimum is f(x)=0.0 for x_i=0.0

  minimizers = [0.0]

class Zimmermann(ndim=2)

  Bases: `AbstractFunction`

  a Zimmermann function generator

  A Zimmermann function [1,2,6] poses difficulty for minimizers as the minimum is located at the corner of the constrained region. A penalty is applied to all values outside the constrained region, creating a local minimum.

  The generated function f(x) is a modified version of equation (24-26) of [2], and requires len(x) == 2.

  This is part of Storn’s “Differential Evolution” test suite, as defined in [2], with ‘Corana’ function definitions drawn from [3,4], ‘Griewangk’ function definitions drawn from [5], and ‘Zimmermann’ function definitions drawn from [6].

  References

  1. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” Journal of Global Optimization 11: 341-359, 1997.

  2. Storn, R. and Price, K. “Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces” TR-95-012, ICSI, 1995. http://www.icsi.berkeley.edu/~storn/TR-95-012.pdf

  3. Ingber, L. “Simulated Annealing: Practice Versus Theory” J. of Mathematical and Computer Modeling 18(11), 29-57, 1993.

  4. Corana, A. and Marchesi, M. and Martini, C. and Ridella, S. “Minimizing Multimodal Functions of Continuous Variables with the ‘Simulated Annealing Algorithm’” ACM Transactions on Mathematical Software, March, 272-280, 1987.

  5. Griewangk, A.O. “Generalized Descent for Global Optimization” Journal of Optimization Theory and Applications 34: 11-39, 1981.

  6. Zimmermann, W. “Operations Research” Oldenbourg Munchen, Wien, 1990.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 145
  __static_attributes__ = ()
  function(coeffs)

    evaluates a Zimmermann function for a list of coeffs

    f(x) = max(f_0(x), p_i(x)), with i = 0,1,2,3

    Where: f_0(x) = 9 - x_0 - x_1 with for x_0 < 0: p_0(x) = -100 * x_0 and for x_1 < 0: p_1(x) = -100 * x_1 and for c_2(x) > 16 and c_3(x) > 14: p_i(x) = 100 * c_i(x), with i = 2,3 c_2(x) = (x_0 - 3)^2 + (x_1 - 2)^2 c_3(x) = x_0 * x_1 Otherwise, p_i(x)=0 for i=0,1,2,3 and c_i(x)=0 for i=2,3.

    Inspect with mystic_model_plotter using::

      mystic.models.zimmermann -b “-5:10:.1, -5:10:.1” -d -x 1

    The minimum is f(x)=0.0 at x=(7.0,2.0)

  minimizers = [(7.0, 2.0), (2.3547765, 5.948322)]

corana(coeffs)

  evaluates a 4-D Corana’s parabola function for a list of coeffs

  f(x) = sum_(i=0)^(3) f_0(x)

  Where for abs(x_i - z_i) < 0.05: f_0(x) = 0.15*(z_i - 0.05*sign(z_i))^(2) * d_i and otherwise: f_0(x) = d_i * x_(i)^(2), with z_i = floor(abs(x_i/0.2)+0.49999)*sign(x_i)*0.2 and d_i = 1,1000,10,100.

  For len(x) == 1, x = x_0,0,0,0; for len(x) == 2, x = x_0,0,x_1,0; for len(x) == 3, x = x_0,0,x_1,x_2; for len(x) >= 4, x = x_0,x_1,x_2,x_3.

  Inspect with mystic_model_plotter using::

    mystic.models.corana -b “-1:1:.01, -1:1:.01” -d -x 1

  The minimum is f(x)=0 for abs(x_i) < 0.05 for all i.

griewangk(coeffs)

  evaluates an N-dimensional Griewangk’s function for a list of coeffs

  f(x) = f_0(x) - f_1(x) + 1

  Where: f_0(x) = sum_(i=0)^(N-1) x_(i)^(2) / 4000. and: f_1(x) = prod_(i=0)^(N-1) cos( x_i / (i+1)^(1/2) )

  Inspect with mystic_model_plotter using::

    mystic.models.griewangk -b “-10:10:.1, -10:10:.1” -d -x 5

  The minimum is f(x)=0.0 for x_i=0.0

zimmermann(coeffs)

  evaluates a Zimmermann function for a list of coeffs

  f(x) = max(f_0(x), p_i(x)), with i = 0,1,2,3

  Where: f_0(x) = 9 - x_0 - x_1 with for x_0 < 0: p_0(x) = -100 * x_0 and for x_1 < 0: p_1(x) = -100 * x_1 and for c_2(x) > 16 and c_3(x) > 14: p_i(x) = 100 * c_i(x), with i = 2,3 c_2(x) = (x_0 - 3)^2 + (x_1 - 2)^2 c_3(x) = x_0 * x_1 Otherwise, p_i(x)=0 for i=0,1,2,3 and c_i(x)=0 for i=2,3.

  Inspect with mystic_model_plotter using::

    mystic.models.zimmermann -b “-5:10:.1, -5:10:.1” -d -x 1

  The minimum is f(x)=0.0 at x=(7.0,2.0)

## venkataraman module

This is drawn from examples in Applied Optimization with MATLAB programming, with the function definition found in [1].

References

1. Venkataraman, P. “Applied Optimization with MATLAB Programming”, John Wiley and Sons, Hoboken NJ, 2nd Edition, 2009.

class Sinc(ndim=2)

  Bases: `AbstractFunction`

  a Venkataraman’s sinc function generator

  Venkataraman’s sinc function [1] has the global minimum at the center of concentric rings of local minima, with well depth decreasing with distance from center.

  The generated function f(x) is identical to equation (9.5) of example 9.1 of [1], and requires len(x) == 2.

  This is drawn from examples in Applied Optimization with MATLAB programming, with the function definition found in [1].

  References

  1. Venkataraman, P. “Applied Optimization with MATLAB Programming”, John Wiley and Sons, Hoboken NJ, 2nd Edition, 2009.

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 23
  __static_attributes__ = ()
  function(coeffs)

    evaluates Venkataraman’s sinc function for a list of coeffs

    f(x) = -20 * sin(r(x))/r(x)

    Where: r(x) = sqrt((x_0 - 4)^2 + (x_1 - 4)^2 + 0.1)

    Inspect with mystic_model_plotter using::

      mystic.models.venkat91 -b “-10:10:.1, -10:10:.1” -d

    The minimum is f(x)=-19.668329370585823 at x=(4.0, 4.0)

  minimizers = None

venkat91(coeffs)

  evaluates Venkataraman’s sinc function for a list of coeffs

  f(x) = -20 * sin(r(x))/r(x)

  Where: r(x) = sqrt((x_0 - 4)^2 + (x_1 - 4)^2 + 0.1)

  Inspect with mystic_model_plotter using::

    mystic.models.venkat91 -b “-10:10:.1, -10:10:.1” -d

  The minimum is f(x)=-19.668329370585823 at x=(4.0, 4.0)

## wavy module

Multi-minima example functions with vector outputs, which require a ‘reducing’ function to provide scalar return values.

References

None

class Wavy1(ndim=2)

  Bases: `AbstractFunction`

  a wavy1 function generator

  A wavy1 function has a vector return value, and oscillates similarly to x+sin(x) in each direction. When a reduction function, like ‘numpy.add’ is applied, the surface can be visualized. The global minimum is at the center of a cross-hairs running along x_i = -pi, with periodic local minima in each direction.

  The generated function f(x) requires len(x) > 0, and a reducing function for use in most optimizers.

  Multi-minima example functions with vector outputs, which require a ‘reducing’ function to provide scalar return values.

  References

  None

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 24
  __static_attributes__ = ()
  function(coeffs)

    evaluates the wavy1 function for a list of coeffs

    f(x) = abs(x + 3*sin(x + pi) + pi)

    Inspect with mystic_model_plotter using::

      mystic.models.wavy1 -b “-20:20:.5, -20:20:.5” -d -r numpy.add

    The minimum is f(x)=0.0 at x_i=-pi for all i

  minimizers = [-3.141592653589793]

class Wavy2(ndim=2)

  Bases: `AbstractFunction`

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 58
  __static_attributes__ = ()
  function(coeffs)

    evaluates the wavy2 function for a list of coeffs

    f(x) = 4*sin(x)+sin(4*x)+sin(8*x)+sin(16*x)+sin(32*x)+sin(64*x)

    Inspect with mystic_model_plotter using::

      mystic.models.wavy2 -b “-10:10:.2, -10:10:.2” -d -r numpy.add

    The function has degenerate global minima of f(x)=-6.987594 at x_i = 4.489843526 + 2*k*pi for all i, and k is an integer

  minimizers = None

wavy1(coeffs)

  evaluates the wavy1 function for a list of coeffs

  f(x) = abs(x + 3*sin(x + pi) + pi)

  Inspect with mystic_model_plotter using::

    mystic.models.wavy1 -b “-20:20:.5, -20:20:.5” -d -r numpy.add

  The minimum is f(x)=0.0 at x_i=-pi for all i

wavy2(coeffs)

  evaluates the wavy2 function for a list of coeffs

  f(x) = 4*sin(x)+sin(4*x)+sin(8*x)+sin(16*x)+sin(32*x)+sin(64*x)

  Inspect with mystic_model_plotter using::

    mystic.models.wavy2 -b “-10:10:.2, -10:10:.2” -d -r numpy.add

  The function has degenerate global minima of f(x)=-6.987594 at x_i = 4.489843526 + 2*k*pi for all i, and k is an integer

## wolfram module

This is drawn from Mathematica’s example suites, with the ‘fOsc3D’ function definition found in [1], and the ‘XXX’ function found in [2].

References

1. Trott, M. “The Mathematica GuideBook for Numerics”, Springer-Verlag, New York, 2006.

2. Champion, B. and Strzebonski, A. “Wolfram Mathematica Tutorial Collection on Constrained Optimization”, Wolfram Research, USA, 2008. http://reference.wolfram.com/language/guide/Optimization.html

class NMinimize51(ndim=2)

  Bases: `AbstractFunction`

  a NMinimize51 function generator

  A NMinimize51 function [2] has many local minima. The minima are periodic over parameter space, and modulate the surface of a parabola at the coarse scale. The global minimum is located at the deepest of the many periodic wells.

  The generated function f(x) is identical to equation (51) of the ‘NMinimize’ section in [2], and requires len(x) == 2.

  This is drawn from Mathematica’s example suites, with the ‘fOsc3D’ function definition found in [1], and the ‘XXX’ function found in [2].

  References

  1. Trott, M. “The Mathematica GuideBook for Numerics”, Springer-Verlag, New York, 2006.

  2. Champion, B. and Strzebonski, A. “Wolfram Mathematica Tutorial Collection on Constrained Optimization”, Wolfram Research, USA, 2008. http://reference.wolfram.com/language/guide/Optimization.html

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 70
  __static_attributes__ = ()
  function(coeffs)

    evaluates the NMinimize51 function for a list of coeffs

    f(x) = f_0(x) + f_1(x)

    Where: f_0(x) = exp(sin(50*x_0)) + sin(60*exp(x_1)) + sin(70*sin(x_0)) and f_1(x) = sin(sin(80*x_1)) - sin(10*(x_0 + x_1)) + (x_(0)^2 + x_(1)^2)/4

    Inspect with mystic_model_plotter using::

      mystic.models.nmin51 -b “-5:5:.1, 0:5:.1” -d

    The minimum is f(x)=-3.306869 at x=(-0.02440313,0.21061247)

  minimizers = [(-0.02440313, 0.21061247)]

class fOsc3D(ndim=2)

  Bases: `AbstractFunction`

  a fOsc3D function generator

  A fOsc3D function [1] for positive x_1 values yields small sinusoidal oscillations on a flat plane, where a sinkhole containing the global minimum and a few local minima is found in a small region near the origin. For negative x_1 values, a parabolic penalty is applied that decreases as the x_1 appoaches zero.

  The generated function f(x) is identical to equation (75) of section 1.10 of [1], and requires len(x) == 2.

  This is drawn from Mathematica’s example suites, with the ‘fOsc3D’ function definition found in [1], and the ‘XXX’ function found in [2].

  References

  1. Trott, M. “The Mathematica GuideBook for Numerics”, Springer-Verlag, New York, 2006.

  2. Champion, B. and Strzebonski, A. “Wolfram Mathematica Tutorial Collection on Constrained Optimization”, Wolfram Research, USA, 2008. http://reference.wolfram.com/language/guide/Optimization.html

  Provides a base class for mystic functions.

  Takes optional input ‘ndim’ (number of dimensions).

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 26
  __static_attributes__ = ()
  function(coeffs)

    evaluates the fOsc3D function for a list of coeffs

    f(x) = f_0(x) + p(x)

    Where: f_0(x) = -4 * exp(-x_(0)^2 - x_(1)^2) + sin(6*x_(0)) * sin(5*x_(1)) with for x_1 < 0: p(x) = 100.*x_(1)^2 and otherwise: p(x) = 0.

    Inspect with mystic_model_plotter using::

      mystic.models.fosc3d -b “-5:5:.1, 0:5:.1” -d

    The minimum is f(x)=-4.501069742528923 at x=(-0.215018, 0.240356)

  minimizers = [(-0.215018, 0.240356)]

fosc3d(coeffs)

  evaluates the fOsc3D function for a list of coeffs

  f(x) = f_0(x) + p(x)

  Where: f_0(x) = -4 * exp(-x_(0)^2 - x_(1)^2) + sin(6*x_(0)) * sin(5*x_(1)) with for x_1 < 0: p(x) = 100.*x_(1)^2 and otherwise: p(x) = 0.

  Inspect with mystic_model_plotter using::

    mystic.models.fosc3d -b “-5:5:.1, 0:5:.1” -d

  The minimum is f(x)=-4.501069742528923 at x=(-0.215018, 0.240356)

nmin51(coeffs)

  evaluates the NMinimize51 function for a list of coeffs

  f(x) = f_0(x) + f_1(x)

  Where: f_0(x) = exp(sin(50*x_0)) + sin(60*exp(x_1)) + sin(70*sin(x_0)) and f_1(x) = sin(sin(80*x_1)) - sin(10*(x_0 + x_1)) + (x_(0)^2 + x_(1)^2)/4

  Inspect with mystic_model_plotter using::

    mystic.models.nmin51 -b “-5:5:.1, 0:5:.1” -d

  The minimum is f(x)=-3.306869 at x=(-0.02440313,0.21061247)