SCIP gap limit

Hi all,

I am using SCIP optimizer and do not know how to adjust the gab limit.

using SCIP
m = Model(with_optimizer(SCIP.Optimizer))

if I follow the guide for SCIP.jl I would need MIO.set and it seems but this package doesn’t exist!

SO this doesn’t work for me:
using MOI
using SCIP

optimizer = SCIP.Optimizer(display_verblevel=0, limits_gap=0.05)

The reason I need to adjust the gap is that SCIP keeps running in 0.00% gap and it shows that the primal bound has multiple solutions!

SCIP Status : solving was interrupted [user interrupt]
Solving Time (sec) : 61.00
Solving Nodes : 49979 (total of 49981 nodes in 3 runs)
Primal Bound : +1.13502999990368e+02 (45 solutions)
Dual Bound : +1.13502999987900e+02
Gap : 0.00 %

I hope someone can help! thanks in advance!

Regards

MOI is a constant for the MathOptInterface package that is pulled in by using JuMP.

So

using JuMP
using SCIP

model = Model(with_optimizer(SCIP.Optimizer))
MOI.set(model, ...)

is equivalent to

using JuMP
using SCIP
using MathOptInterface

const MOI = MathOptInterface

model = Model(with_optimizer(SCIP.Optimizer))
MOI.set(model, ...)

Thank you for a quick reply.

I get these error for the first option you suggested:

LoadError: MethodError: no method matching set(::Model, ::SCIP.Param, ::Int64)
Closest candidates are:
set(::Model, !Matched::MathOptInterface.AbstractModelAttribute, ::Any)

and this error for the second option:

LoadError: cannot assign variable JuMP.MOI from module Main

Am I doing something wrong here? Thanks again for the help.

maybe I can also try to do it in scip.set file for the parameters. But I don’t know where to put the file. It doesn’t work when I put it in the current directory with Julia script.

Could you please provide a complete example, and also share what package versions you use?

optimizer = SCIP.Optimizer(display_verblevel=0, limits_gap=0.05)

This looks correct, if you want to use SCIP in direct mode. That is, you would continue with model = JuMP.direct_model(optimizer).

Otherwise, you could also use:

model = Model(with_optimizer(SCIP.Optimizer), limits_gap=0.05)

Note that even if you set the gap limit to 0.05, it can happen that SCIP solves the problem to optimality. Imagine that some heuristic finds the optimal solution while the dual bound was already at the optimal value. Or that all remaining nodes are pruned by detecting infeasibility, even though the dual bound was weak before.

Thank you for your reply.

Then does it mean that defining the gap in SCIP might not work?

I am getting an error when SCIP passed the defined gap (I tested 100% gap for testing and tightening the variable bounds, SCIP jumps from 111% to 54% gives an error)

5.0s| 200 | 171 | 64081 | 232.4 | 16M| 19 | 30 | 319 | 296 | 319 | 433 |6009 | 9 | 494 | 6.232184e+01 | 1.320000e+02 | 111.80%
L 6.0s| 282 | 237 | 74537 | 201.8 | 17M| 20 | 9 | 319 | 296 | 319 | 564 |7430 | 9 | 507 | 6.271476e+01 | 9.663525e+01 | 54.09%

SCIP Status : solving was interrupted [gap limit reached]
Solving Time (sec) : 6.00
Solving Nodes : 282
Primal Bound : +9.66352530499622e+01 (2 solutions)
Dual Bound : +6.27147600567366e+01
Gap : 54.09 %
ERROR: LoadError: SCIP is wrong stage, can not query results!

So setting the gap limit worked :+1:

This looks like a problem that we already fixed, so you might not use a recent version of SCIP.jl.

Please check if updating will fix that problem, or else please open an issue with SCIP.jl.

Thank you! yes it did work with gap limit!

I will try to update SCIP.jl or open an issue…