jijzepttools.modeling.replace.problem#

Functions#

replace_problem(→ jijmodeling.Problem)

Replace the expressions in the problem with the given replacer.

generate_always_feasible_problem(→ jijmodeling.Problem)

generate always feasible problem from the given problem

generate_always_feasible_problem_forall(...)

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) 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”.

Returns:

always feasible problem

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) 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”.

Returns:

always feasible problem

Return type:

jm.Problem