decogo.pyomo_problem.subproblem

This module implements and manages all sub-problems of Pyomo models

Classes

PyomoLineSearchSubProblem(block_model, block_id)

This class defines line search sub-problem between exterior point \(x_k^{ext}\) and interior point \(x_k^{int}\)

PyomoMinlpSubProblem(block_model, block_id)

A class for defining the following sub-problem

PyomoProjectionSubProblem(block_model, block_id)

A class for defining a projection sub-problem

PyomoResourceProjectionSubProblem(...)

A class for defining a projection sub-problem

PyomoSubProblemBase(block_model, block_id)

A base class for construction of Pyomo model.

PyomoSubProblems(block_model, block_id)

A container class for managing all sub-problems

class decogo.pyomo_problem.subproblem.PyomoSubProblemBase(block_model, block_id)[source]

A base class for construction of Pyomo model. Here are implemented methods for creating local linear and nonlinear constraints

Parameters
  • block_model (PyomoBlockModel) – Block model

  • block_id (int) – Block identifier

__init__(block_model, block_id)[source]

Constructor method

solve(solver_name, start_point=None, solver_options=None)[source]

Base method for calling the external solver to solve the model

Parameters
  • solver_name (str) – External solver name

  • start_point (ndaray or None) – Starting point for the solver, defaults to None

  • solver_options (list) – Options for external solver, defaults to None

Returns

Solution point, primal bound, dual bound, flag if the primal bound is feasible

Return type

tuple

add_linear_constraint()[source]

Adds new linear constraint

set_nlp()[source]

Relaxes integer varaibles to continious

unset_nlp()[source]

Sets to integer type for the variables which are integer in the original formulation

update_var_lower_bound(index)[source]

Updates the lower bound of the variable. The value is taken form the BlockModel

Parameters

index (tuple) – Index (block_id, index)

update_var_upper_bound(index)[source]

Updates the upper bound of the variable. The value is taken form the BlockModel

Parameters

index (tuple) – Index (block_id, index)

fix_integers(x)[source]

Fixes integer variables with given value

Parameters

x (ndarray) – Given array

unfix_integers()[source]

Unfixes all integer variables

add_objective()[source]

Sets default objective function, i.e. \(c_k^Tx_k\), where \(c_k\) - partial objective from the original model

set_objective(direction)[source]

Sets the objective function with given direction vector

Parameters

direction (ndarray) – Given vector

class decogo.pyomo_problem.subproblem.PyomoMinlpSubProblem(block_model, block_id)[source]

A class for defining the following sub-problem

\[\begin{equation} \begin{split} \min \ &d_k^Ty_k, \newline &y_k \in X_k, d_k \in \mathbb{R}^{n_k} \end{split} \end{equation}\]
Parameters
  • block_model (PyomoBlockModel) – Block model

  • block_id (int) – Block identifier

__init__(block_model, block_id)[source]

Constructor method

class decogo.pyomo_problem.subproblem.PyomoProjectionSubProblem(block_model, block_id)[source]

A class for defining a projection sub-problem

\[\begin{equation} \begin{split} \min \ &||y_k-x_k||^2,\newline &y_k \in G_k, x_k \text{ is fixed} \end{split} \end{equation}\]
Parameters
  • block_model (PyomoBlockModel) – Block model

  • block_id (int) – Block identifier

__init__(block_model, block_id)[source]

Constructor method

obj_rule()[source]

Defines the objective function

Returns

Objective expression

Return type

Expression

set_projection_point(point_to_project)[source]

Sets projection point, i.e. \(x_k\)

Parameters

point_to_project (ndarray) – Projection point

class decogo.pyomo_problem.subproblem.PyomoResourceProjectionSubProblem(block_model, block_id)[source]

A class for defining a projection sub-problem

\[\begin{equation} \begin{split} \min \ &||A_kx_k - w_k||^2,\newline &y_k \in G_k, w_k \text{ is fixed} \end{split} \end{equation}\]
Parameters
  • block_model (PyomoBlockModel) – Block model

  • block_id (int) – Block identifier

__init__(block_model, block_id)[source]

Constructor method

obj_rule()[source]

Defines the objective function

Returns

Objective expression

Return type

Expression

set_projection_point(point_to_project)[source]

