JijMINLPSolver
Mixed Integer Non-Linear Programming (MINLP) is a problem with a non-linear objective function and non-linear constraints containing integer variables. JijMINLPSolver can solve various problems that involve MINLP. JijMINLPSolver supports binary variables BinaryVar, integer variables IntegerVar, continuous variables ContinuousVar from jijmodeling and allows both linear and nonlinear problems.
Usage
The solution can be obtained by using sample_model of JijMINLPSolver as follows.
import jijzept as jz
solver = jz.JijMINLPSolver(config="config.toml")
response = solver.sample_model(problem, instance_data)
sampleset = response.get_sampleset()
Relax to continuous variables
The argument relaxed_variables can be used to solve problems where the specified variables are relaxed to continuous variables. For example, let consider the following problem:
import jijmodeling as jm
import jijzept as jz
x = jm.IntegerVar("x", lower_bound=-2, upper_bound=2)
problem = jm.Problem("Relax")
problem += (x-0.5)**2
problem
If you solve this problem as is, the solution you get is x=0 or x=1. This is because x can only be an integer.
solver = jz.JijMINLPSolver(config="config.toml")
# if `relaxed_variables` is not specified
response = solver.sample_model(problem, {})
sampleset = response.get_sampleset()
sampleset[0].var_values
{'x': SparseVarValues(name="x", values={(): 1}, shape=()}
On the other hand, If you specify x to relaxed_variables, the solution you get is x=0.5. This is because x is treated as a continuous variable.
solver = jz.JijMINLPSolver(config="config.toml")
# if `relaxed_variables` is specified
response = solver.sample_model(problem, {}, relaxed_variables=["x"])
sampleset = response.get_sampleset()
sampleset[0].var_values
{'x': SparseVarValues(name="x", values={(): 0.49972729891145246}, shape=(), var_type=VarType.CONTINUOUS)}
JijMINLPParameters
| name | type | default | description |
|---|---|---|---|
gap_limit | Optional[float] | None | If the relative gap is less than the specified value, the solver stops. |
time_limit | Optional[float] | None | The maximum time in seconds to run the solver. |
solutions_limit | Optional[int] | None | When the given number of solutions has been found, the solver stops. |
JijMINLPSolver.sample_model
| name | type | default | description |
|---|---|---|---|
fixed_variables | Optional[FixedVariables] | None | The dictionary of variables to be fixed. |
relaxed_variables | Optional[list[str]] | None | The labels of the variables to be relaxed to continuous. |
ignored_constraints | Optional[list[str] | None | The list of constraint names to be ignored. |
parameters | Optional[JijSAParameters] | None | Parameters for JijMINLPSolver. |
max_wait_time | Optional[Union[int, float]] | None | The number of timeout [sec] for post request. If None, 600 (one minute) will be set. Please note that this argument is for the jijzept timeout and not for configuring solver settings, such as solving time. |
sync | bool | True | If True, synchronous mode is enabled. |
queue_name | Optional[str] | None | Queue name. |