Reference

This is the class and function reference of scipydirect. Please refer to the tutorial for further details, as the class and function raw specifications may not be enough to give full guidelines on their uses.

scipydirect.minimize(func, bounds=None, nvar=None, args=(), disp=False, eps=0.0001, maxf=20000, maxT=6000, algmethod=0, fglobal=-1e+100, fglper=0.01, volper=-1.0, sigmaper=-1.0, **kwargs)

Solve an optimization problem using the DIRECT (Dividing Rectangles) algorithm. It can be used to solve general nonlinear programming problems of the form:

\[\min_ {x \in R^n} f(x)\]

subject to

\[x_L \leq x \leq x_U\]

Where \(x\) are the optimization variables (with upper and lower bounds), \(f(x)\) is the objective function.

Parameters:
  • func (objective function) – called as func(x, *args); does not need to be defined everywhere, raise an Exception where function is not defined
  • bounds (array-like) – (min, max) pairs for each element in x, defining the bounds on that parameter.
  • nvar (integer) – Dimensionality of x (only needed if bounds is not defined)
  • eps (float) – Ensures sufficient decrease in function value when a new potentially optimal interval is chosen.
  • maxf (integer) –

    Approximate upper bound on objective function evaluations.

    Note

    Maximal allowed value is 90000 see documentation of Fortran library.

  • maxT (integer) –

    Maximum number of iterations.

    Note

    Maximal allowed value is 6000 see documentation of Fortran library.

  • algmethod (integer) –

    Whether to use the original or modified DIRECT algorithm. Possible values:

    • algmethod=0 - use the original DIRECT algorithm
    • algmethod=1 - use the modified DIRECT-l algorithm
  • fglobal (float) – Function value of the global optimum. If this value is not known set this to a very large negative value.
  • fglper (float) –

    Terminate the optimization when the percent error satisfies:

    \[100*(f_{min} - f_{global})/\max(1, |f_{global}|) \leq f_{glper}\]
  • volper (float) – Terminate the optimization once the volume of a hyperrectangle is less than volper percent of the original hyperrectangel.
  • sigmaper (float) – Terminate the optimization once the measure of the hyperrectangle is less than sigmaper.
Returns:

res – The optimization result represented as a OptimizeResult object. Important attributes are: x the solution array, success a Boolean flag indicating if the optimizer exited successfully and message which describes the cause of the termination. See OptimizeResult for a description of other attributes.

Return type:

OptimizeResult

class scipydirect.OptimizeResult

Bases: dict

Represents the optimization result.

x

The solution of the optimization.

Type:ndarray
success

Whether or not the optimizer exited successfully.

Type:bool
status

Termination status of the optimizer. Its value depends on the underlying solver. Refer to message for details.

Type:int
message

Description of the cause of the termination.

Type:str
fun, jac, hess, hess_inv

Values of objective function, Jacobian, Hessian or its inverse (if available). The Hessians may be approximations, see the documentation of the function in question.

Type:ndarray
nfev, njev, nhev

Number of evaluations of the objective functions and of its Jacobian and Hessian.

Type:int
nit

Number of iterations performed by the optimizer.

Type:int
maxcv

The maximum constraint violation.

Type:float

Notes

There may be additional attributes not listed above depending of the specific solver. Since this class is essentially a subclass of dict with attribute accessors, one can see which attributes are available using the keys() method.