Reference¶
This is the class and function reference of pydirect. 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:
subject to
Where are the optimization variables (with upper and lower bounds), 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 inx
, 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 algorithmalgmethod=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:
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 : OptimizeResult
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 andmessage
which describes the cause of the termination. See OptimizeResult for a description of other attributes.
-
class
scipydirect.
OptimizeResult
¶ Bases:
dict
Represents the optimization result.
Attributes: x : ndarray
The solution of the optimization.
success : bool
Whether or not the optimizer exited successfully.
status : int
Termination status of the optimizer. Its value depends on the underlying solver. Refer to message for details.
message : str
Description of the cause of the termination.
fun, jac, hess, hess_inv : ndarray
Values of objective function, Jacobian, Hessian or its inverse (if available). The Hessians may be approximations, see the documentation of the function in question.
nfev, njev, nhev : int
Number of evaluations of the objective functions and of its Jacobian and Hessian.
nit : int
Number of iterations performed by the optimizer.
maxcv : float
The maximum constraint violation.
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.