jijzepttools.modeling.algorithm.dantzig_wolfe_decomposition.replace#
Functions#
replace expression with separated indices |
|
replace problem with indices with non-overlapped conditions |
|
replace overlap constraint with separated indices |
Module Contents#
- replace_expression_with_separated_indices(expr: jijzepttools.modeling.utils.type.Expr, disjoint_forall_holder: jijzepttools.modeling.algorithm.dantzig_wolfe_decomposition.utils.DisjointForallHolder, lambd: jijmodeling.Placeholder | None, forall: List[Tuple[jijmodeling.Element, jijzepttools.modeling.utils.type.Expr]], var_ref: List[jijmodeling.Subscript]) List[jijzepttools.modeling.utils.type.Expr] #
replace expression with separated indices the input expr is assume to be:
expression that containts only single type of decision variable
expression that is either a single term or SumOp term
this function returns a list of expressions that are separated by disjoint_forall_holder the strategy is as follows:
validate expr. if more than one decision variable is detected, raise ValueError
validate expr. if ProdOp is detected, raise ValueError
- Parameters:
expr (Expr) – expression to be replaced
disjoint_forall_holder (DisjointForallHolder) – disjoint forall holder
lambd (tp.Optional[jm.Placeholder]) – lambda placeholder.
forall (tp.List[tp.Tuple[jm.Element, Expr]]) – forall indices.
var_ref (tp.List[jm.Subscript]) – variable references.
- Returns:
replaced expressions
- Return type:
tp.List[Expr]
- replace_problem_with_separated_indices(problem: jijmodeling.Problem, disjoint_forall_holder: jijzepttools.modeling.algorithm.dantzig_wolfe_decomposition.utils.DisjointForallHolder, constraint_prefix: str, separable_exprs: List[jijzepttools.modeling.utils.type.Expr], manual_replace: Dict[str, Tuple[List[List[Tuple[jijmodeling.Element, jijzepttools.modeling.utils.type.Expr]] | None], List[Tuple[jijmodeling.Element, jijzepttools.modeling.utils.type.Expr]] | None]]) Tuple[jijmodeling.Problem, Tuple[List[List[str]], List[str]]] #
replace problem with indices with non-overlapped conditions
- Parameters:
problem (jm.Problem) – problem to be replaced
disjoint_forallconditions (tp.List[tp.List[Expr]]) – list of disjoint forall. Note that each condition must be a disjoint condition (no overlapped elements).
constraint_prefix (str) – prefix of constraint name
separable_exprs (tp.List[Expr]) – separable expressions
manual_replace (tp.Dict[str, tp.Tuple[tp.List[tp.List[tp.Tuple[jm.Element, Expr]]], tp.List[tp.List[tp.Tuple[jm.Element, Expr]]]]], optional) – manual replace. Defaults to {}.
- Returns:
replaced problem and replaced constraint names. The first element of the tuple is a list of separable constraints. The second element of the tuple is a list of overlapped constraints.
- Return type:
tp.Tuple[jm.Problem, tp.Tuple[tp.List[tp.List[str]], tp.List[str]]]
- replace_overlapped_constraint(constraint: jijmodeling.Constraint, overlapped_forall_list: List[List[Tuple[jijmodeling.Element, jijzepttools.modeling.utils.type.Expr]]]) List[jijmodeling.Constraint] #
replace overlap constraint with separated indices
- Parameters:
constraint (jm.Constraint) – constraint to be replaced
forall_list (tp.List[tp.List[tp.Tuple[jm.Element, Expr]]]) – list of forall indices
- Returns:
replaced constraints
- Return type:
tp.List[jm.Constraint]