CyIpoptProblemInterface

(class from pyomo.contrib.pynumero.interfaces.cyipopt_interface)

class pyomo.contrib.pynumero.interfaces.cyipopt_interface.CyIpoptProblemInterface[source]

Bases: object

Abstract subclass of cyipopt.Problem defining an object that can be used as an interface to CyIpopt. Subclasses must define all methods necessary for the CyIpopt solve and must call this class’s __init__ method to initialize Ipopt’s data structures.

Note that, if “output_file” is provided as an Ipopt option, the log file is open until this object (and thus the underlying Ipopt NLP object) is deallocated. To force this deallocation, call the close() method, which is defined by cyipopt.Problem.

__init__()[source]

Initialize the problem interface

This method calls cyipopt.Problem.__init__, and must be called by any subclass’s __init__ method. If not, we will segfault when we call cyipopt.Problem.solve from this object.

Methods

__init__()

Initialize the problem interface

constraints(x)

Return the residuals of the constraints evaluated at x as a numpy ndarray

g_lb()

Return the lower bounds on the constraints as a numpy ndarray

g_ub()

Return the upper bounds on the constraints as a numpy ndarray

gradient(x)

Return the gradient of the objective function evaluated at x as a numpy ndarray

hessian(x, y, obj_factor)

Return the values for the hessian evaluated at x as a numpy ndarray of nonzero values corresponding to the rows and columns specified in the hessianstructure method.

hessianstructure()

Return the structure of the hessian in coordinate format.

intermediate(alg_mod, iter_count, obj_value, ...)

Callback that can be used to examine or report intermediate results.

jacobian(x)

Return the values for the jacobian evaluated at x as a numpy ndarray of nonzero values corresponding to the rows and columns specified in the jacobianstructure

jacobianstructure()

Return the structure of the jacobian in coordinate format.

objective(x)

Return the value of the objective function evaluated at x

scaling_factors()

Return the values for scaling factors as a tuple (objective_scaling, x_scaling, g_scaling).

solve(x[, lagrange, zl, zu])

Solve a CyIpopt Problem

x_init()

Return the initial values for x as a numpy ndarray

x_lb()

Return the lower bounds on x as a numpy ndarray

x_ub()

Return the upper bounds on x as a numpy ndarray

Member Documentation

abstract constraints(x)[source]

Return the residuals of the constraints evaluated at x as a numpy ndarray

abstract g_lb()[source]

Return the lower bounds on the constraints as a numpy ndarray

abstract g_ub()[source]

Return the upper bounds on the constraints as a numpy ndarray

abstract gradient(x)[source]

Return the gradient of the objective function evaluated at x as a numpy ndarray

abstract hessian(x, y, obj_factor)[source]

Return the values for the hessian evaluated at x as a numpy ndarray of nonzero values corresponding to the rows and columns specified in the hessianstructure method. Note: return ONLY the lower diagonal of this symmetric matrix.

abstract hessianstructure()[source]

Return the structure of the hessian in coordinate format. That is, return (rows,cols) where rows and cols are both numpy ndarray objects that contain the row and column indices for each of the nonzeros in the hessian. Note: return ONLY the lower diagonal of this symmetric matrix.

intermediate(alg_mod, iter_count, obj_value, inf_pr, inf_du, mu, d_norm, regularization_size, alpha_du, alpha_pr, ls_trials)[source]

Callback that can be used to examine or report intermediate results. This method is called each iteration

abstract jacobian(x)[source]

Return the values for the jacobian evaluated at x as a numpy ndarray of nonzero values corresponding to the rows and columns specified in the jacobianstructure

abstract jacobianstructure()[source]

Return the structure of the jacobian in coordinate format. That is, return (rows,cols) where rows and cols are both numpy ndarray objects that contain the row and column indices for each of the nonzeros in the jacobian.

abstract objective(x)[source]

Return the value of the objective function evaluated at x

abstract scaling_factors()[source]

Return the values for scaling factors as a tuple (objective_scaling, x_scaling, g_scaling). Return None if the scaling factors are to be ignored

solve(x, lagrange=None, zl=None, zu=None)[source]

Solve a CyIpopt Problem

Checks whether __init__ has been called before calling cyipopt.Problem.solve

abstract x_init()[source]

Return the initial values for x as a numpy ndarray

abstract x_lb()[source]

Return the lower bounds on x as a numpy ndarray

abstract x_ub()[source]

Return the upper bounds on x as a numpy ndarray