PyomoExternalCyIpoptProblem

(类来自 pyomo.contrib.pynumero.algorithms.solvers.pyomo_ext_cyipopt)

class pyomo.contrib.pynumero.algorithms.solvers.pyomo_ext_cyipopt.PyomoExternalCyIpoptProblem(pyomo_model, ex_input_output_model, inputs, outputs, outputs_eqn_scaling=None, nl_file_options=None)[源代码]

基础:CyIpoptProblemInterface

__init__(pyomo_model, ex_input_output_model, inputs, outputs, outputs_eqn_scaling=None, nl_file_options=None)[source]

创建此类的实例以作为问题传递给CyIpopt。

Parameters:
  • pyomo_model (ConcreteModel) – 表示问题的Pyomo部分的ConcreteModel。此模型必须包含输入和输出的Pyomo变量。

  • ex_input_output_model (ExternalInputOutputModel) – 一个派生类(来自ExternalInputOutputModel)的实例,提供计算输出和导数的方法。

  • inputs (list of Pyomo variables (VarData)) – Pyomo模型需要有变量来表示外部模型的输入。这是这些输入变量的列表,顺序与set_inputs调用中提供的input_values向量相对应。

  • 输出 (list of Pyomo 变量 (VarData)) – Pyomo 模型需要有变量来表示外部模型的输出。这是这些输出变量的列表,其顺序与从 evaluate_outputs 调用返回的 numpy 数组相对应。

  • outputs_eqn_scaling (listarray-likeNone) – 这设置了为生成的附加输出方程的缩放参数的值。如果设置为None,则不进行缩放。

方法

__init__(pyomo_model, ex_input_output_model, ...)

创建此类的实例以作为问题传递给CyIpopt。

constraints(primals)

返回在x处评估的约束残差作为numpy ndarray

g_lb()

返回约束的下界作为numpy ndarray

g_ub()

返回约束的上界作为numpy ndarray

gradient(primals)

返回在x处评估的目标函数的梯度,作为numpy ndarray

hessian(x, y, obj_factor)

返回在x处评估的hessian值,作为与hessianstructure方法中指定的行和列对应的非零值的numpy ndarray。

hessianstructure()

返回Hessian矩阵在坐标格式中的结构。

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

可用于检查或报告中间结果的回调。

jacobian(primals)

返回在x处评估的雅可比矩阵的值,作为与雅可比结构中指定的行和列对应的非零值的numpy ndarray

jacobianstructure()

返回雅可比矩阵在坐标格式中的结构。

load_x_into_pyomo(primals)

使用此方法将值的numpy数组加载到相应的Pyomo变量中(例如,来自CyIpopt的解决方案)

objective(primals)

返回在x处评估的目标函数的值

scaling_factors()

返回缩放因子的值作为一个元组 (objective_scaling, x_scaling, g_scaling)。

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

解决一个CyIpopt问题

x_init()

返回x的初始值作为numpy ndarray

x_lb()

返回x的下界作为numpy ndarray

x_ub()

返回x的上界作为numpy ndarray

成员文档

constraints(primals)[source]

返回在x处评估的约束残差作为numpy ndarray

g_lb()[源代码]

返回约束的下界作为numpy ndarray

g_ub()[source]

返回约束的上界作为numpy ndarray

gradient(primals)[source]

返回在x处评估的目标函数的梯度,作为numpy ndarray

hessian(x, y, obj_factor)[source]

返回在x处评估的hessian值,作为与hessianstructure方法中指定的行和列对应的非零值的numpy ndarray。 注意:仅返回此对称矩阵的下对角线。

hessianstructure()[source]

返回Hessian矩阵的结构 以坐标格式。即返回(rows, cols) 其中rows和cols都是numpy ndarray 对象,包含Hessian矩阵中每个非零元素的 行和列索引。 注意:仅返回此对称矩阵的下对角线部分。

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

可用于检查或报告中间结果的回调函数。此方法在每次迭代时调用。

jacobian(primals)[source]

返回在x处评估的雅可比矩阵的值,作为对应于雅可比结构中指定的行和列的非零值的numpy ndarray

jacobianstructure()[source]

返回雅可比矩阵的结构 以坐标格式。即返回 (rows, cols) 其中 rows 和 cols 都是 numpy ndarray 对象,包含雅可比矩阵中每个非零元素的行和列索引。

load_x_into_pyomo(primals)[source]

使用此方法将值的numpy数组加载到相应的Pyomo变量中(例如,来自CyIpopt的解决方案)

Parameters:

primals (numpy array) – 将提供给Pyomo变量的值数组。此数组的顺序与内部创建的PyomoNLP中的顺序相同。

objective(primals)[源代码]

返回在x处评估的目标函数的值

scaling_factors()[source]

返回缩放因子的值作为一个元组 (objective_scaling, x_scaling, g_scaling)。如果缩放因子被忽略,则返回 None

solve(x, lagrange=None, zl=None, zu=None)

解决一个CyIpopt问题

检查在调用 cyipopt.Problem.solve 之前是否已经调用了 __init__

x_init()[source]

返回x的初始值作为numpy ndarray

x_lb()[source]

返回x的下界作为numpy ndarray

x_ub()[source]

返回x的上界作为numpy ndarray