# Help setting SCIP parameters to increase use of heuristics

I’m working on an optimization problem using SCIP and I’ve noticed that it takes a very long time to find a primal solution. I don’t need to find optimal solutions and I’d prefer to find feasible solutions early on. I would like to encourage SCIP to try heuristics more often but I’m unsure how to do so.

I’ve looked at the SCIP parameters documentation and it seems like there are many options related to tweaking values for specific heuristics, but it’s unclear to me how they fit together or how they should be set.
Also, is there a global parameter that I can set to generally increase the use of heuristics without specifying a specific method?

Any guidance on how to achieve this or explanation of how SCIP selects its heuristics would be helpful.

Thanks

SCIP has a lot of parameters. @mbesancon is our SCIP expert.

The best improvement would be to provide some starting values. Can you compute a feasible solution via some other method?

Hi @odow, unfortunately not. I haven’t found an easy way to compute a trivial solution. This was partly why I wanted to leverage SCIP’s heuristics to help find feasible solutions.
It’s a binary integer problem though, are there any standard methods that I could perhaps read up on and try?

There aren’t many generally applicable methods. Normally you’d need to use some domain knowledge that is customized to your particular problem. It’s hard to say more without knowing the exact model.

Hey,

I had the same issue last week and found this thread. SCIP has a flag to select aggressive heuristic emphasis ([SCIP] Selecting aggressive heuristic emphasis from pyscipopt).

Turning on this flag calls the following function in SCIP: scip/src/scip/paramset.c at ab3e0e75cb78f654448d604b494babfb35fe7245 · scipopt/scip · GitHub

I could not figure out how to call it from Julia and to be honest, it was easier to reproduce the behavior of this function by parsing all the parameters and manually setting the values.

I ended up with the following parameters:

