# Forum

Here is a list of all currently available discussion groups concerning RTC-Tools.

The discussion groups provide a place for RTC-Tools users to help each other. These discussion groups are in no way a replacement for the RTC-Tools support help desk.

## Message Boards

### Mixed Integer Optimization

HK

#### Mixed Integer Optimization

Youngling Posts: 2 Join Date: 1/17/19

Hello,

I started using the Mixed Integer functionality within my optimization problem. I added a boolean decision variable in the Modelica model and call this variable in my Python script as a constraint to turn a pump completely on or completely off. The results of the optimization are very nice and exactly as I expected to be. However, with including the boolean decision variable the computational time increases greatly vs not using the boolean variable.

Is there a way to tell the solver to stop optimizing after a certain amount of time? Or to stop after a certain amount of iterations?

With kind regards,

Hidde Kats

TP

#### RE: Mixed Integer Optimization

Youngling Posts: 1 Join Date: 1/22/19

Dear Hidde,

yes, there are various stopping criteria that can be used. In particular, if you want to impose a time limit in solver options you can set, e.g.,
options[solver][‘time_limit’] = 60.
You can also set a limit of iterations, although I wouldn’t recommend it. What it is very useful is to set an ‘allowable_gap’ (or even better an ‘allowable_fractional_gap’). This terminates the optimization run when the gap between the best known solution and the best bound on the optimum is less the set value. These options allow to obtain a solution that is guaranteed to be rather good, in a time efficient manner.

The underlying solver that it is used with Mixed Integer optimization problems is called Bonmin. Here you can find various options and stopping criteria that you can play with: https://www.coin-or.org/Bonmin/option_pages/options_list_bonmin.html (see section branch-and-bound options for the stopping criteria).

Best,
Teresa Piovesan