jijzepttools.modeling.replace.constraint#
Functions#
|
replace constraint with replacer. |
|
replace lhs and rhs of constraint using replacer |
|
move decision variable to left |
set constraint expression to less than equal |
Module Contents#
- replace_constraint(constraint: jijmodeling.Constraint, replacer: Callable[[jijzepttools.modeling.utils.type.Expr], jijzepttools.modeling.utils.type.Expr], constraint_name: str | None = None, overwrite_cond: Literal['>=', '<=', '=='] | None = None) jijmodeling.Constraint #
replace constraint with replacer.
- Parameters:
constraint (jm.Constraint) – constraint to be replaced
replacer (tp.Callable[[Expr], Expr]) – replacer
constraint_name (tp.Optional[str], optional) – new constraint name. Defaults to None.
overwrite_cond (tp.Optional[str], optional) – new condition operator. Defaults to None.
- replace_lhs_and_rhs_of_constraint(constraint: jijmodeling.Constraint, new_lhs: jijzepttools.modeling.utils.type.Expr, new_rhs: jijzepttools.modeling.utils.type.Expr, constraint_name: str | None = None, overwrite_cond: Literal['>=', '<=', '=='] | None = None) jijmodeling.Constraint #
replace lhs and rhs of constraint using replacer
- Parameters:
constraint (jm.Constraint) – constraint to be replaced
new_lhs (Expr) – new lhs
new_rhs (Expr) – new rhs
constraint_name (tp.Optional[str], optional) – new constraint name. Defaults to None.
- move_decision_variable_to_left(constraint: jijmodeling.Constraint, constraint_name: str | None = None) jijmodeling.Constraint #
move decision variable to left
- Parameters:
constraint (jm.Constraint) – constraint to be moved
constraint_name (tp.Optional[str], optional) – new constraint name. Defaults to None.
- Returns:
moved constraint
- Return type:
jm.Constraint
- set_constraint_expr_less_than_equal(constraint: jijmodeling.Constraint, constraint_name: str | None = None) jijmodeling.Constraint #
set constraint expression to less than equal If the constraint is a >= b, then the constraint is replaced with -a <= -b. Othewise, the constraint is kept intact.
- Parameters:
constraint (jm.Constraint) – constraint to be set
constraint_name (tp.Optional[str], optional) – new constraint name. Defaults to None.
- Returns:
set constraint
- Return type:
jm.Constraint