Skip to main content

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

Problem:Relaxmin((x0.5)2)wherex0-dim integer variablelower bound: (2)upper bound: 2\begin{array}{cccc}\text{Problem:} & \text{Relax} & & \\& & \min \quad \displaystyle \left(\left(x - 0.5\right)^{2}\right) & \\\text{{where}} & & & \\& x & 0\text{-dim integer variable}\\ & & \text{lower bound: }(-2) & \\ & & \text{upper bound: }2 & \\\end{array}

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)}

JijSolver.sample_model

nametypedefaultdescription
relaxed_variablesOptional[list[str]]NoneThe labels of the variables to be relaxed to continuous.
max_wait_timeOptional[Union[int, float]]NoneThe 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.
syncboolTrueIf True, synchronous mode is enabled.