``````    set_attribute(model, "heuristics/actconsdiving/freq", 20)
set_attribute(model, "heuristics/actconsdiving/maxlpiterquot", 0.05 * 1.5)
set_attribute(model, "heuristics/actconsdiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/actconsdiving/lpsolvefreq", 0)
set_attribute(model, "heuristics/bound/freq", 20)
set_attribute(model, "heuristics/clique/freq", 20)
set_attribute(model, "heuristics/coefdiving/freq", 20)
set_attribute(model, "heuristics/coefdiving/maxlpiterquot", 0.05 * 1.5)
set_attribute(model, "heuristics/coefdiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/coefdiving/lpsolvefreq", 0)
set_attribute(model, "heuristics/completesol/freq", 20)
set_attribute(model, "heuristics/conflictdiving/freq", 5)
set_attribute(model, "heuristics/conflictdiving/maxlpiterquot", 0.15 * 1.5)
set_attribute(model, "heuristics/conflictdiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/conflictdiving/lpsolvefreq", 0)
set_attribute(model, "heuristics/crossover/freq", 15)
set_attribute(model, "heuristics/crossover/nwaitingnodes", 20)
set_attribute(model, "heuristics/crossover/nodesquot", 0.1)
set_attribute(model, "heuristics/crossover/minfixingrate", 0.666)
set_attribute(model, "heuristics/crossover/dontwaitatroot", true)
set_attribute(model, "heuristics/dins/freq", 20)
set_attribute(model, "heuristics/distributiondiving/freq", 5)
set_attribute(model, "heuristics/distributiondiving/maxlpiterquot", 0.05 * 1.5)
set_attribute(model, "heuristics/distributiondiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/distributiondiving/lpsolvefreq", 0)
set_attribute(model, "heuristics/dps/freq", 20)
set_attribute(model, "heuristics/dualval/freq", -1)
set_attribute(model, "heuristics/farkasdiving/freq", 5)
set_attribute(model, "heuristics/farkasdiving/maxlpiterquot", 0.05 * 1.5)
set_attribute(model, "heuristics/farkasdiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/farkasdiving/lpsolvefreq", 1)
set_attribute(model, "heuristics/feaspump/freq", 10)
set_attribute(model, "heuristics/feaspump/maxlpiterquot", 0.01 * 1.5)
set_attribute(model, "heuristics/feaspump/maxlpiterofs", 1500)
set_attribute(model, "heuristics/feaspump/perturbfreq", 100)
set_attribute(model, "heuristics/fixandinfer/freq", 20)
set_attribute(model, "heuristics/fracdiving/freq", 5)
set_attribute(model, "heuristics/fracdiving/maxlpiterquot", 0.05 * 1.5)
set_attribute(model, "heuristics/fracdiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/fracdiving/lpsolvefreq", 0)
set_attribute(model, "heuristics/gins/freq", 10)
set_attribute(model, "heuristics/guideddiving/freq", 5)
set_attribute(model, "heuristics/guideddiving/maxlpiterquot", 0.05 * 1.5)
set_attribute(model, "heuristics/guideddiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/guideddiving/lpsolvefreq", 0)
set_attribute(model, "heuristics/zeroobj/freq", 20)
set_attribute(model, "heuristics/indicator/freq", 1)
# set_attribute(model, "heuristics/indicatordiving/freq", 20)
# set_attribute(model, "heuristics/indicatordiving/maxlpiterquot", 0.05 * 1.5)
# set_attribute(model, "heuristics/indicatordiving/maxlpiterofs", 1500)
# set_attribute(model, "heuristics/indicatordiving/lpsolvefreq", 30)
set_attribute(model, "heuristics/intdiving/freq", 20)
set_attribute(model, "heuristics/intdiving/maxlpiterquot", 0.05 * 1.5)
set_attribute(model, "heuristics/intdiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/intshifting/freq", 5)
set_attribute(model, "heuristics/linesearchdiving/freq", 5)
set_attribute(model, "heuristics/linesearchdiving/maxlpiterquot", 0.05 * 1.5)
set_attribute(model, "heuristics/linesearchdiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/linesearchdiving/lpsolvefreq", 0)
set_attribute(model, "heuristics/localbranching/freq", 20)
set_attribute(model, "heuristics/locks/freq", 20)
set_attribute(model, "heuristics/lpface/freq", 7)
set_attribute(model, "heuristics/alns/freq", 1)
set_attribute(model, "heuristics/alns/rens/active", true)
set_attribute(model, "heuristics/alns/rins/active", true)
set_attribute(model, "heuristics/alns/mutation/active", true)
set_attribute(model, "heuristics/alns/localbranching/active", true)
set_attribute(model, "heuristics/alns/crossover/active", true)
set_attribute(model, "heuristics/alns/proximity/active", true)
set_attribute(model, "heuristics/alns/zeroobjective/active", true)
set_attribute(model, "heuristics/alns/dins/active", true)
set_attribute(model, "heuristics/alns/trustregion/active", true)
set_attribute(model, "heuristics/alns/nodesofs", 2000)
set_attribute(model, "heuristics/alns/nodesquot", 0.2)
set_attribute(model, "heuristics/nlpdiving/freq", 5)
set_attribute(model, "heuristics/mutation/freq", 20)
set_attribute(model, "heuristics/multistart/freq", 1)
set_attribute(model, "heuristics/mpec/freq", 1)
set_attribute(model, "heuristics/objpscostdiving/freq", 10)
set_attribute(model, "heuristics/objpscostdiving/maxlpiterquot", 0.01 * 1.5)
set_attribute(model, "heuristics/objpscostdiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/octane/freq", 20)
set_attribute(model, "heuristics/ofins/freq", 20)
set_attribute(model, "heuristics/oneopt/freq", 1)
set_attribute(model, "heuristics/proximity/freq", 20)
set_attribute(model, "heuristics/pscostdiving/freq", 5)
set_attribute(model, "heuristics/pscostdiving/maxlpiterquot", 0.05 * 1.5)
set_attribute(model, "heuristics/pscostdiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/pscostdiving/lpsolvefreq", 0)
set_attribute(model, "heuristics/randrounding/freq", 10)
set_attribute(model, "heuristics/rens/freq", 20)
set_attribute(model, "heuristics/rens/minfixingrate", 0.5)
set_attribute(model, "heuristics/rens/nodesofs", 500)
set_attribute(model, "heuristics/reoptsols/freq", 20)
set_attribute(model, "heuristics/repair/freq", 20)
set_attribute(model, "heuristics/rins/freq", 12)
set_attribute(model, "heuristics/rootsoldiving/freq", 10)
set_attribute(model, "heuristics/rootsoldiving/maxlpiterquot", 0.01 * 1.5)
set_attribute(model, "heuristics/rootsoldiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/rounding/freq", 1)
# set_attribute(model, "heuristics/scheduler/freq", 20)
set_attribute(model, "heuristics/shiftandpropagate/freq", 20)
set_attribute(model, "heuristics/shifting/freq", 5)
set_attribute(model, "heuristics/simplerounding/freq", 1)
set_attribute(model, "heuristics/subnlp/freq", 1)
set_attribute(model, "heuristics/trivial/freq", 20)
set_attribute(model, "heuristics/trivialnegation/freq", 20)
set_attribute(model, "heuristics/trustregion/freq", 20)
set_attribute(model, "heuristics/trysol/freq", 1)
set_attribute(model, "heuristics/twoopt/freq", 20)
set_attribute(model, "heuristics/undercover/freq", 1)
set_attribute(model, "heuristics/vbounds/freq", 20)
set_attribute(model, "heuristics/veclendiving/freq", 5)
set_attribute(model, "heuristics/veclendiving/maxlpiterquot", 0.05 * 1.5)
set_attribute(model, "heuristics/veclendiving/maxlpiterofs", 1500)
set_attribute(model, "heuristics/veclendiving/lpsolvefreq", 0)
set_attribute(model, "heuristics/zirounding/freq", 1)
``````

Commented parameters throw an error with my setup. Hope it helps.

PS: it would be nice to have this `SCIP_PARAMSETTING.AGGRESSIVE` flag from Julia but I don’t know how to implement that.