decogo.pyomo_problem.pyomo_decomposed_problem

Main module for managing block model and approximation data for Pyomo models.

Classes

PyomoDecomposedProblem(block_model, strategy)

This class contains all sub-problems, master problems and approximation data and methods for manipulating them (add, update etc.)

class decogo.pyomo_problem.pyomo_decomposed_problem.PyomoDecomposedProblem(block_model, strategy)[source]

This class contains all sub-problems, master problems and approximation data and methods for manipulating them (add, update etc.)

Parameters:
  • block_model (BlockModel) – Block model

  • approx_data (ApproxData) – Approximation data class (Inner points, linearization cuts, etc.)

__init__(block_model, strategy)[source]

Constructor method

add_linear_local_constraint(block_id, lhs, relation, rhs)[source]

Adds a new valid local linear constraint to block model cut pool and to the sub-problems

Parameters:
  • block_id (int) – Block identifier

  • lhs (ndarray) – Left hand side of the constraint

  • relation (str) – Relation of the constraint \(\leq, \geq, =\)

  • rhs (float) – Right hand side of the constraint

add_compact_lin_local_constr(block_id, lhs, relation, rhs)[source]

Adds valid compact linear cut to master problems and to the container, see problem.approx_data.ApproxData.add_compact_cut()

update_var_lower_bound(new_lower_bound, index)[source]

Updates the lower bound of the given variable at block model and Pyomo models

Parameters:
  • new_lower_bound (float) – New lower bound

  • index (tuple) – Index of the variable as tuple (block_id, index)

update_var_upper_bound(new_upper_bound, index)[source]

Updates the upper bound of the given variable at block model and Pyomo models

Parameters:
  • new_upper_bound (float) – New lower bound

  • index (tuple) – Index of the variable as tuple (block_id, index)

compute_gradients()[source]

Computes gradients of the nonlinear constraints (used by OA solver)

add_linearization_cuts(y, eps, x=None, block_id=None)[source]

Adds the linearization cuts to Pyomo models and to the list of cuts, see problem.approx_data.ApproxData.add_linearization_cuts()

Parameters:
  • y (BlockVector or ndarray) – Linearization point

  • eps (float) – Accuracy for defining the active constraints

  • x (BlockVector or ndarray or None) – Solution of OA relaxation

  • block_id (int or None) – Block identifier

Returns:

Number of new added cuts

Return type:

int

add_inner_point(block_id, point, min_inner_point_dist=None)[source]

Adds an inner point to the list of points and updates corresponding master problems, see problem.approx_data.ApproxData.add_inner_point()

get_min_inner_point(block_id, direction)[source]

Gets inner point with respect to the minimum value computed with some direction in original space, see problem.approx_data.ApproxData.get_min_inner_point()

get_min_column(block_id, direction)[source]

Gets column with respect to the minimum value computed with some direction in image space, see problem.approx_data.ApproxData.get_min_column()

get_inner_points_size(block_id)[source]

Gets inner points size, see problem.approx_data.ApproxData.get_inner_points_size()

max_viol_nonlin_constr(x)[source]

Determines if the solution is feasible regarding the nonlinear constraints by computing the maximum violation, see model.block_model.BlockModel.max_violation_nonlinear_constraints()

eval_viol_lin_global_constraints(point)[source]

Evaluates the violation of global linear constraints, see model.block_model.BlockModel.evaluate_violation_linear_global_constraints()

round(block_id, point)[source]

Rounds point to the closest integer, see model.block_model.BlockModel.round()