Sets projection point, i.e. \(w_k\)

Parameters

point_to_project (ndarray) – Projection point

class decogo.pyomo_problem.subproblem.PyomoLineSearchSubProblem(block_model, block_id)[source]

This class defines line search sub-problem between exterior point \(x_k^{ext}\) and interior point \(x_k^{int}\)

\[\begin{equation} \begin{split} \max \ & \alpha, \newline &y_k = \alpha x_k^{ext} + (1 - \alpha) x_k^{int}, \newline &y_k \in X_k \end{split} \end{equation}\]
Parameters
  • block_model (PyomoBlockModel) – Block model

  • block_id (int) – Block identifier

__init__(block_model, block_id)[source]

Constructor method

set_interior_exterior_points(exterior_point, interior_point)[source]

Sets values of two endpoints

Parameters
  • exterior_point (ndarray) – Exterior point

  • interior_point (ndarray) – Interior point

solve(solver_name, start_point=None, solver_options=None)[source]

Solves the subproblem and gets value of \(\alpha\). For more info, see base method SubProblemBase.solve()

class decogo.pyomo_problem.subproblem.PyomoSubProblems(block_model, block_id)[source]

A container class for managing all sub-problems

Parameters
  • minlp_sub_problem (PyomoMinlpSubProblem) – Sub-probem with linear objective

  • proj_sub_problem (PyomoProjectionSubProblem) – Pure projection sub-problem

  • resource_constrained_sub_problem (PyomoResourceConstrainedSubProblem) – Resource constrained sub-problem for checking the feasibility of the resources

  • line_search_sub_problem (PyomoLineSearchSubProblem) – Line search sub-problem

  • block_model (PyomoBlockModel) – Block model

  • block_id (int) – Block identifier

__init__(block_model, block_id)[source]

Constructor method

minlp_solve(solver_name, solver_options=None, start_point=None, direction=None, cell=None)[source]

Solves MinlpSubProblem

Parameters
  • solver_name (str) – External solver name

  • solver_options (list or None) – External solver options, defaults to None

  • start_point (ndarray or None) – Staring point for the solver, defaults to None

  • direction (ndarray or None) – Direction for the objective, defaults to None

  • cell (Cell or None) – Cell, defaults to None

Returns

Solution point, primal and dual bound

Return type

tuple

fixed_minlp_solve(solver_name, start_point, solver_options=None, direction=None, cell=None)[source]

Solves MinlpSubProblem with fixed integer variables

Parameters
  • solver_name (str) – External solver name

  • start_point (ndarray or None) – Staring point for the solver, and point which is used for fixing the integers

  • solver_options (list or None) – External solver options, defaults to None

  • direction (ndarray or None) – Direction for the objective, defaults to None

  • cell (Cell or None) – Cell, defaults to None

Returns

Solution point, primal and dual bound

Return type

tuple

nlp_proj_solve(solver_name, point_to_project, start_point=None)[source]

Solves ProjSubProblem

Parameters
  • solver_name (str) – External solver name

  • point_to_project (ndarray) – Projection point

  • start_point (ndarray or None) – Staring point for the solver, defaults to None

Returns

Solution point, primal bound and flag indicating the feasibility of primal solution

Return type

tuple

resource_proj_solve(solver_name, point_to_project, solver_options=None, start_point=None)[source]

Solves ResourceProjSubProblem

Parameters
  • solver_name (str) – External solver name

  • point_to_project (ndarray) – Projection point

  • start_point (ndarray or None) – Staring point for the solver, defaults to None

Returns

Solution point, primal bound and flag indicating the feasibility of primal solution

Return type

tuple

solve_line_search_subproblem(solver_name, exterior_point, interior_point)[source]

Solves LineSearchSubProblem

Parameters
  • solver_name (str) – External solver name

  • exterior_point (ndarray) – Exterior point

  • interior_point (ndarray) – Interior point

Returns

value of parameter \(\alpha\) and solution point

Return type

tuple

add_linear_constraint()[source]

Adds linear constraints to sub-problems

update_var_lower_bound(index)[source]

Updates the lower bound of variable by index

Parameters

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

update_var_upper_bound(index)[source]

Updates the upper bound of variable by index

Parameters

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