jijzepttools.modeling.replace.problem#
Functions#
|
Replace the expressions in the problem with the given replacer. |
|
generate always feasible problem from the given problem |
|
Generate Phase 1 always feasible problem with slack-only objective. |
Generate Phase 1 always feasible problem with slack-only objective (forall version). |
|
generate always feasible problem from the given problem |
Module Contents#
- replace_problem(problem: jijmodeling.Problem, replacer: Callable[[jijzepttools.modeling.utils.type.Expr], jijzepttools.modeling.utils.type.Expr], problem_name: str | None = None) jijmodeling.Problem#
Replace the expressions in the problem with the given replacer.
- Parameters:
problem (jm.Problem) – problem to be transformed
replacer (tp.Callable[[Expr], Expr]) – function to replace the expressions
- Returns:
problem with replaced expressions
- Return type:
jm.Problem
- generate_always_feasible_problem(problem: jijmodeling.Problem, slack_var_1_prefix: str = 'v', slack_var_2_prefix: str = 'w', big_m_prefix: str = 'bigM', bound=1000000, exclude_constraints: List[str] | None = None) jijmodeling.Problem#
generate always feasible problem from the given problem This function generates a new problem with slack variables for each constraints and penalty term to the objective function. This problem is always feasible owing to the slack variables unless the lower/upper bound of the slack variables is too small.
- Parameters:
problem (jm.Problem) – problem to be transformed
slack_var_1_prefix (str, optional) – prefix of slack variables. Defaults to “v”.
slack_var_2_prefix (str, optional) – prefix of slack variables. Defaults to “w”.
big_m_prefix (str, optional) – prefix of big M. Defaults to “bigM”.
bound (int, optional) – bound for slack variables. Defaults to 1000000.
exclude_constraints (tp.Optional[tp.List[str]], optional) – list of constraint names to exclude from slack variables. Defaults to None.
- Returns:
always feasible problem
- Return type:
jm.Problem
- generate_phase1_feasible_problem(problem: jijmodeling.Problem, slack_var_1_prefix: str = 'v', slack_var_2_prefix: str = 'w', big_m_prefix: str = 'bigM', bound=1000000, exclude_constraints: List[str] | None = None) jijmodeling.Problem#
Generate Phase 1 always feasible problem with slack-only objective.
This function generates a problem where the objective is ONLY the slack penalty term, ignoring the original objective. Used for Phase 1 of two-phase Benders decomposition to find feasibility first.
Objective: minimize bigM * sum(slack_vars) (original objective NOT included)
- Parameters:
problem (jm.Problem) – problem to be transformed
slack_var_1_prefix (str, optional) – prefix of slack variables. Defaults to “v”.
slack_var_2_prefix (str, optional) – prefix of slack variables. Defaults to “w”.
big_m_prefix (str, optional) – prefix of big M. Defaults to “bigM”.
bound (int, optional) – bound for slack variables. Defaults to 1000000.
exclude_constraints (tp.Optional[tp.List[str]], optional) – list of constraint names to exclude from slack variables. Defaults to None.
- Returns:
Phase 1 always feasible problem with slack-only objective
- Return type:
jm.Problem
- generate_phase1_feasible_problem_forall(problem: jijmodeling.Problem, slack_var_1_prefix: str = 'v', slack_var_2_prefix: str = 'w', big_m_prefix: str = 'bigM', bound=100000000, exclude_constraints: List[str] | None = None) jijmodeling.Problem#
Generate Phase 1 always feasible problem with slack-only objective (forall version).
This function generates a problem where the objective is ONLY the slack penalty term, ignoring the original objective. Supports constraints with forall indices. Used for Phase 1 of two-phase Benders decomposition to find feasibility first.
Objective: minimize bigM * sum(slack_vars) (original objective NOT included)
- Parameters:
problem (jm.Problem) – problem to be transformed
slack_var_1_prefix (str, optional) – prefix of slack variables. Defaults to “v”.
slack_var_2_prefix (str, optional) – prefix of slack variables. Defaults to “w”.
big_m_prefix (str, optional) – prefix of big M. Defaults to “bigM”.
bound (int, optional) – bound for slack variables. Defaults to 100000000.
exclude_constraints (tp.Optional[tp.List[str]], optional) – list of constraint names to exclude from slack variables. Defaults to None.
- Returns:
Phase 1 always feasible problem with slack-only objective
- Return type:
jm.Problem
- generate_always_feasible_problem_forall(problem: jijmodeling.Problem, slack_var_1_prefix: str = 'v', slack_var_2_prefix: str = 'w', big_m_prefix: str = 'bigM', bound=100000000, exclude_constraints: List[str] | None = None) jijmodeling.Problem#
generate always feasible problem from the given problem This function generates a new problem with slack variables for each constraints including forall and penalty term to the objective function. This problem is always feasible owing to the slack variables unless the lower/upper bound of the slack variables is too small.
- Parameters:
problem (jm.Problem) – problem to be transformed
slack_var_1_prefix (str, optional) – prefix of slack variables. Defaults to “v”.
slack_var_2_prefix (str, optional) – prefix of slack variables. Defaults to “w”.
big_m_prefix (str, optional) – prefix of big M. Defaults to “bigM”.
bound (int, optional) – bound for slack variables. Defaults to 100000000.
exclude_constraints (tp.Optional[tp.List[str]], optional) – list of constraint names to exclude from slack variables. Defaults to None.
- Returns:
always feasible problem
- Return type:
jm.Problem