GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
heur_gcgdins.c
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* GCG --- Generic Column Generation */
5/* a Dantzig-Wolfe decomposition based extension */
6/* of the branch-cut-and-price framework */
7/* SCIP --- Solving Constraint Integer Programs */
8/* */
9/* Copyright (C) 2010-2026 Operations Research, RWTH Aachen University */
10/* Zuse Institute Berlin (ZIB) */
11/* */
12/* Licensed under the Apache License, Version 2.0 (the "License"); */
13/* you may not use this file except in compliance with the License. */
14/* You may obtain a copy of the License at */
15/* */
16/* http://www.apache.org/licenses/LICENSE-2.0 */
17/* */
18/* Unless required by applicable law or agreed to in writing, software */
19/* distributed under the License is distributed on an "AS IS" BASIS, */
20/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
21/* See the License for the specific language governing permissions and */
22/* limitations under the License. */
23/* */
24/* You should have received a copy of the Apache-2.0 license */
25/* along with GCG; see the file LICENSE. If not visit gcg.or.rwth-aachen.de.*/
26/* */
27/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
28
29/**@file heur_gcgdins.c
30 * @brief DINS primal heuristic (according to Ghosh)
31 * @author Robert Waniek
32 * @author Christian Puchert
33 */
34
35/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36
37#include <assert.h>
38#include <string.h>
39
40#include "gcg/heur_gcgdins.h"
41#include "gcg/gcg.h"
42#include "gcg/pricer_gcg.h"
43
44#include "scip/scipdefplugins.h"
45#include "scip/cons_linear.h"
46
47#define HEUR_NAME "gcgdins"
48#define HEUR_DESC "distance induced neighborhood search by Ghosh"
49#define HEUR_DISPCHAR 'D'
50#define HEUR_PRIORITY -1105000
51#define HEUR_FREQ -1
52#define HEUR_FREQOFS 0
53#define HEUR_MAXDEPTH -1
54#define HEUR_TIMING SCIP_HEURTIMING_AFTERNODE
55#define HEUR_USESSUBSCIP TRUE /**< does the heuristic use a secondary SCIP instance? */
56
57#define DEFAULT_NODESOFS 5000LL /**< number of nodes added to the contingent of the total nodes */
58#define DEFAULT_MAXNODES 5000LL /**< maximum number of nodes to regard in the subproblem */
59#define DEFAULT_MINNODES 500LL /**< minimum number of nodes to regard in the subproblem */
60#define DEFAULT_MINIMPROVE 0.01 /**< factor by which DINS should at least improve the incumbent */
61#define DEFAULT_NODESQUOT 0.05 /**< subproblem nodes in relation to nodes of the original problem */
62#define DEFAULT_NWAITINGNODES 0LL /**< number of nodes without incumbent change that heuristic should wait */
63#define DEFAULT_NEIGHBORHOODSIZE 18 /**< radius of the incumbents neighborhood to be searched */
64#define DEFAULT_SOLNUM 5 /**< number of pool-solutions to be checked for flag array update */
65#define DEFAULT_USELPROWS FALSE /**< should subproblem be created out of the rows in the LP rows,
66 * otherwise, the copy constructors of the constraints handlers are used */
67#define DEFAULT_COPYCUTS TRUE /**< if DEFAULT_USELPROWS is FALSE, then should all active cuts from the cutpool
68 * of the original scip be copied to constraints of the subscip */
69
70
71/*
72 * Data structures
73 */
74
75/** DINS primal heuristic data */
77{
78 GCG* gcg; /**< GCG data structure */
79 SCIP_Longint nodesofs; /**< number of nodes added to the contingent of the total nodes */
80 SCIP_Longint maxnodes; /**< maximum number of nodes to regard in the subproblem */
81 SCIP_Longint minnodes; /**< minimum number of nodes to regard in the subproblem */
82 SCIP_Longint nwaitingnodes; /**< number of nodes without incumbent change that heuristic should wait */
83 SCIP_Real minimprove; /**< factor by which DINS should at least improve the incumbent */
84 SCIP_Longint usednodes; /**< nodes already used by DINS in earlier calls */
85 SCIP_Real nodesquot; /**< subproblem nodes in relation to nodes of the original problem */
86 int neighborhoodsize; /**< radius of the incumbent's neighborhood to be searched */
87 SCIP_Bool* delta; /**< stores whether a variable kept its value from root LP all the time */
88 int deltalength; /**< if there are no binary variables, we need no flag array */
89 SCIP_Longint lastnsolsfound; /**< solutions found until the last call of DINS */
90 int solnum; /**< number of pool-solutions to be checked for flag array update */
91 SCIP_Bool uselprows; /**< should subproblem be created out of the rows in the LP rows? */
92 SCIP_Bool copycuts; /**< if uselprows == FALSE, should all active cuts from cutpool be copied
93 * to constraints in subproblem?
94 */
95 SCIP_SOL* rootsol; /**< relaxation solution at the root node */
96 SCIP_Bool firstrun; /**< is the heuristic running for the first time? */
97
98#ifdef SCIP_STATISTIC
99 SCIP_Real avgfixrate; /**< average rate of variables that are fixed */
100 SCIP_Real avgzerorate; /**< average rate of fixed variables that are zero */
101 SCIP_Longint totalsols; /**< total number of subSCIP solutions (including those which have not
102 * been added)
103 */
104 SCIP_Real subsciptime; /**< total subSCIP solving time in seconds */
105 SCIP_Real bestprimalbd; /**< objective value of best solution found by this heuristic */
106#endif
107};
108
109
110/*
111 * Local methods
112 */
113
114/** creates a subproblem for subscip by fixing a number of variables */
115static
117 SCIP* scip, /**< SCIP data structure of the original problem */
118 SCIP* subscip, /**< SCIP data structure of the subproblem */
119 SCIP_VAR** vars, /**< variables of the original problem */
120 SCIP_VAR** subvars, /**< variables of the subproblem */
121 int nbinvars, /**< number of binary variables of problem and subproblem */
122 int nintvars, /**< number of general integer variables of problem and subproblem */
123 SCIP_Bool uselprows, /**< should subproblem be created out of the rows in the LP rows? */
124 int* fixingcounter, /**< number of integers that get actually fixed */
125 int* zerocounter /**< number of variables fixed to zero */
126 )
127{
128 SCIP_SOL* bestsol;
129
130 int i;
131
132 assert(scip != NULL);
133 assert(subscip != NULL);
134 assert(vars != NULL);
135 assert(subvars != NULL);
136
137 /* get the best MIP-solution known so far */
138 bestsol = SCIPgetBestSol(scip);
139 assert(bestsol != NULL);
140
141 /* create the rebounded general integer variables of the subproblem */
142 for( i = nbinvars; i < nbinvars + nintvars; i++ )
143 {
144 SCIP_Real mipsol;
145 SCIP_Real lpsol;
146
147 SCIP_Real lbglobal;
148 SCIP_Real ubglobal;
149
150 /* get the bounds for each variable */
151 lbglobal = SCIPvarGetLbGlobal(vars[i]);
152 ubglobal = SCIPvarGetUbGlobal(vars[i]);
153
155 /* get the current relaxation solution for each variable */
156 lpsol = SCIPgetRelaxSolVal(scip, vars[i]);
157 /* get the current MIP solution for each variable */
158 mipsol = SCIPgetSolVal(scip, bestsol, vars[i]);
159
160 /* if the solution values differ by 0.5 or more, the variable is rebounded, otherwise it is just copied */
161 if( REALABS(lpsol-mipsol) >= 0.5 )
162 {
163 SCIP_Real lb;
164 SCIP_Real ub;
165 SCIP_Real range;
166
167 lb = lbglobal;
168 ub = ubglobal;
169
170 /* create a equally sized range around lpsol for general integers: bounds are lpsol +- (mipsol-lpsol) */
171 range = 2*lpsol-mipsol;
172
173 if( mipsol >= lpsol )
174 {
175 range = SCIPfeasCeil(scip, range);
176 lb = MAX(lb, range);
177
178 /* when the bound new upper bound is equal to the current MIP solution, we set both bounds to the integral bound (without eps) */
179 if( SCIPisFeasEQ(scip, mipsol, lb) )
180 ub = lb;
181 else
182 ub = mipsol;
183 }
184 else
185 {
186 range = SCIPfeasFloor(scip, range);
187 ub = MIN(ub, range);
188
189 /* when the bound new upper bound is equal to the current MIP solution, we set both bounds to the integral bound (without eps) */
190 if( SCIPisFeasEQ(scip, mipsol, ub) )
191 lb = ub;
192 else
193 lb = mipsol;
194 }
195
196 /* the global domain of variables might have been reduced since incumbent was found: adjust lb and ub accordingly */
197 lb = MAX(lb, lbglobal);
198 ub = MIN(ub, ubglobal);
199
200 /* perform the bound change */
201 SCIP_CALL( SCIPchgVarLbGlobal(subscip, subvars[i], lb) );
202 SCIP_CALL( SCIPchgVarUbGlobal(subscip, subvars[i], ub) );
203 if( SCIPisEQ(scip, lb, ub) )
204 {
205 (*fixingcounter)++;
206 if( SCIPisZero(scip, ub) )
207 (*zerocounter)++;
208 }
209 }
210 else
211 {
212 /* the global domain of variables might have been reduced since incumbent was found: adjust it accordingly */
213 mipsol = MAX(mipsol, lbglobal);
214 mipsol = MIN(mipsol, ubglobal);
215
216 /* hard fixing for general integer variables with abs(mipsol-lpsol) < 0.5 */
217 SCIP_CALL( SCIPchgVarLbGlobal(subscip, subvars[i], mipsol) );
218 SCIP_CALL( SCIPchgVarUbGlobal(subscip, subvars[i], mipsol) );
219 (*fixingcounter)++;
220 if( SCIPisZero(scip, mipsol) )
221 (*zerocounter)++;
222 }
223 }
224
225 if( uselprows )
226 {
227 SCIP_ROW** rows; /* original scip rows */
228 int nrows;
229
230 /* get the rows and their number */
231 SCIP_CALL( SCIPgetLPRowsData(scip, &rows, &nrows) );
232
233 /* copy all rows to linear constraints */
234 for( i = 0; i < nrows; i++ )
235 {
236 SCIP_CONS* cons;
237 SCIP_VAR** consvars;
238 SCIP_COL** cols;
239 SCIP_Real constant;
240 SCIP_Real lhs;
241 SCIP_Real rhs;
242 SCIP_Real* vals;
243
244 int nnonz;
245 int j;
246
247 /* ignore rows that are only locally valid */
248 if( SCIProwIsLocal(rows[i]) )
249 continue;
250
251 /* get the row's data */
252 constant = SCIProwGetConstant(rows[i]);
253 lhs = SCIProwGetLhs(rows[i]) - constant;
254 rhs = SCIProwGetRhs(rows[i]) - constant;
255 vals = SCIProwGetVals(rows[i]);
256 nnonz = SCIProwGetNNonz(rows[i]);
257 cols = SCIProwGetCols(rows[i]);
258
259 assert(lhs <= rhs);
260
261 /* allocate memory array to be filled with the corresponding subproblem variables */
262 SCIP_CALL( SCIPallocBufferArray(subscip, &consvars, nnonz) );
263 for( j = 0; j < nnonz; j++ )
264 consvars[j] = subvars [ SCIPvarGetProbindex(SCIPcolGetVar(cols[j])) ];
265
266 /* create a new linear constraint and add it to the subproblem */
267 SCIP_CALL( SCIPcreateConsLinear(subscip, &cons, SCIProwGetName(rows[i]), nnonz, consvars, vals, lhs, rhs,
269 SCIP_CALL( SCIPaddCons(subscip, cons) );
270 SCIP_CALL( SCIPreleaseCons(subscip, &cons) );
271
272 /* free temporary memory */
273 SCIPfreeBufferArray(subscip, &consvars);
274 }
275 }
276
277 return SCIP_OKAY;
278}
279
280/** create the extra constraint of local branching and add it to subscip */
281static
283 SCIP* scip, /**< SCIP data structure of the original problem */
284 SCIP* subscip, /**< SCIP data structure of the subproblem */
285 SCIP_VAR** subvars, /**< variables of the subproblem */
286 SCIP_HEURDATA* heurdata, /**< heuristic's data structure */
287 SCIP_Bool* fixed /**< TRUE --> include variable in LB constraint */
288 )
289{
290 SCIP_CONS* cons; /* local branching constraint to create */
291 SCIP_VAR** consvars;
292 SCIP_VAR** vars;
293 SCIP_SOL* bestsol;
294
295 SCIP_Real* consvals;
297 SCIP_Real lhs;
298 SCIP_Real rhs;
299
300 char consname[SCIP_MAXSTRLEN];
301
302 int nbinvars;
303 int i;
304
305 (void) SCIPsnprintf(consname, SCIP_MAXSTRLEN, "%s_dinsLBcons", SCIPgetProbName(scip));
306
307 /* get the data of the variables and the best solution */
309 bestsol = SCIPgetBestSol(scip);
310 assert(bestsol != NULL);
311
312 /* memory allocation */
315
316 /* set initial left and right hand sides of local branching constraint */
317 lhs = 0.0;
319
320 /* create the distance function of the binary variables (to incumbent solution) */
321 for( i = 0; i < nbinvars; i++ )
322 {
323 consvars[i] = subvars[i];
325 if( fixed[i] )
326 {
327 consvals[i]=0.0;
328 continue;
329 }
330
331 solval = SCIPgetSolVal(scip, bestsol, vars[i]);
333
334 /* is variable i part of the binary support of the current solution? */
335 if( SCIPisFeasEQ(scip, solval, 1.0) )
336 {
337 consvals[i] = -1.0;
338 rhs -= 1.0;
339 lhs -= 1.0;
340 }
341 else
342 consvals[i] = 1.0;
343 }
344
345 /* creates local branching constraint and adds it to subscip */
346 SCIP_CALL( SCIPcreateConsLinear(subscip, &cons, consname, nbinvars, consvars, consvals,
347 lhs, rhs, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE) );
348 SCIP_CALL( SCIPaddCons(subscip, cons) );
349 SCIP_CALL( SCIPreleaseCons(subscip, &cons) );
350
351 /* free local memory */
352 SCIPfreeBufferArray(scip, &consvals);
353 SCIPfreeBufferArray(scip, &consvars);
354
355 return SCIP_OKAY;
356}
357
358/** get relaxation solution of root node (in original variables) */
359static
361 GCG* gcg, /**< GCG data structure */
362 SCIP_SOL** rootsol /**< pointer to store root relaxation solution */
363 )
364{
366 SCIP_SOL* masterrootsol;
368 int nmastervars;
369 int i;
370
371 /* get master problem */
374
375 /* allocate memory for master root LP solution */
376 SCIP_CALL( SCIPcreateSol(masterprob, &masterrootsol, NULL) );
377
378 /* get master variable information */
381 assert(nmastervars >= 0);
382
383 /* store root LP values in working master solution */
384 for( i = 0; i < nmastervars; i++ )
386
387 /* calculate original root LP solution */
389
390 /* free memory */
391 SCIP_CALL( SCIPfreeSol(masterprob, &masterrootsol) );
392
393 return SCIP_OKAY;
394}
395
396/** creates a new solution for the original problem by copying the solution of the subproblem */
397static
399 SCIP* scip, /**< original SCIP data structure */
400 SCIP* subscip, /**< SCIP structure of the subproblem */
401 SCIP_VAR** subvars, /**< the variables of the subproblem */
402 SCIP_HEUR* heur, /**< DINS heuristic structure */
403 SCIP_SOL* subsol, /**< solution of the subproblem */
404 SCIP_Bool* success /**< used to store whether new solution was found or not */
405 )
406{
407#ifdef SCIP_STATISTIC
409#endif
410 SCIP_VAR** vars; /* the original problem's variables */
411 int nvars;
412 SCIP_Real* subsolvals; /* solution values of the subproblem */
413 SCIP_SOL* newsol; /* solution to be created for the original problem */
414
415 assert(scip != NULL);
416 assert(heur != NULL);
417 assert(subscip != NULL);
418 assert(subvars != NULL);
419 assert(subsol != NULL);
420
421#ifdef SCIP_STATISTIC
422 /* get heuristic data */
424 assert( heurdata != NULL );
425#endif
426
427 /* get variables' data */
429 /* sub-SCIP may have more variables than the number of active (transformed) variables in the main SCIP
430 * since constraint copying may have required the copy of variables that are fixed in the main SCIP
431 */
432 assert(nvars <= SCIPgetNOrigVars(subscip));
433
434 SCIP_CALL( SCIPallocBufferArray(scip, &subsolvals, nvars) );
435
436 /* copy the solution */
437 SCIP_CALL( SCIPgetSolVals(subscip, subsol, nvars, subvars, subsolvals) );
438
439 /* create new solution for the original problem */
440 SCIP_CALL( SCIPcreateSol(scip, &newsol, heur) );
441 SCIP_CALL( SCIPsetSolVals(scip, newsol, nvars, vars, subsolvals) );
442
443 /* try to add new solution to scip and free it immediately */
445
446#ifdef SCIP_STATISTIC
447 if( *success )
448 {
449 if( SCIPgetSolTransObj(scip, newsol) < heurdata->bestprimalbd )
450 heurdata->bestprimalbd = SCIPgetSolTransObj(scip, newsol);
451 }
452#endif
453
454 SCIP_CALL( SCIPfreeSol(scip, &newsol) );
455
456 SCIPfreeBufferArray(scip, &subsolvals);
457 return SCIP_OKAY;
458}
459
460
461/*
462 * Callback methods of primal heuristic
463 */
464
465/** destructor of primal heuristic to free user data (called when SCIP is exiting) */
466static
467SCIP_DECL_HEURFREE(heurFreeGcgdins)
468{ /*lint --e{715}*/
470
471 assert(heur != NULL);
472 assert(scip != NULL);
473
474 /* get heuristic data */
476 assert(heurdata != NULL);
477
478 /* free heuristic data */
480 SCIPheurSetData(heur, NULL);
481
482 return SCIP_OKAY;
483}
484
485
486/** solving process initialization method of primal heuristic (called when branch and bound process is about to begin) */
487static
488SCIP_DECL_HEURINITSOL(heurInitsolGcgdins)
489{
491
492 assert(heur != NULL);
493 assert(scip != NULL);
494
495 /* get heuristic's data */
497 assert(heurdata != NULL);
498
499 /* initialize data */
500 heurdata->usednodes = 0;
504
505 /* create flag array */
507
508 /* no binvars => no flag array needed */
509 if( heurdata->deltalength > 0 )
510 {
511 int i;
512
514 for( i = 0; i < heurdata->deltalength; i++ )
515 heurdata->delta[i] = TRUE;
516 }
517
518#ifdef SCIP_STATISTIC
519 /* initialize statistical data */
520 heurdata->avgfixrate = 0.0;
521 heurdata->avgzerorate = 0.0;
522 heurdata->totalsols = 0;
523 heurdata->subsciptime = 0.0;
524 heurdata->bestprimalbd = SCIPinfinity(scip);
525#endif
526
527 return SCIP_OKAY;
528}
529
530/** solving process deinitialization method of primal heuristic (called before branch and bound process data is freed) */
531static
532SCIP_DECL_HEUREXITSOL(heurExitsolGcgdins)
533{ /*lint --e{715}*/
535#ifdef SCIP_STATISTIC
537#endif
538
539 assert(heur != NULL);
540 assert(scip != NULL);
541
542 /* get heuristic data */
544 assert(heurdata != NULL);
545
546 /* free flag array if exist */
547 if( heurdata->deltalength > 0 )
548 {
550 }
551
552 /* free root relaxation solution */
553 if( heurdata->rootsol != NULL )
555
556#ifdef SCIP_STATISTIC
558 heurdata->avgfixrate /= MAX((SCIP_Real)ncalls, 1.0);
559 heurdata->avgzerorate /= MAX((SCIP_Real)ncalls, 1.0);
560
561 /* print detailed statistics */
562 SCIPstatisticPrintf("LNS Statistics -- %s:\n", SCIPheurGetName(heur));
565 SCIPstatisticPrintf("Improving Sols : %13"SCIP_LONGINT_FORMAT"\n", SCIPheurGetNBestSolsFound(heur));
566 SCIPstatisticPrintf("Total Sols : %13"SCIP_LONGINT_FORMAT"\n", heurdata->totalsols);
567 SCIPstatisticPrintf("subSCIP time : %13.2f\n", heurdata->subsciptime);
568 SCIPstatisticPrintf("subSCIP nodes : %13"SCIP_LONGINT_FORMAT"\n", heurdata->usednodes);
569 SCIPstatisticPrintf("Avg. fixing rate : %13.2f\n", 100.0 * heurdata->avgfixrate);
570 SCIPstatisticPrintf("Avg. zero rate : %13.2f\n", 100.0 * heurdata->avgzerorate);
571 SCIPstatisticPrintf("Best primal bd. :");
572 if( SCIPisInfinity(scip, heurdata->bestprimalbd) )
573 SCIPstatisticPrintf(" infinity\n");
574 else
575 SCIPstatisticPrintf(" %13.6e\n", heurdata->bestprimalbd);
577#endif
578
579 return SCIP_OKAY;
580}
581
582/** execution method of primal heuristic */
583static
584SCIP_DECL_HEUREXEC(heurExecGcgdins)
585{ /*lint --e{715}*/
588 SCIP* subscip; /* the subproblem created by DINS */
589 SCIP_VAR** subvars; /* subproblem's variables */
590 SCIP_VAR** vars; /* variables of the original problem */
591 SCIP_HASHMAP* varmapfw; /* mapping of SCIP variables to sub-SCIP variables */
592 SCIP_SOL* bestsol; /* best solution known so far */
593 SCIP_SOL** sols; /* list of known solutions */
594
595 SCIP_Bool* fixed; /* fixing flag array */
596 SCIP_Bool* delta; /* flag array if variable value changed during solution process */
597
598
599 SCIP_Longint maxnnodes; /* maximum number of subnodes */
600 SCIP_Longint nsubnodes; /* nodelimit for subscip */
602
603 SCIP_Real timelimit; /* timelimit for subscip (equals remaining time of scip) */
604 SCIP_Real cutoff; /* objective cutoff for the subproblem */
605 SCIP_Real upperbound;
606 SCIP_Real memorylimit; /* memory limit for solution process of subscip */
607 SCIP_Real lpsolval;
608 SCIP_Real rootlpsolval;
609 SCIP_Real mipsolval;
611#ifdef SCIP_STATISTIC
612 SCIP_Real allfixingrate; /* percentage of all variables fixed */
613 SCIP_Real intfixingrate; /* percentage of integer variables fixed */
614 SCIP_Real zerofixingrate; /* percentage of variables fixed to zero */
615#endif
616
617 int ufcount; /* counts the number of true fixing flag entries */
618 int nvars; /* number of variables in original SCIP */
619 int nbinvars; /* number of binary variables in original SCIP */
620 int nintvars; /* number of general integer variables in original SCIP */
621 int nsols; /* number of known solutions */
622 int nsubsols;
623 int checklength;
624 int fixingcounter;
625 int zerocounter;
626 int i;
627 int j;
628
629 SCIP_Bool success; /* used to store whether new solution was found or not */
630 SCIP_Bool infeasible; /* stores whether the hard fixing of a variables was feasible or not */
631
633
634 assert(heur != NULL);
635 assert(scip != NULL);
636 assert(result != NULL);
637
638 /* get heuristic data */
640 assert(heurdata != NULL);
641
642 /* get master problem */
645
647
648 /* do not execute the heuristic on invalid relaxation solutions
649 * (which is the case if the node has been cut off)
650 */
652 return SCIP_OKAY;
653
654 /* only call heuristic, if feasible solution is available */
655 if( SCIPgetNSols(scip) <= 0 )
656 return SCIP_OKAY;
657
658 /* only call heuristic, if an optimal LP solution is at hand */
660 return SCIP_OKAY;
661
662 delta = heurdata->delta;
663
664 /* only call heuristic, if enough nodes were processed since last incumbent */
666 return SCIP_OKAY;
667
669
670 /* determine the node limit for the current process */
672
673 /* reward DINS if it succeeded often */
674 maxnnodes = (SCIP_Longint) (maxnnodes * (1.0 + 2.0 * (SCIPheurGetNBestSolsFound(heur)+1.0) / (SCIPheurGetNCalls(heur) + 1.0)));
675
676 /* count the setup costs for the sub-MIP as 100 nodes */
677 maxnnodes -= 100 * SCIPheurGetNCalls(heur);
678 maxnnodes += heurdata->nodesofs;
679
680 /* determine the node limit for the current process */
681 nsubnodes = maxnnodes - heurdata->usednodes;
682 nsubnodes = MIN(nsubnodes , heurdata->maxnodes);
683
684 /* check whether we have enough nodes left to call sub problem solving */
685 if( nsubnodes < heurdata->minnodes )
686 return SCIP_OKAY;
687
688 if( SCIPisStopped(scip) )
689 return SCIP_OKAY;
690
691 /* get required data of the original problem */
694
695 /* do not run heuristic if only continuous variables are present */
696 if( nbinvars == 0 && nintvars == 0 )
697 return SCIP_OKAY;
698
699 assert(vars != NULL);
700
701 /* if the heuristic is running for the first time, the root relaxation solution needs to be stored */
702 if( heurdata->firstrun )
703 {
708 }
709
710 /* initialize the subproblem */
711 SCIP_CALL( SCIPcreate(&subscip) );
712
713 /* create the variable mapping hash map */
716
717 success = FALSE;
718 if( heurdata->uselprows )
719 {
720 char probname[SCIP_MAXSTRLEN];
721
722 /* copy all plugins */
724
725 /* get name of the original problem and add the string "_gcgdinssub" */
726 (void) SCIPsnprintf(probname, SCIP_MAXSTRLEN, "%s_gcgdinssub", SCIPgetProbName(scip));
727
728 /* create the subproblem */
729 SCIP_CALL( SCIPcreateProb(subscip, probname, NULL, NULL, NULL, NULL, NULL, NULL, NULL) );
730
731 /* copy all variables */
732 SCIP_CALL( SCIPcopyVars(scip, subscip, varmapfw, NULL, NULL, NULL, 0, TRUE) );
733 }
734 else
735 {
736 SCIP_CALL( SCIPcopy(scip, subscip, varmapfw, NULL, "gcgdins", TRUE, FALSE, FALSE, TRUE, &success) );
737
738 if( heurdata->copycuts )
739 {
740 /* copies all active cuts from cutpool of sourcescip to linear constraints in targetscip */
742 }
743
744 SCIPdebugMessage("Copying the SCIP instance was %ssuccessful.\n", success ? "" : "not ");
745 }
746
747 for( i = 0; i < nvars; i++ )
748 subvars[i] = (SCIP_VAR*) SCIPhashmapGetImage(varmapfw, vars[i]);
749
750 /* free hash map */
752
753 fixingcounter = 0;
754 zerocounter = 0;
755
756 SCIPstatisticPrintf("gcgdins statistic: called at node %"SCIP_LONGINT_FORMAT"\n", SCIPgetNNodes(scip));
757
758 /* create variables and rebound them if their bounds differ by more than 0.5 */
759 SCIP_CALL( createSubproblem(scip, subscip, vars, subvars, nbinvars, nintvars, heurdata->uselprows, &fixingcounter, &zerocounter) );
760 SCIPdebugMessage("DINS subproblem: %d vars (%d binvars & %d intvars), %d cons\n",
761 SCIPgetNVars(subscip), SCIPgetNBinVars(subscip) , SCIPgetNIntVars(subscip) , SCIPgetNConss(subscip));
762
764
765 /* do not abort subproblem on CTRL-C */
766 SCIP_CALL( SCIPsetBoolParam(subscip, "misc/catchctrlc", FALSE) );
767
768 /* disable output to console */
769 SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 0) );
770
771 /* check whether there is enough time and memory left */
772 SCIP_CALL( SCIPgetRealParam(scip, "limits/time", &timelimit) );
773 if( !SCIPisInfinity(scip, timelimit) )
774 timelimit -= SCIPgetSolvingTime(scip);
775 SCIP_CALL( SCIPgetRealParam(scip, "limits/memory", &memorylimit) );
776
777 /* substract the memory already used by the main SCIP and the estimated memory usage of external software */
778 if( !SCIPisInfinity(scip, memorylimit) )
779 {
780 memorylimit -= SCIPgetMemUsed(scip)/1048576.0;
781 memorylimit -= SCIPgetMemExternEstim(scip)/1048576.0;
782 }
783
784 /* abort if no time is left or not enough memory to create a copy of SCIP, including external memory usage */
785 if( timelimit <= 0.0 || memorylimit <= 2.0*SCIPgetMemExternEstim(scip)/1048576.0 )
786 goto TERMINATE;
787
788 /* set limits for the subproblem */
789 SCIP_CALL( SCIPsetLongintParam(subscip, "limits/nodes", nsubnodes) );
790 SCIP_CALL( SCIPsetIntParam(subscip, "limits/bestsol", 3) );
791 SCIP_CALL( SCIPsetRealParam(subscip, "limits/time", timelimit) );
792 SCIP_CALL( SCIPsetRealParam(subscip, "limits/memory", memorylimit) );
793
794 /* forbid recursive call of heuristics and separators solving subMIPs */
795 SCIP_CALL( SCIPsetSubscipsOff(subscip, TRUE) );
796
797 /* disable cutting plane separation */
799
800 /* disable expensive presolving */
802
803 /* use best estimate node selection */
804 if( SCIPfindNodesel(subscip, "estimate") != NULL && !SCIPisParamFixed(subscip, "nodeselection/estimate/stdpriority") )
805 {
806 SCIP_CALL( SCIPsetIntParam(subscip, "nodeselection/estimate/stdpriority", INT_MAX/4) );
807 }
808
809 /* use inference branching */
810 if( SCIPfindBranchrule(subscip, "inference") != NULL && !SCIPisParamFixed(subscip, "branching/inference/priority") )
811 {
812 SCIP_CALL( SCIPsetIntParam(subscip, "branching/inference/priority", INT_MAX/4) );
813 }
814
815 /* disable conflict analysis */
816 if( !SCIPisParamFixed(subscip, "conflict/enable") )
817 {
818 SCIP_CALL( SCIPsetBoolParam(subscip, "conflict/enable", FALSE) );
819 }
820
821 /* get the best MIP-solution known so far */
822 bestsol = SCIPgetBestSol(scip);
823 assert(bestsol != NULL);
824
825 /* get solution pool and number of solutions in pool */
826 sols = SCIPgetSols(scip);
827 nsols = SCIPgetNSols(scip);
829 checklength = MIN(nsols, heurdata->solnum);
830 assert(sols != NULL);
831 assert(nsols > 0);
832
833 /* create fixing flag array */
835
836 /* if new binary variables have been created, e.g., due to column generation, reallocate the delta array */
838 {
839 int newsize;
840
842 assert(newsize >= nbinvars);
843
845 delta = heurdata->delta;
846
847 /* initialize new part of delta array */
848 for( i = heurdata->deltalength; i < newsize; i++ )
849 delta[i] = TRUE;
850
851 heurdata->deltalength = newsize;
852 }
853
854 /* fixing for binary variables */
855 /* hard fixing for some with mipsol(s)=lpsolval=rootlpsolval and preparation for soft fixing for the remaining */
856 ufcount = 0;
857 for( i = 0; i < nbinvars; i++ )
858 {
859 /* soft fixing if the variable somewhen changed its value or the relaxations differ by adding a local branching constraint */
860 fixed[i] = FALSE;
861
862 /* get the current relaxation solution for each variable */
863 lpsolval = SCIPgetRelaxSolVal(scip, vars[i]);
864 /* get the current MIP solution for each variable */
865 mipsolval = SCIPgetSolVal(scip, bestsol, vars[i]);
866 /* get the root relaxation solution for each variable */
867 rootlpsolval = SCIPgetSolVal(scip, heurdata->rootsol, vars[i]);
868
869 if( SCIPisFeasEQ(scip, lpsolval, mipsolval) && SCIPisFeasEQ(scip, mipsolval, rootlpsolval) )
870 {
871 /* update delta */
872 if( nsols > 1 && heurdata->lastnsolsfound != nsolsfound && delta[i] ) /* no need to update delta[i] if already FALSE */
873 {
874 /* no need to update delta[i] if already FALSE or sols[i] already checked on previous run or worse than DINS-solution of last run */
875 for( j = 0; delta[i] && j < checklength && SCIPgetSolHeur(scip, sols[j]) != heur ; j++ )
876 {
877 solval = SCIPgetSolVal(scip, sols[j], vars[i]);
878 delta[i] = delta[i] && SCIPisFeasEQ(scip, mipsolval, solval);
879 }
880 }
881
882 /* hard fixing if rootlpsolval=nodelpsolval=mipsolval(s) and delta (is TRUE) */
883 if( delta[i] && SCIPisFeasEQ(scip, mipsolval, lpsolval) && SCIPisFeasEQ(scip, mipsolval, rootlpsolval )
884 && SCIPisFeasEQ(scip, rootlpsolval, lpsolval) )
885 {
886 SCIP_CALL( SCIPfixVar(subscip, subvars[i], mipsolval, &infeasible, &success) );
887 fixed[i] = !infeasible;
888 if( !success )
889 {
890 SCIPdebugMessage("variable %d was already fixed\n", i);
891 }
892 else
893 {
894 ++fixingcounter;
895 if( SCIPisZero(scip, mipsolval) )
896 ++zerocounter;
897 }
898 if( infeasible )
899 {
900 SCIPdebugMessage("fixing of variable %d to value %f was infeasible\n", i, mipsolval);
901 }
902 }
903 }
904 if( !fixed[i] )
905 ufcount++;
906 }
907
908#ifdef SCIP_STATISTIC
909 intfixingrate = (SCIP_Real)fixingcounter / (SCIP_Real)(MAX(nbinvars + nintvars, 1));
910 zerofixingrate = (SCIP_Real)zerocounter / MAX((SCIP_Real)fixingcounter, 1.0);
911#endif
912
913 /* store the number of found solutions for next run */
915
916 /* perform prepared softfixing for all unfixed vars if the number of unfixed vars is larger than the neighborhoodsize (otherwise it will be useless) */
917 if( ufcount > heurdata->neighborhoodsize )
918 {
919 SCIP_CALL( addLocalBranchingConstraint(scip, subscip, subvars, heurdata, fixed) );
920 }
921
922 /* free fixing flag array */
923 SCIPfreeBufferArray(scip, &fixed);
924
925 /* add an objective cutoff */
927
929 {
931 upperbound = SCIPgetUpperbound(scip) - SCIPsumepsilon(scip);
932 cutoff = MIN(upperbound, cutoff);
933 }
934 else
935 {
936 if( SCIPgetUpperbound(scip) >= 0 )
938 else
940 upperbound = SCIPgetUpperbound(scip) - SCIPsumepsilon(scip);
941 cutoff = MIN(upperbound, cutoff);
942 }
943 SCIP_CALL( SCIPsetObjlimit(subscip, cutoff) );
944
945#ifdef SCIP_STATISTIC
946 heurdata->avgfixrate += intfixingrate;
947 heurdata->avgzerorate += zerofixingrate;
948#endif
949
950 /* presolve the subproblem */
951 retcode = SCIPpresolve(subscip);
952
953 /* errors in solving the subproblem should not kill the overall solving process;
954 * hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
955 */
956 if( retcode != SCIP_OKAY )
957 {
958#ifndef NDEBUG
960#endif
961 SCIPwarningMessage(scip, "Error while presolving subproblem in GCG RINS heuristic; sub-SCIP terminated with code <%d>\n",retcode);
962 goto TERMINATE;
963 }
964
965 SCIPdebugMessage("GCG DINS presolved subproblem: %d vars, %d cons, success=%u\n", SCIPgetNVars(subscip), SCIPgetNConss(subscip), success);
966
967#ifdef SCIP_STATISTIC
968 allfixingrate = (SCIPgetNOrigVars(subscip) - SCIPgetNVars(subscip)) / (SCIP_Real)SCIPgetNOrigVars(subscip);
969
970 /* additional variables added in presolving may lead to the subSCIP having more variables than the original */
971 allfixingrate = MAX(allfixingrate, 0.0);
972#endif
973
974 /* solve the subproblem */
975 SCIPdebugMessage("solving DINS sub-MIP with neighborhoodsize %d and maxnodes %"SCIP_LONGINT_FORMAT"\n", heurdata->neighborhoodsize, nsubnodes);
976 retcode = SCIPsolve(subscip);
977
978 /* Errors in solving the subproblem should not kill the overall solving process
979 * Hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
980 */
981 if( retcode != SCIP_OKAY )
982 {
983#ifndef NDEBUG
985#endif
986 SCIPwarningMessage(scip, "Error while solving subproblem in DINS heuristic; sub-SCIP terminated with code <%d>\n", retcode);
987 }
988
989 heurdata->usednodes += SCIPgetNNodes(subscip);
990 nsubsols = SCIPgetNSols(subscip);
991#ifdef SCIP_STATISTIC
992 heurdata->subsciptime += SCIPgetTotalTime(subscip);
993 heurdata->totalsols += nsubsols;
994#endif
995 SCIPdebugMessage("DINS used %"SCIP_LONGINT_FORMAT"/%"SCIP_LONGINT_FORMAT" nodes and found %d solutions\n", SCIPgetNNodes(subscip), nsubnodes, nsubsols);
996
997 /* check, whether a (new) solution was found */
998 if( nsubsols > 0 )
999 {
1000 SCIP_SOL** subsols;
1001
1002 /* check, whether a solution was found; due to numerics, it might happen that not all solutions are feasible -> try all solutions until one was accepted */
1003 subsols = SCIPgetSols(subscip);
1004 success = FALSE;
1005 for( i = 0; i < nsubsols && !success; ++i )
1006 {
1007 SCIP_CALL( createNewSol(scip, subscip, subvars, heur, subsols[i], &success) );
1008 if( success )
1010 }
1011
1012#ifdef SCIP_STATISTIC
1013 SCIPstatisticPrintf("gcgdins statistic: fixed %6.3f integer variables ( %6.3f zero), %6.3f all variables, needed %6.1f sec (SCIP time: %6.1f sec), %"SCIP_LONGINT_FORMAT" nodes, found %d solutions, solution %10.4f found at node %"SCIP_LONGINT_FORMAT"\n",
1014 intfixingrate, zerofixingrate, allfixingrate, SCIPgetSolvingTime(subscip), SCIPgetSolvingTime(scip), SCIPgetNNodes(subscip), nsubsols,
1015 success ? SCIPgetPrimalbound(scip) : SCIPinfinity(scip), nsubsols > 0 ? SCIPsolGetNodenum(SCIPgetBestSol(subscip)) : -1 );
1016#endif
1017
1018 }
1019
1020 TERMINATE:
1021 /* free subproblem */
1022 SCIPfreeBufferArray(scip, &subvars);
1023 SCIP_CALL( SCIPfree(&subscip) );
1024
1025 return SCIP_OKAY;
1026}
1027
1028
1029/*
1030 * primal heuristic specific interface methods
1031 */
1032
1033/** creates the GCG DINS primal heuristic and includes it in SCIP */
1035 GCG* gcg /**< GCG data structure */
1036 )
1037{
1039 SCIP_HEUR* heur;
1041
1042 /* create Gcgdins primal heuristic data */
1044 heurdata->gcg = gcg;
1045
1046 /* include primal heuristic */
1049 HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecGcgdins, heurdata) );
1050
1051 assert(heur != NULL);
1052
1053 /* set non-NULL pointers to callback methods */
1054 SCIP_CALL( SCIPsetHeurFree(origprob, heur, heurFreeGcgdins) );
1055 SCIP_CALL( SCIPsetHeurInitsol(origprob, heur, heurInitsolGcgdins) );
1056 SCIP_CALL( SCIPsetHeurExitsol(origprob, heur, heurExitsolGcgdins) );
1057
1058 /* add DINS primal heuristic parameters */
1059 SCIP_CALL( SCIPaddLongintParam(origprob, "heuristics/"HEUR_NAME"/nodesofs",
1060 "number of nodes added to the contingent of the total nodes",
1062 SCIP_CALL( SCIPaddRealParam(origprob, "heuristics/"HEUR_NAME"/nodesquot",
1063 "contingent of sub problem nodes in relation to the number of nodes of the original problem",
1065 SCIP_CALL( SCIPaddLongintParam(origprob, "heuristics/"HEUR_NAME"/minnodes",
1066 "minimum number of nodes required to start the subproblem",
1068 SCIP_CALL( SCIPaddIntParam(origprob, "heuristics/"HEUR_NAME"/solnum",
1069 "number of pool-solutions to be checked for flag array update (for hard fixing of binary variables)",
1070 &heurdata->solnum, FALSE, DEFAULT_SOLNUM, 1, INT_MAX, NULL, NULL) );
1071 SCIP_CALL( SCIPaddIntParam(origprob, "heuristics/"HEUR_NAME"/neighborhoodsize",
1072 "radius (using Manhattan metric) of the incumbent's neighborhood to be searched",
1074 SCIP_CALL( SCIPaddLongintParam(origprob, "heuristics/"HEUR_NAME"/maxnodes",
1075 "maximum number of nodes to regard in the subproblem",
1077 SCIP_CALL( SCIPaddRealParam(origprob, "heuristics/"HEUR_NAME"/minimprove",
1078 "factor by which "HEUR_NAME" should at least improve the incumbent",
1080 SCIP_CALL( SCIPaddLongintParam(origprob, "heuristics/"HEUR_NAME"/nwaitingnodes",
1081 "number of nodes without incumbent change that heuristic should wait",
1083 SCIP_CALL( SCIPaddBoolParam(origprob, "heuristics/"HEUR_NAME"/uselprows",
1084 "should subproblem be created out of the rows in the LP rows?",
1086 SCIP_CALL( SCIPaddBoolParam(origprob, "heuristics/"HEUR_NAME"/copycuts",
1087 "if uselprows == FALSE, should all active cuts from cutpool be copied to constraints in subproblem?",
1089
1090 return SCIP_OKAY;
1091}
SCIP_DECL_HEUREXITSOL(Heur2opt::scip_exitsol)
SCIP_DECL_HEURINITSOL(Heur2opt::scip_initsol)
SCIP_DECL_HEURFREE(Heur2opt::scip_free)
SCIP_DECL_HEUREXEC(Heur2opt::scip_exec)
#define SCIP_MAXSTRLEN
#define SCIP_Longint
#define SCIP_Bool
#define MIN(x, y)
#define SCIP_Real
#define MAX(x, y)
#define SCIP_LONGINT_FORMAT
#define REALABS(x)
#define SCIP_LONGINT_MAX
#define TRUE
#define FALSE
GCG interface methods.
SCIP_RETCODE SCIPcreateConsLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_RETCODE SCIPcopyVars(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int nfixedvars, SCIP_Bool global)
SCIP_RETCODE SCIPcopy(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool threadsafe, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
SCIP_RETCODE GCGtransformMastersolToOrigsol(GCG *gcg, SCIP_SOL *mastersol, SCIP_SOL **origsol, SCIP_Bool ignorelocalvarbnds, SCIP_Bool *violatesvarbnds)
Definition misc.c:135
SCIP * GCGgetOrigprob(GCG *gcg)
Definition gcg.cpp:87
SCIP * GCGgetMasterprob(GCG *gcg)
Definition gcg.cpp:99
SCIP_Bool SCIPisStopped(SCIP *scip)
SCIP_RETCODE SCIPfree(SCIP **scip)
SCIP_RETCODE SCIPcreate(SCIP **scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
int SCIPgetNIntVars(SCIP *scip)
const char * SCIPgetProbName(SCIP *scip)
SCIP_RETCODE SCIPsetObjlimit(SCIP *scip, SCIP_Real objlimit)
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
int SCIPgetNVars(SCIP *scip)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNConss(SCIP *scip)
int SCIPgetNOrigVars(SCIP *scip)
SCIP_RETCODE SCIPcreateProb(SCIP *scip, const char *name, SCIP_DECL_PROBDELORIG((*probdelorig)), SCIP_DECL_PROBTRANS((*probtrans)), SCIP_DECL_PROBDELTRANS((*probdeltrans)), SCIP_DECL_PROBINITSOL((*probinitsol)), SCIP_DECL_PROBEXITSOL((*probexitsol)), SCIP_DECL_PROBCOPY((*probcopy)), SCIP_PROBDATA *probdata)
int SCIPgetNBinVars(SCIP *scip)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
SCIP_RETCODE SCIPaddLongintParam(SCIP *scip, const char *name, const char *desc, SCIP_Longint *valueptr, SCIP_Bool isadvanced, SCIP_Longint defaultvalue, SCIP_Longint minvalue, SCIP_Longint maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_Bool SCIPisParamFixed(SCIP *scip, const char *name)
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
SCIP_RETCODE SCIPsetSubscipsOff(SCIP *scip, SCIP_Bool quiet)
SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value)
SCIP_RETCODE SCIPsetPresolving(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
SCIP_BRANCHRULE * SCIPfindBranchrule(SCIP *scip, const char *name)
SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_RETCODE SCIPsetHeurExitsol(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEUREXITSOL((*heurexitsol)))
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
SCIP_RETCODE SCIPincludeHeurBasic(SCIP *scip, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, SCIP_HEURTIMING timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata)
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
SCIP_Longint SCIPheurGetNSolsFound(SCIP_HEUR *heur)
SCIP_Longint SCIPheurGetNBestSolsFound(SCIP_HEUR *heur)
SCIP_Longint SCIPheurGetNCalls(SCIP_HEUR *heur)
SCIP_RETCODE SCIPsetHeurInitsol(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINITSOL((*heurinitsol)))
const char * SCIPheurGetName(SCIP_HEUR *heur)
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
SCIP_RETCODE SCIPgetLPRowsData(SCIP *scip, SCIP_ROW ***rows, int *nrows)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
SCIP_Longint SCIPgetMemExternEstim(SCIP *scip)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
SCIP_Longint SCIPgetMemUsed(SCIP *scip)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPallocMemory(scip, ptr)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
SCIP_NODESEL * SCIPfindNodesel(SCIP *scip, const char *name)
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
int SCIProwGetNNonz(SCIP_ROW *row)
SCIP_COL ** SCIProwGetCols(SCIP_ROW *row)
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
const char * SCIProwGetName(SCIP_ROW *row)
SCIP_Real SCIProwGetConstant(SCIP_ROW *row)
SCIP_Real * SCIProwGetVals(SCIP_ROW *row)
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
SCIP_HEUR * SCIPgetSolHeur(SCIP *scip, SCIP_SOL *sol)
SCIP_Longint SCIPsolGetNodenum(SCIP_SOL *sol)
int SCIPgetNSols(SCIP *scip)
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
SCIP_Longint SCIPgetSolNodenum(SCIP *scip, SCIP_SOL *sol)
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
SCIP_SOL ** SCIPgetSols(SCIP *scip)
SCIP_RETCODE SCIPtrySol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
SCIP_RETCODE SCIPpresolve(SCIP *scip)
SCIP_RETCODE SCIPsolve(SCIP *scip)
SCIP_Longint SCIPgetNSolsFound(SCIP *scip)
SCIP_Real SCIPgetPrimalbound(SCIP *scip)
SCIP_Real SCIPgetUpperbound(SCIP *scip)
SCIP_Longint SCIPgetNNodes(SCIP *scip)
SCIP_Real SCIPgetLowerbound(SCIP *scip)
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
SCIP_Real SCIPgetTotalTime(SCIP *scip)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPfeasCeil(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfeasFloor(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPsumepsilon(SCIP *scip)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
int SCIPvarGetProbindex(SCIP_VAR *var)
SCIP_Real SCIPvarGetRootSol(SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarLbGlobal(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_Real SCIPgetRelaxSolVal(SCIP *scip, SCIP_VAR *var)
SCIP_Bool SCIPisRelaxSolValid(SCIP *scip)
SCIP_RETCODE SCIPchgVarUbGlobal(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed)
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIPfreeMemory(GCGgetOrigprob(gcg), &divingdata)
static assert(heur !=NULL)
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
#define HEUR_FREQOFS
#define HEUR_DESC
#define HEUR_DISPCHAR
#define HEUR_MAXDEPTH
#define HEUR_PRIORITY
#define HEUR_NAME
SCIP * origprob
#define HEUR_FREQ
static SCIP_RETCODE getRootRelaxSol(GCG *gcg, SCIP_SOL **rootsol)
static SCIP_RETCODE addLocalBranchingConstraint(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEURDATA *heurdata, SCIP_Bool *fixed)
#define DEFAULT_NODESQUOT
#define DEFAULT_NWAITINGNODES
#define DEFAULT_NODESOFS
#define DEFAULT_COPYCUTS
#define DEFAULT_MAXNODES
#define HEUR_TIMING
#define DEFAULT_MINNODES
static SCIP_RETCODE createSubproblem(SCIP *scip, SCIP *subscip, SCIP_VAR **vars, SCIP_VAR **subvars, int nbinvars, int nintvars, SCIP_Bool uselprows, int *fixingcounter, int *zerocounter)
#define DEFAULT_NEIGHBORHOODSIZE
#define DEFAULT_SOLNUM
#define DEFAULT_MINIMPROVE
#define DEFAULT_USELPROWS
#define HEUR_USESSUBSCIP
static SCIP_RETCODE createNewSol(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEUR *heur, SCIP_SOL *subsol, SCIP_Bool *success)
SCIP_RETCODE GCGincludeHeurGcgdins(GCG *gcg)
DINS primal heuristic.
SCIP_HASHMAP * varmapfw
* result
SCIP_VAR ** vars
SCIP_Longint ncalls
int nbinvars
int j
SCIP_Longint nsolsfound
int nintvars
SCIP_Bool success
SCIP_Real solval
SCIPdebugMessage("feasibility pump finished [%d iterations done].\n", nloops)
SCIP_RETCODE retcode
int i
static SCIP_HEURDATA * heurdata
int nvars
SCIPfreeBufferArray(scip, &cycles)
divingdata rootsol
SCIP_VAR ** mastervars
int nmastervars
SCIP_Bool cutoff
#define NULL
GCG variable pricer.
#define SCIPstatisticPrintf
SCIP_RETCODE SCIPincludeDefaultPlugins(SCIP *scip)
SCIP_Longint nodesofs
SCIP_Real nodesquot
SCIP_Longint nwaitingnodes
SCIP_Bool * delta
SCIP_SOL * rootsol
SCIP_Bool firstrun
SCIP_Real minimprove
SCIP_Bool uselprows
SCIP_Bool copycuts
SCIP_Longint usednodes
SCIP_Longint lastnsolsfound
SCIP_Longint maxnodes
SCIP_Longint minnodes
struct SCIP_Cons SCIP_CONS
struct Gcg GCG
Definition type_gcg.h:44
struct SCIP_HeurData SCIP_HEURDATA
struct SCIP_Heur SCIP_HEUR
struct SCIP_Row SCIP_ROW
struct SCIP_Col SCIP_COL
SCIP_LPSOLSTAT_OPTIMAL
struct SCIP_HashMap SCIP_HASHMAP
SCIP_PARAMSETTING_OFF
SCIP_PARAMSETTING_FAST
SCIP_DIDNOTRUN
SCIP_DELAYED
SCIP_DIDNOTFIND
SCIP_FOUNDSOL
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
SCIP_STAGE_SOLVING
struct SCIP_Sol SCIP_SOL
struct SCIP_Var SCIP_VAR
SCIP_VARTYPE_INTEGER
SCIP_VARTYPE_BINARY