0

I solve a multiobjective MIP with the docplex module in Python. As the problem is rather large, I would like to set a relative MIP gap tolerance: parameters.mip.tolerances.mipgap (https://www.ibm.com/docs/en/icos/12.9.0?topic=parameters-relative-mip-gap-tolerance).

In the docs for the solve details (https://ibmdecisionoptimization.github.io/docplex-doc/mp/docplex.mp.sdetails.html) it says that the property mip_relative_gap "...returns 1e+20 for multi-objective MIP problems." I can confirm this.

Now, I'm wondering what CPLEX does if I set this parameter anyway, say parameters.mip.tolerances.mipgap=0.2. Is it just that the correct gap is not shown in the solve details? Is the solution I get the one with the gap (if not, what solution do I get?)? Is there any way to get the MIP gap in a multiobjetive problem?

orarne
  • 11
  • 2

1 Answers1

0

you can set mipgap per objective in the multiobjective.

In Easy optimization with python in the multi objective example

from docplex.mp.model import Model

mdl = Model(name='buses')

nbbus50 = mdl.integer_var(name='nbBus50')
nbbus40 = mdl.integer_var(name='nbBus40')
nbbus30 = mdl.integer_var(name='nbBus30')

cost = mdl.continuous_var(name='cost')
co2emission = mdl.continuous_var(name='co2emission')

mdl.add_constraint(nbbus50*50+nbbus40*40 + nbbus30*30 >= 200, 'kids')
mdl.add_constraint(co2emission==nbbus50+nbbus40*1.1+nbbus30*1.2)
mdl.add_constraint(cost==nbbus40*500 + nbbus30*400+nbbus50*625)
                
sense="min"
exprs=[cost,co2emission]
priorities=[1,2]
weights=[1,1]
timelimits=[5, 10]

mdl.set_multi_objective(sense, exprs, priorities, weights, abstols=None,
                        reltols=None, names=None)

mdl.solve(lex_mipgaps = [0.001, 0.05], log_output=True,lex_timelimits = timelimits)

for v in mdl.iter_integer_vars():
    print(v," = ",v.solution_value)

print("The minimum cost is ",cost.solution_value);
print("CO2 emission is ",co2emission.solution_value);

you will notice

lex_mipgaps = [0.001, 0.05]

to set several mipgaps

Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15
  • Thanks, Alex. That helps a lot. Is there a way to read the actual gaps for each objective in the solution? I did not find a measure in the solve_details class but maybe you know a way to do it. Thanks. – orarne Mar 30 '22 at 12:28