Extended NLP Interface
- class pyomo.contrib.pynumero.interfaces.nlp.ExtendedNLP[source]
Bases:
NLP
This interface extends the NLP interface to support a presentation of the problem that separates equality and inequality constraints
- constraint_names()
Override this to provide string names for the constraints
- abstract constraints_lb()
Returns vector of lower bounds for the constraints
- Return type:
vector-like
- abstract constraints_ub()
Returns vector of upper bounds for the constraints
- Return type:
vector-like
- abstract create_new_vector(vector_type)[source]
Creates a vector of the appropriate length and structure as requested
- Parameters:
vector_type ({'primals', 'constraints', 'eq_constraints', 'ineq_constraints',) – ‘duals’, ‘duals_eq’, ‘duals_ineq’} String identifying the appropriate vector to create.
- Return type:
vector-like
- abstract evaluate_constraints(out=None)
Returns the values for the constraints evaluated at the values given for the primal variales in set_primals
- Parameters:
out (array_like, optional) – Output array. Its type is preserved and it must be of the right shape to hold the output.
- Return type:
vector_like
- abstract evaluate_eq_constraints(out=None)[source]
Returns the values for the equality constraints evaluated at the values given for the primal variales in set_primals
- Parameters:
out (array_like, optional) – Output array. Its type is preserved and it must be of the right shape to hold the output.
- Return type:
vector_like
- abstract evaluate_grad_objective(out=None)
Returns gradient of the objective function evaluated at the values given for the primal variables in set_primals
- Parameters:
out (vector_like, optional) – Output vector. Its type is preserved and it must be of the right shape to hold the output.
- Return type:
vector_like
- abstract evaluate_hessian_lag(out=None)
Return the Hessian of the Lagrangian function evaluated at the values given for the primal variables in set_primals and the dual variables in set_duals
- Parameters:
out (matrix_like (e.g., coo_matrix), optional) – Output matrix with the structure of the hessian already defined. Optional
- Return type:
matrix_like
- abstract evaluate_ineq_constraints(out=None)[source]
Returns the values of the inequality constraints evaluated at the values given for the primal variables in set_primals
- Parameters:
out (array_like, optional) – Output array. Its type is preserved and it must be of the right shape to hold the output.
- Return type:
vector_like
- abstract evaluate_jacobian(out=None)
Returns the Jacobian of the constraints evaluated at the values given for the primal variables in set_primals
- Parameters:
out (matrix_like (e.g., coo_matrix), optional) – Output matrix with the structure of the jacobian already defined.
- Return type:
matrix_like
- abstract evaluate_jacobian_eq(out=None)[source]
Returns the Jacobian of the equality constraints evaluated at the values given for the primal variables in set_primals
- Parameters:
out (matrix_like (e.g., coo_matrix), optional) – Output matrix with the structure of the jacobian already defined.
- Return type:
matrix_like
- abstract evaluate_jacobian_ineq(out=None)[source]
Returns the Jacobian of the inequality constraints evaluated at the values given for the primal variables in set_primals
- Parameters:
out (matrix_like (e.g., coo_matrix), optional) – Output matrix with the structure of the jacobian already defined.
- Return type:
matrix_like
- abstract evaluate_objective()
Returns value of objective function evaluated at the values given for the primal variables in set_primals
- Return type:
- abstract get_constraints_scaling()
Return the desired scaling factors to use for the for the constraints. None indicates no scaling. This indicates potential scaling for the model, but the evaluation methods should return unscaled values
- Return type:
array-like or None
- abstract get_duals()
Get a copy of the values of the dual variables as provided in set_duals. These are the values that will be used in calls to the evaluation methods.
- abstract get_duals_eq()[source]
Get a copy of the values of the dual variables of the equality constraints as provided in set_duals_eq. These are the values that will be used in calls to the evaluation methods.
- abstract get_duals_ineq()[source]
Get a copy of the values of the dual variables of the inequality constraints as provided in set_duals_eq. These are the values that will be used in calls to the evaluation methods.
- abstract get_eq_constraints_scaling()[source]
Return the desired scaling factors to use for the for the equality constraints. None indicates no scaling. This indicates potential scaling for the model, but the evaluation methods should return unscaled values
- Return type:
array-like or None
- abstract get_ineq_constraints_scaling()[source]
Return the desired scaling factors to use for the for the inequality constraints. None indicates no scaling. This indicates potential scaling for the model, but the evaluation methods should return unscaled values
- Return type:
array-like or None
- abstract get_obj_factor()
Get the value of the objective function factor as set by set_obj_factor. This is the value that will be used in calls to the evaluation of the hessian of the lagrangian (evaluate_hessian_lag)
- abstract get_obj_scaling()
Return the desired scaling factor to use for the for the objective function. None indicates no scaling. This indicates potential scaling for the model, but the evaluation methods should return unscaled values
- Return type:
float or None
- abstract get_primals()
Get a copy of the values of the primal variables as provided in set_primals. These are the values that will be used in calls to the evaluation methods
- abstract get_primals_scaling()
Return the desired scaling factors to use for the for the primals. None indicates no scaling. This indicates potential scaling for the model, but the evaluation methods should return unscaled values
- Return type:
array-like or None
- abstract ineq_lb()[source]
Returns vector of lower bounds for inequality constraints
- Return type:
vector-like
- abstract ineq_ub()[source]
Returns vector of upper bounds for inequality constraints
- Return type:
vector-like
- abstract init_duals()
Returns vector with initial values for the dual variables of the constraints
- abstract init_duals_eq()[source]
Returns vector with initial values for the dual variables of the equality constraints
- abstract init_duals_ineq()[source]
Returns vector with initial values for the dual variables of the inequality constraints
- abstract init_primals()
Returns vector with initial values for the primal variables
- abstract n_constraints()
Returns number of constraints
- abstract n_primals()
Returns number of primal variables
- abstract nnz_hessian_lag()
Returns number of nonzero values in hessian of the lagrangian function
- abstract nnz_jacobian()
Returns number of nonzero values in jacobian of equality constraints
- abstract nnz_jacobian_eq()[source]
Returns number of nonzero values in jacobian of equality constraints
- abstract nnz_jacobian_ineq()[source]
Returns number of nonzero values in jacobian of inequality constraints
- abstract primals_lb()
Returns vector of lower bounds for the primal variables
- Return type:
vector-like
- primals_names()
Override this to provide string names for the primal variables
- abstract primals_ub()
Returns vector of upper bounds for the primal variables
- Return type:
vector-like
- abstract report_solver_status(status_code, status_message)
Report the solver status to NLP class using the values for the primals and duals defined in the set methods
- abstract set_duals(duals)
Set the value of the dual variables for the constraints to be used in calls to the evaluation methods (hessian_lag)
- Parameters:
duals (vector_like) – Vector with the values of dual variables for the equality constraints
- abstract set_duals_eq(duals_eq)[source]
Set the value of the dual variables for the equality constraints to be used in calls to the evaluation methods (hessian_lag)
- Parameters:
duals_eq (vector_like) – Vector with the values of dual variables for the equality constraints
- abstract set_duals_ineq(duals_ineq)[source]
Set the value of the dual variables for the inequality constraints to be used in calls to the evaluation methods (hessian_lag)
- Parameters:
duals_ineq (vector_like) – Vector with the values of dual variables for the inequality constraints
- abstract set_obj_factor(obj_factor)
Set the value of the objective function factor to be used in calls to the evaluation of the hessian of the lagrangian (evaluate_hessian_lag)
- Parameters:
obj_factor (float) – Value of the objective function factor used in the evaluation of the hessian of the lagrangian
- abstract set_primals(primals)
Set the value of the primal variables to be used in calls to the evaluation methods
- Parameters:
primals (vector_like) – Vector with the values of primal variables.