[SCIP] Setting solutions of a primal heuristic
Michael Kahr
m.kahr at univie.ac.at
Tue Oct 24 11:28:15 CEST 2017
Dear SCIPers,
I am working on a branch-and-cut model, and want to provide SCIP also
with heuristic solutions, which works fine for an initial starting
solution and for some problem instances during the solving stage
(however, not for all). Thereby, I use a class inherited from ObjHeur to
call my heuristic which delivers solutions in the original problem space.
If I understood this thread correctly:
http://listserv.zib.de/pipermail/scip/2013-August/001620.html
the right procedure is to create a solution object in the original
problem space which is done by
SCIP_SOL *heur_sol;
SCIP_CALL ( SCIPcreateOrigSol ( scip, &heur_sol, NULL ) );.
I then set the variable values obtained by the heuristc (h_x) to scip
variables (x) and try to add the solution by
SCIP_CALL( SCIPsetSolVals( scip, heur_sol, nvars, x, h_x ) );
SCIP_CALL( SCIPtrySolFree( scip, &heur_sol, true, true, true, true,
true, &success) );
However, as stated at the begin this does not work for all instances and
SCIP complains about violations of variable bounds and constraints, e.g.,
"solution violates original bounds of variable <t_x[3]> [1,1] solution
value <0>"
"[linear] <SET_LINK_NODE[49]>: -<t_x[49]>[B] +<t_l[1031]>[B] >= 0;
violation: left hand side is violated by 1"
What am I doing wrong here? Note that the solutions are valid before I
pass them to SCIPtrySolFree(), which is checked by SCIPcheckSolOrig().
Thank you in advance, best,
Michael
More information about the Scip
mailing list