CyIpoptNLP
(class from pyomo.contrib.pynumero.interfaces.cyipopt_interface)
- class pyomo.contrib.pynumero.interfaces.cyipopt_interface.CyIpoptNLP(nlp, intermediate_callback=None, halt_on_evaluation_error=None)[source]
Bases:
CyIpoptProblemInterface- __init__(nlp, intermediate_callback=None, halt_on_evaluation_error=None)[source]
This class provides a CyIpoptProblemInterface for use with the CyIpoptSolver class that can take in an NLP as long as it provides vectors as numpy ndarrays and matrices as scipy.sparse.coo_matrix objects. This class provides the interface between AmplNLP or PyomoNLP objects and the CyIpoptSolver
Methods
__init__(nlp[, intermediate_callback, ...])This class provides a CyIpoptProblemInterface for use with the CyIpoptSolver class that can take in an NLP as long as it provides vectors as numpy ndarrays and matrices as scipy.sparse.coo_matrix objects.
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.
Return the structure of the hessian in coordinate format.
intermediate(alg_mod, iter_count, obj_value, ...)Calls user's intermediate callback
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
Return the structure of the jacobian in coordinate format.
objective(x)Return the value of the objective function evaluated at x
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
- gradient(x)[source]
Return the gradient of the objective function evaluated at x as a numpy ndarray
- 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.
- 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]
Calls user’s intermediate callback
This method has the call signature expected by CyIpopt. We then extend this call signature to provide users of this interface class additional functionality. Additional arguments are:
The
NLPobject that was used to construct this class instance. This is useful for querying the variables, constraints, and derivatives during the callback.The class instance itself. This is useful for calling the
get_current_iterateandget_current_violationsmethods, which query Ipopt’s internal data structures to provide this information.
- 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
- 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.
- 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)
Solve a CyIpopt Problem
Checks whether __init__ has been called before calling cyipopt.Problem.solve