class pdfo.OptimizeResult[source]#

Result structure of the DFO algorithms.

x: ndarray, shape (n,)

Solution array.

success: bool

Whether the optimizer exited successfully.

status: int

Flag characterizing the exit condition.




The lower bound for the trust region radius is reached.


The target function value is achieved.


A trust region step failed to reduce the quadratic model.


The objective function has been evaluated maxfev times.

4, 7, 8, 9

Rounding errors become severe in the Fortran code.


All variables are fixed by the constraints.


A linear feasibility problem has been received and solved.


A linear feasibility problem has been received but failed.


NaN occurs in x.


The objective/constraint function returns NaN or nearly infinite values (only in the classical mode).


NaN occurs in the models.


Constraints are infeasible.

The exit flags 5, 6, 10, 11, and 12 are possible in the Fortran code but cannot be returned by pdfo or its solvers.

message: str

Message related to the exit condition flag. If options['quiet'] is set to True, this message will not be printed.

fun: float

Returns the computed objective function value at the solution x.

nfev: int

Number of function evaluations.

constrviolation: float

Constraint violation at the solution x. It is set to 0 if the problem is unconstrained.

fhist: ndarray, shape (nfev,)

History of the objective function evaluations performed during the computation. Its size is nfev and is ordered by iteration. Its minimum among the feasible point should be fun.

chist: ndarray, shape (nfev,)

History of the constraint violations computed during the computation. If the problem is unconstrained, chist is set to None.

constr_value: ndarray or list of ndarrays

Values of the constraint functions at the returned x. It can be one of the two cases below depending on how the constraints variable is specified at the input.

  1. If constraints is a dictionary or an instance of NonlinearConstraint or LinearConstraint, then constr_value is an ndarray, whose value is constraints['fun'](x), constraints.fun(x), or constraints.A * x.

  2. If constraints is a list of dictionaries or instances of NonlinearConstraint or LinearConstraint, then constr_value is a list of ndarrays described in 1, each of which is the value of the corresponding component in constraints.

If a nonlinear constraint is trivial (i.e., it has \(-\infty\) as lower bound and \(\infty\) as upper bound), then its is represented by NaN in constr_value, because such constraints are not evaluated during the computation. Trivial nonlinear constraints with unknown dimensions (for example, {'type': 'eq', 'fun': None} or NonlinearConstraint(fun, None, None)) are represented by empty arrays in constr_value.

method: str

The name of the method that was used to solve the problem.

constr_modified: bool

An indicator specifying if the constraints have been modified during the algorithm (LINCOA may modify the constraints if it cannot find a feasible starting point).

warnings: list

A recording of every warning raised during the computation.




fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.



pop(key[, default])

If the key is not found, return the default if given; otherwise, raise a KeyError.


Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]