PyomoGreyBoxNLP

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

class pyomo.contrib.pynumero.interfaces.pyomo_nlp.PyomoGreyBoxNLP(pyomo_model)[source]

Bases: NLP

__init__(pyomo_model)[source]

Methods

__init__(pyomo_model)

constraint_names()

Override this to provide string names for the constraints

constraints_lb()

Returns vector of lower bounds for the constraints

constraints_ub()

Returns vector of upper bounds for the constraints

create_new_vector(vector_type)

Creates a vector of the appropriate length and structure as requested

evaluate_constraints([out])

Returns the values for the constraints evaluated at the values given for the primal variales in set_primals

evaluate_eq_constraints([out])

evaluate_grad_objective([out])

Returns gradient of the objective function evaluated at the values given for the primal variables in set_primals

evaluate_hessian_lag([out])

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

evaluate_jacobian([out])

Returns the Jacobian of the constraints evaluated at the values given for the primal variables in set_primals

evaluate_objective()

Returns value of objective function evaluated at the values given for the primal variables in set_primals

get_constraints_scaling()

Return the desired scaling factors to use for the for the constraints.

get_duals()

Get a copy of the values of the dual variables as provided in set_duals.

get_duals_eq()

get_obj_factor()

Get the value of the objective function factor as set by set_obj_factor.

get_obj_scaling()

Return the desired scaling factor to use for the for the objective function.

get_primals()

Get a copy of the values of the primal variables as provided in set_primals.

get_primals_scaling()

Return the desired scaling factors to use for the for the primals.

get_pyomo_constraints()

Return an ordered list of the Pyomo ConData objects in the order corresponding to the primals

get_pyomo_objective()

Return an instance of the active objective function on the Pyomo model.

get_pyomo_variables()

Return an ordered list of the Pyomo VarData objects in the order corresponding to the primals

init_duals()

Returns vector with initial values for the dual variables of the constraints

init_duals_eq()

init_primals()

Returns vector with initial values for the primal variables

load_state_into_pyomo([bound_multipliers])

n_constraints()

Returns number of constraints

n_eq_constraints()

n_ineq_constraints()

n_primals()

Returns number of primal variables

nnz_hessian_lag()

Returns number of nonzero values in hessian of the lagrangian function

nnz_jacobian()

Returns number of nonzero values in jacobian of equality constraints

nnz_jacobian_eq()

primals_lb()

Returns vector of lower bounds for the primal variables

primals_names()

Override this to provide string names for the primal variables

primals_ub()

Returns vector of upper bounds for the primal variables

pyomo_model()

Return optimization model

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

set_duals(duals)

Set the value of the dual variables for the constraints to be used in calls to the evaluation methods (hessian_lag)

set_duals_eq(duals)

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)

set_primals(primals)

Set the value of the primal variables to be used in calls to the evaluation methods

variable_names()

DEPRECATED.

Member Documentation

constraint_names()[source]

Override this to provide string names for the constraints

constraints_lb()[source]

Returns vector of lower bounds for the constraints

Return type:

vector-like

constraints_ub()[source]

Returns vector of upper bounds for the constraints

Return type:

vector-like

create_new_vector(vector_type)[source]

Creates a vector of the appropriate length and structure as requested

Parameters:

vector_type ({'primals', 'constraints', 'duals'}) – String identifying the appropriate vector to create.

Return type:

vector-like

evaluate_constraints(out=None)[source]

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

evaluate_grad_objective(out=None)[source]

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

evaluate_hessian_lag(out=None)[source]

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

evaluate_jacobian(out=None)[source]

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

evaluate_objective()[source]

Returns value of objective function evaluated at the values given for the primal variables in set_primals

Return type:

float

get_constraints_scaling()[source]

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

get_duals()[source]

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.

get_obj_factor()[source]

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)

get_obj_scaling()[source]

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

get_primals()[source]

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

get_primals_scaling()[source]

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

get_pyomo_constraints()[source]

Return an ordered list of the Pyomo ConData objects in the order corresponding to the primals

get_pyomo_objective()[source]

Return an instance of the active objective function on the Pyomo model. (there can be only one)

get_pyomo_variables()[source]

Return an ordered list of the Pyomo VarData objects in the order corresponding to the primals

init_duals()[source]

Returns vector with initial values for the dual variables of the constraints

init_primals()[source]

Returns vector with initial values for the primal variables

n_constraints()[source]

Returns number of constraints

n_primals()[source]

Returns number of primal variables

nnz_hessian_lag()[source]

Returns number of nonzero values in hessian of the lagrangian function

nnz_jacobian()[source]

Returns number of nonzero values in jacobian of equality constraints

primals_lb()[source]

Returns vector of lower bounds for the primal variables

Return type:

vector-like

primals_names()[source]

Override this to provide string names for the primal variables

primals_ub()[source]

Returns vector of upper bounds for the primal variables

Return type:

vector-like

pyomo_model()[source]

Return optimization model

report_solver_status(status_code, status_message)[source]

Report the solver status to NLP class using the values for the primals and duals defined in the set methods

set_duals(duals)[source]

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

set_obj_factor(obj_factor)[source]

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

set_primals(primals)[source]

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.

variable_names()[source]

DEPRECATED.

Deprecated since version 6.0.0: This method has been replaced with primals_names (will be removed in (or after) 6.0)