decogo.model.block_model¶
Main module for storing model data.
Classes
|
This class stores sub-models and cut pool. |
|
This class takes Pyomo model and stores sub-models and cut pool derived from the Pyomo model. |
- class decogo.model.block_model.BlockModel(blocks, sense, cuts, sub_models)[source]¶
This class stores sub-models and cut pool.
- Parameters:
blocks (list) – List (block-wise) of original string names of variables
sense (int) – Indicates the the problem is minimization (1) or maximization (-1)
cuts (PyomoCutPool) – Container which stores all linear constraints (global and local) and objective function
sub_models (list) – List of sub-models
- get_non_zero_resources()[source]¶
Determines the indices of nonzero resources blockwise, i.e. checks whether left-hand side of the coupling constraints is nonzero, i.e. \(A_k \neq 0\)
- Returns:
indices of nonzero resources of nonzero
- Return type:
dict
- eval_viol_lin_global_constraints(point)[source]¶
Evaluates the violation of global linear constraints, see
model.constraints.PyomoCutPool.evaluate_violation_global_constraints()
- trans_into_orig_space(block_id, direction)[source]¶
Computes \(d_k^TA_k, d_k \in \mathbb{R}^{m+1}\), where \(m\) is the number of global constraints
- Parameters:
block_id (int) – Block identifier
direction (list or ndarray) – Array with dimension \(m+1\), where \(m\) is the number of global constraints
- Returns:
An array with the dimension of \(n_k\), where \(n_k\) is size of the k-th block
- Return type:
ndarray
- trans_into_im_space(block_id, point)[source]¶
Compute \(w=A_kx_k\), where \(x_k \in \mathbb{R}^{n_k}\)
- Parameters:
block_id (int) – Block identifier
point (ndarray) – Point in the original space
- Returns:
Point w in the image space, i.e. \(w \in \mathbb{R}^{m+1}\)
- Return type:
ndarray
- num_nonzero_m_k(block_id)[source]¶
Compute \(w=A_kx_k\), where \(x_k \in \mathbb{R}^{n_k}\)
- Parameters:
block_id (int) – Block identifier
point (ndarray) – Point in the original space
- Returns:
Point w in the image space, i.e. \(w \in \mathbb{R}^{m+1}\)
- Return type:
ndarray
- class decogo.model.block_model.PyomoBlockModel(model, blocks, sense)[source]¶
This class takes Pyomo model and stores sub-models and cut pool derived from the Pyomo model.
- Parameters:
model (ConcreteModel) – Input Pyomo model
blocks (list) – List (block-wise) of original string names of variables
sense (int) – Indicates the the problem is minimization (1) or maximization (-1)
- update_var_lower_bound(new_lower_bound, index)[source]¶
Updates the lower bound of the variable with the given index
- update_var_upper_bound(new_upper_bound, index)[source]¶
Updates the upper bound of the variable with the given index
- max_violation_nonlinear_constraints(x)[source]¶
Determines if the solution is feasible regarding the nonlinear constraints by computing the maximum violation
- Parameters:
x (BlockVector) – Given point
- Returns:
Maximum violation and index of most violated constraint as tuple (viol, block_id, index)
- Return type:
tuple