GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
heur_origdiving.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_origdiving.c
30 * @brief primal heuristic interface for LP diving heuristics on the original variables
31 * @author Tobias Achterberg
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_origdiving.h"
41#include "gcg/relax_gcg.h"
42#include "gcg/gcg.h"
43
44
45#define HEUR_TIMING SCIP_HEURTIMING_AFTERPLUNGE
46#define HEUR_USESSUBSCIP FALSE
47
48
49/*
50 * Default parameter settings for all diving heuristics
51 */
52
53#define DEFAULT_MINRELDEPTH 0.0 /**< minimal relative depth to start diving */
54#define DEFAULT_MAXRELDEPTH 1.0 /**< maximal relative depth to start diving */
55#define DEFAULT_MAXLPITERQUOT 0.05 /**< maximal fraction of diving LP iterations compared to node LP iterations */
56#define DEFAULT_MAXLPITEROFS 1000 /**< additional number of allowed LP iterations */
57#define DEFAULT_MAXPRICEROUNDS 0 /**< maximal number of allowed pricing rounds (-1: no limit) */
58#define DEFAULT_USEFARKASONLY FALSE /**< perform pricing only if infeasibility is encountered */
59#define DEFAULT_MAXDIVEUBQUOT 0.8 /**< maximal quotient (curlowerbound - lowerbound)/(cutoffbound - lowerbound)
60 * where diving is performed (0.0: no limit) */
61#define DEFAULT_MAXDIVEAVGQUOT 0.0 /**< maximal quotient (curlowerbound - lowerbound)/(avglowerbound - lowerbound)
62 * where diving is performed (0.0: no limit) */
63#define DEFAULT_MAXDIVEUBQUOTNOSOL 0.1 /**< maximal UBQUOT when no solution was found yet (0.0: no limit) */
64#define DEFAULT_MAXDIVEAVGQUOTNOSOL 0.0 /**< maximal AVGQUOT when no solution was found yet (0.0: no limit) */
65#define DEFAULT_OTHERDIRECTION TRUE /**< try to branch the diving variable in the other direction in case of infeasibility */
66#define DEFAULT_BACKTRACK FALSE /**< single backtracking by choosing another variable in case of infeasibility */
67#define DEFAULT_MAXDISCREPANCY 2 /**< maximal discrepancy allowed in backtracking and limited discrepancy search */
68#define DEFAULT_MAXDISCDEPTH 0 /**< maximal depth until which a limited discrepancy search is performed */
69
70#define MINLPITER 10000 /**< minimal number of LP iterations allowed in each LP solving call */
71
72#ifdef SCIP_STATISTIC
73#define EVENTHDLR_NAME "origdiving"
74#define EVENTHDLR_DESC "event handler for origdiving solution statistics"
75#endif
76
77
78/* locally defined heuristic data for all diving heuristics */
79struct SCIP_HeurData
80{
81 GCG* gcg; /**< GCG data structure */
82 GCG_DECL_DIVINGFREE ((*divingfree)); /**< destructor of diving heuristic */
83 GCG_DECL_DIVINGINIT ((*divinginit)); /**< initialize diving heuristic */
84 GCG_DECL_DIVINGEXIT ((*divingexit)); /**< deinitialize diving heuristic */
85 GCG_DECL_DIVINGINITSOL ((*divinginitsol)); /**< solving process initialization method of diving heuristic */
86 GCG_DECL_DIVINGEXITSOL ((*divingexitsol)); /**< solving process deinitialization method of diving heuristic */
87 GCG_DECL_DIVINGINITEXEC ((*divinginitexec)); /**< execution initialization method of diving heuristic */
88 GCG_DECL_DIVINGEXITEXEC ((*divingexitexec)); /**< execution deinitialization method of diving heuristic */
89 GCG_DECL_DIVINGSELECTVAR ((*divingselectvar)); /**< variable selection method of diving heuristic */
90 GCG_DIVINGDATA* divingdata; /**< diving rule specific data */
91
92 SCIP_SOL* sol; /**< working solution */
93 SCIP_Real minreldepth; /**< minimal relative depth to start diving */
94 SCIP_Real maxreldepth; /**< maximal relative depth to start diving */
95 SCIP_Real maxlpiterquot; /**< maximal fraction of diving LP iterations compared to node LP iterations */
96 int maxlpiterofs; /**< additional number of allowed LP iterations */
97 int maxpricerounds; /**< maximal number of allowed pricing rounds (-1: no limit) */
98 SCIP_Bool usefarkasonly; /**< perform pricing only if infeasibility is encountered */
99 SCIP_Real maxdiveubquot; /**< maximal quotient (curlowerbound - lowerbound)/(cutoffbound - lowerbound)
100 * where diving is performed (0.0: no limit) */
101 SCIP_Real maxdiveavgquot; /**< maximal quotient (curlowerbound - lowerbound)/(avglowerbound - lowerbound)
102 * where diving is performed (0.0: no limit) */
103 SCIP_Real maxdiveubquotnosol; /**< maximal UBQUOT when no solution was found yet (0.0: no limit) */
104 SCIP_Real maxdiveavgquotnosol;/**< maximal AVGQUOT when no solution was found yet (0.0: no limit) */
105 SCIP_Bool otherdirection; /**< try to branch the diving variable in the other direction in case of infeasibility */
106 SCIP_Bool backtrack; /**< single backtracking by choosing another variable in case of infeasibility */
107 int maxdiscrepancy; /**< maximal discrepancy allowed in backtracking and limited discrepancy search */
108 int maxdiscdepth; /**< maximal depth until which a limited discrepancy search is performed */
109 SCIP_Longint nlpiterations; /**< LP iterations used in this heuristic */
110 SCIP_Longint npricerounds; /**< pricing rounds used in this heuristic */
111 int nsuccess; /**< number of runs that produced at least one feasible solution */
112
113#ifdef SCIP_STATISTIC
114 SCIP_Longint ncalls; /**< number of calls */
115 SCIP_Longint nsols; /**< number of solutions */
116 SCIP_Longint nimpsols; /**< number of improving solutions */
117 SCIP_Longint ndivesols; /**< number of integral diving LP solutions */
118 SCIP_Longint nimpdivesols; /**< number of improving integral diving LP solutions */
119 SCIP_Longint nroundsols; /**< number of integral solutions that have been obtained by rounding */
120 SCIP_Longint nimproundsols; /**< number of improving integral solutions obtained by rounding */
121 SCIP_Longint ndivenodes; /**< number of diving nodes */
122 SCIP_Longint nfarkas; /**< number of times an infeasibility was resolved by Farkas pricing */
123 SCIP_Longint notherdirections; /**< number of times a cutoff was resolved by branching in the other direction */
124 SCIP_Longint nbacktracks; /**< number of times a single backtracking at a deeper node was performed */
125 SCIP_Longint ndiscsearches; /**< number of times a limited discrepancy search was performed */
126 SCIP_Real bestprimalbd; /**< objective value of best solution found by this heuristic */
127 SCIP_Bool bestsolrounded; /**< was the best solution obtained by rounding? */
128#endif
129};
130
131#ifdef SCIP_STATISTIC
132/** event handler data */
134{
135 SCIP_HEUR** heurs; /**< diving heuristics known to the event handler */
136 int nheurs; /**< number of diving heuristics known to the event handler */
137 SCIP_HEUR* runningheur; /**< the diving heuristic that is currently running, or NULL */
138};
139#endif
140
141
142/*
143 * local methods
144 */
145
146
147/*
148 * Callback methods
149 */
150
151/** destructor of primal heuristic to free user data (called when SCIP is exiting) */
152static
153SCIP_DECL_HEURFREE(heurFreeOrigdiving) /*lint --e{715}*/
154{ /*lint --e{715}*/
156
157 assert(heur != NULL);
159
160 /* get heuristic data */
163
164 if( heurdata->divingfree != NULL )
165 {
166 SCIP_CALL( heurdata->divingfree(heurdata->gcg, heur) );
167 }
168
169 /* free heuristic data */
172
173 return SCIP_OKAY;
174}
175
176
177/** initialization method of primal heuristic (called after problem was transformed) */
178static
179SCIP_DECL_HEURINIT(heurInitOrigdiving) /*lint --e{715}*/
180{ /*lint --e{715}*/
182
183 assert(heur != NULL);
184
185 /* get heuristic data */
187 assert(heurdata != NULL);
188
189 /* create working solution */
191
192 /* initialize data */
196
197 /* diving rule specific initialization */
198 if( heurdata->divinginit != NULL )
199 {
200 SCIP_CALL( heurdata->divinginit(heurdata->gcg, heur) );
201 }
202
203 return SCIP_OKAY;
204}
205
206
207/** solving process initialization method of primal heuristic (called when branch and bound process is about to begin) */
208static
209SCIP_DECL_HEURINITSOL(heurInitsolOrigdiving)
210{ /*lint --e{715}*/
212
213 assert(heur != NULL);
214 assert(scip != NULL);
215
216 /* get heuristic data */
218 assert(heurdata != NULL);
219
220#ifdef SCIP_STATISTIC
221 /* initialize statistics */
222 heurdata->ncalls = 0;
223 heurdata->nsols = 0;
224 heurdata->nimpsols = 0;
225 heurdata->ndivesols = 0;
226 heurdata->nimpdivesols = 0;
227 heurdata->nroundsols = 0;
228 heurdata->nimproundsols = 0;
229 heurdata->ndivenodes = 0;
230 heurdata->nfarkas = 0;
231 heurdata->notherdirections = 0;
232 heurdata->nbacktracks = 0;
233 heurdata->ndiscsearches = 0;
234 heurdata->bestprimalbd = SCIPinfinity(scip);
235 heurdata->bestsolrounded = FALSE;
236#endif
237
238 /* diving rule specific initialization */
239 if( heurdata->divinginitsol != NULL )
240 {
241 SCIP_CALL( heurdata->divinginitsol(heurdata->gcg, heur) );
242 }
243
244 return SCIP_OKAY;
245}
246
247
248/** solving process deinitialization method of primal heuristic (called before branch and bound process data is freed) */
249static
250SCIP_DECL_HEUREXITSOL(heurExitsolOrigdiving)
251{ /*lint --e{715}*/
253
254 assert(heur != NULL);
255 assert(scip != NULL);
256
257 /* get heuristic data */
259 assert(heurdata != NULL);
260
261 /* diving rule specific deinitialization */
262 if( heurdata->divingexitsol != NULL )
263 {
264 SCIP_CALL( heurdata->divingexitsol(heurdata->gcg, heur) );
265 }
266
267 return SCIP_OKAY;
268}
269
270
271/** deinitialization method of primal heuristic (called before transformed problem is freed) */
272static
273SCIP_DECL_HEUREXIT(heurExitOrigdiving) /*lint --e{715}*/
274{ /*lint --e{715}*/
276
277 assert(heur != NULL);
278
279 /* get heuristic data */
281 assert(heurdata != NULL);
282
283 /* diving rule specific deinitialization */
284 if( heurdata->divingexit != NULL )
285 {
286 SCIP_CALL( heurdata->divingexit(heurdata->gcg, heur) );
287 }
288
289 /* free working solution */
291
292 return SCIP_OKAY;
293}
294
295
296/** execution method of primal heuristic */
297static
298SCIP_DECL_HEUREXEC(heurExecOrigdiving) /*lint --e{715}*/
299{ /*lint --e{715}*/
300 GCG* gcg;
302#ifdef SCIP_STATISTIC
303 SCIP_EVENTHDLR* eventhdlr;
304 SCIP_EVENTHDLRDATA* eventhdlrdata;
305#endif
322 SCIP_Longint nlpiterations; /* lp iterations performed in one single diving loop */
324 int npricerounds; /* pricing rounds performed in one single diving loop */
325 int totalpricerounds; /* pricing rounds performed in one call of the heuristic */
328 int depth;
333
334#ifdef NDEBUG
335 SCIP_RETCODE retstat;
336#endif
337
338#ifdef SCIP_STATISTIC
339 /* variable declarations for additional statistics */
340 int ndivenodes; /* number of diving nodes */
341 int maxreacheddepth; /* maximal diving depth reached in this call */
342 int nfarkas; /* number of times an infeasibility was resolved by Farkas pricing */
343 int notherdirections; /* number of times a cutoff was resolved by branching in the other direction */
344 int nbacktracks; /* number of times a single backtracking at a deeper node was performed */
345 int ndiscsearches; /* number of times a limited discrepancy search was performed */
346 SCIP_Longint totallpiters; /* lp iterations performed in one call of the heuristic */
347 SCIP_CLOCK* lptime; /* time spent for solving diving LPs */
348#endif
349
350 int i;
351
352 assert(heur != NULL);
353 assert(scip != NULL);
355
356 /* get heuristic data */
358 assert(heurdata != NULL);
359
361
362 /* get master problem */
365
366#ifdef SCIP_STATISTIC
367 /* get the origdiving event handler and its data */
369 assert(eventhdlr != NULL);
370 eventhdlrdata = SCIPeventhdlrGetData(eventhdlr);
371 assert(eventhdlrdata != NULL);
372#endif
373
375
376 /* only call heuristic, if an optimal LP solution is at hand */
379 return SCIP_OKAY;
380
381 /* only call heuristic, if the LP solution is basic (which allows fast resolve in diving) */
383 return SCIP_OKAY;
384
385 /* don't dive two times at the same node */
387 return SCIP_OKAY;
388
389 /* do not execute the heuristic on invalid relaxation solutions
390 * (which is the case if the node has been cut off)
391 */
393 return SCIP_OKAY;
394
396
397 /* diving heuristics on the original variables are only applicable if blocks have not been aggregated */
399 return SCIP_OKAY;
400
401 /* check if fundamental diving callbacks are present */
402 assert(heurdata->divingselectvar != NULL);
403
404 /* only try to dive, if we are in the correct part of the tree, given by minreldepth and maxreldepth */
407 maxdepth = MAX(maxdepth, 30);
409 return SCIP_OKAY;
410
411 /* calculate the maximal number of LP iterations until heuristic is aborted */
417
418 /* don't try to dive, if we took too many LP iterations during diving */
420 return SCIP_OKAY;
421
422 /* allow at least a certain number of LP iterations in this dive */
424
425 /* get number of fractional variables that should be integral */
427
428 /* don't try to dive, if there are no fractional variables */
429 if( nlpcands == 0 )
430 return SCIP_OKAY;
431
432 /* calculate the objective search bound */
433 if( SCIPgetNSolsFound(scip) == 0 )
434 {
435 if( heurdata->maxdiveubquotnosol > 0.0 )
438 else
440 if( heurdata->maxdiveavgquotnosol > 0.0 )
443 else
445 }
446 else
447 {
448 if( heurdata->maxdiveubquot > 0.0 )
451 else
456 else
458 }
462
463 /* calculate the maximal diving depth: 10 * min{number of integer variables, max depth} */
466 maxdivedepth *= 10;
467
468 /* allocate memory */
472
474
475 /* initialize arrays */
476 for( i = 0; i < heurdata->maxdiscdepth; ++i )
477 {
478 discrepancies[i] = 0;
480 }
481 for( i = 0; i < heurdata->maxdiscrepancy; ++i )
482 tabulist[i] = NULL;
483
484 /* diving rule specific initialization */
485 if( heurdata->divinginitexec != NULL )
486 {
487 SCIP_CALL( heurdata->divinginitexec(gcg, heur) );
488 }
489
490
492
493#ifdef SCIP_STATISTIC
494 /* notify the event handler of the diving heuristic that is now running */
495 eventhdlrdata->runningheur = heur;
496 ++heurdata->ncalls;
497#endif
498
499 /* start diving */
501
502 /* enables collection of variable statistics during probing */
504
505 /* get LP objective value */
508 lpobj = objval;
509
510 SCIPdebugMessage("(node %"SCIP_LONGINT_FORMAT") executing %s heuristic: depth=%d, %d fractionals, dualbound=%g, avgbound=%g, cutoffbound=%g, searchbound=%g\n",
513
514 /* dive as long we are in the given objective, depth and iteration limits and fractional variables exist, but
515 * - if possible, we dive at least with the depth 10
516 * - if the number of fractional variables decreased at least with 1 variable per 2 dive depths, we continue diving
517 */
518 lperror = FALSE;
519 cutoff = FALSE;
520 divedepth = 0;
521 discrepancy = 0;
522 npricerounds = 0;
525
526#ifdef SCIP_STATISTIC
527 ndivenodes = 0;
528 maxreacheddepth = 0;
529 nfarkas = 0;
530 notherdirections = 0;
531 nbacktracks = 0;
532 ndiscsearches = 0;
533 totallpiters = 0;
534#endif
535
537 && (divedepth < 10
540 && !SCIPisStopped(scip) )
541 {
542 SCIP_VAR* bestcand;
543 SCIP_Real bestcandsol;
546 SCIP_Bool bestcandroundup;
547
548 SCIP_Bool backtracked;
549 SCIP_Bool farkaspricing;
550 SCIP_Bool otherdirection;
551
552 divedepth++;
553
554#ifdef SCIP_STATISTIC
555 maxreacheddepth = MAX(maxreacheddepth, divedepth);
556 ++ndivenodes;
557#endif
558
559 /* get the current relaxation solution */
561
562 bestcand = NULL;
564 bestcandroundup = FALSE;
565
566 /* choose a variable to dive on */
567 SCIP_CALL( heurdata->divingselectvar(gcg, heur, tabulist, heurdata->maxdiscrepancy, &bestcand, &bestcandmayround, &bestcandroundup) );
568
569 /* if no variable could be chosen, abort diving */
570 if( bestcand == NULL )
571 {
572 SCIPdebugMessage("No variable for diving could be selected, diving aborted\n");
573 break;
574 }
575 assert(bestcand != NULL);
576
577 bestcandsol = SCIPgetSolVal(scip, heurdata->sol, bestcand);
578 bestfrac = SCIPfeasFrac(scip, bestcandsol);
579
580 /* memorize selected variables up to the maximal depth for discrepancy search */
582 selectedvars[divedepth-1] = bestcand;
583
584 /* if all candidates are roundable, try to round the solution */
585 if( bestcandmayround )
586 {
588
589 /* try to round solution from diving LP */
591
592 if( success )
593 {
594 SCIPdebugMessage("%s found roundable primal solution: obj=%g\n", SCIPheurGetName(heur), SCIPgetSolOrigObj(scip, heurdata->sol));
595
596 /* a rounded solution will only be accepted if its objective value is below the search bound */
598 {
599 /* try to add solution to SCIP */
600#ifdef SCIP_DEBUG
602#else
604#endif
605 /* check, if solution was feasible and good enough */
606 if( success )
607 {
608 SCIPdebugMessage(" -> solution was feasible and good enough\n");
610 }
611 }
612 }
613 }
614
615 backtracked = FALSE;
616 farkaspricing = FALSE;
617 otherdirection = FALSE;
618 do
619 {
620 /* if the variable is already fixed or if the solution value is outside the domain, numerical troubles may have
621 * occurred or variable was fixed by propagation while backtracking => Abort diving!
622 */
623 if( SCIPvarGetLbLocal(bestcand) >= SCIPvarGetUbLocal(bestcand) - 0.5 )
624 {
625 SCIPdebugMessage("Selected variable <%s> already fixed to [%g,%g] (solval: %.9f), diving aborted \n",
626 SCIPvarGetName(bestcand), SCIPvarGetLbLocal(bestcand), SCIPvarGetUbLocal(bestcand), bestcandsol);
627 cutoff = TRUE;
628 break;
629 }
630 if( SCIPisFeasLT(scip, bestcandsol, SCIPvarGetLbLocal(bestcand)) || SCIPisFeasGT(scip, bestcandsol, SCIPvarGetUbLocal(bestcand)) )
631 {
632 SCIPdebugMessage("selected variable's <%s> solution value is outside the domain [%g,%g] (solval: %.9f), diving aborted\n",
633 SCIPvarGetName(bestcand), SCIPvarGetLbLocal(bestcand), SCIPvarGetUbLocal(bestcand), bestcandsol);
634 assert(otherdirection);
635 break;
636 }
637
638
639 /* apply rounding of best candidate */
640 if( !farkaspricing && !backtracked )
641 {
643
644 if( bestcandroundup == !otherdirection )
645 {
646 /* round variable up */
647 SCIPdebugMessage(" dive %d/%d, LP iter %"SCIP_LONGINT_FORMAT"/%"SCIP_LONGINT_FORMAT", pricerounds %d/%d: var <%s>, sol=%g, oldbounds=[%g,%g], newbounds=[%g,%g]\n",
649 SCIPvarGetName(bestcand), bestcandsol, SCIPvarGetLbLocal(bestcand), SCIPvarGetUbLocal(bestcand),
650 SCIPfeasCeil(scip, bestcandsol), SCIPvarGetUbLocal(bestcand));
651 SCIP_CALL( SCIPchgVarLbProbing(scip, bestcand, SCIPfeasCeil(scip, bestcandsol)) );
652 }
653 else
654 {
655 /* round variable down */
656 SCIPdebugMessage(" dive %d/%d, LP iter %"SCIP_LONGINT_FORMAT"/%"SCIP_LONGINT_FORMAT", pricerounds %d/%d: var <%s>, sol=%g, oldbounds=[%g,%g], newbounds=[%g,%g]\n",
658 SCIPvarGetName(bestcand), bestcandsol, SCIPvarGetLbLocal(bestcand), SCIPvarGetUbLocal(bestcand),
659 SCIPvarGetLbLocal(bestcand), SCIPfeasFloor(scip, bestcandsol));
660 SCIP_CALL( SCIPchgVarUbProbing(scip, bestcand, SCIPfeasFloor(scip, bestcandsol)) );
661 }
662
663 /* apply domain propagation */
665
667 }
668
669 if( !cutoff || backtracked || farkaspricing )
670 {
671 /* resolve the diving LP */
672 /* Errors in the LP solver should not kill the overall solving process, if the LP is just needed for a heuristic.
673 * Hence in optimized mode, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
674 */
677#ifdef NDEBUG
678 if( (!heurdata->usefarkasonly || farkaspricing )
679 && (heurdata->maxpricerounds == -1 || totalpricerounds < heurdata->maxpricerounds) )
680 {
683 }
684 else
685 {
687 npricerounds = 0;
688 }
689 if( retstat != SCIP_OKAY )
690 {
691 SCIPwarningMessage(scip, "Error while solving LP in %s heuristic; LP solve terminated with code <%d>\n", SCIPheurGetName(heur), retstat);
692 }
693#else
694 if( (!heurdata->usefarkasonly || farkaspricing )
695 && (heurdata->maxpricerounds == -1 || totalpricerounds < heurdata->maxpricerounds) )
696 {
699 }
700 else
701 {
703 npricerounds = 0;
704 }
705#endif
707
708 if( lperror )
709 break;
710
711 /* update iteration count */
713#ifdef SCIP_STATISTIC
714 totallpiters += nlpiterations;
715#endif
718
719 /* get LP solution status, objective value, and fractional variables, that should be integral */
721 }
722
723 /* if infeasibility is encountered, perform Farkas pricing
724 * in order to reach feasibility again
725 */
727 && !farkaspricing && (heurdata->maxpricerounds == -1 || totalpricerounds < heurdata->maxpricerounds)
728 && !backtracked && !otherdirection )
729 {
730 SCIPdebugMessage(" *** infeasibility detected at level %d - perform Farkas pricing\n", SCIPgetProbingDepth(scip));
731#ifdef SCIP_STATISTIC
732 ++nfarkas;
733#endif
734 farkaspricing = TRUE;
735 }
736 else
737 farkaspricing = FALSE;
738
739 /* perform backtracking if a cutoff was detected and if Farkas pricing did not help */
740 if( (lpsolstat == SCIP_LPSOLSTAT_INFEASIBLE || cutoff) && !farkaspricing )
741 {
742 /* First, try to branch the variable into the other direction */
743 if( heurdata->otherdirection && !backtracked && !otherdirection )
744 {
745 SCIPdebugMessage(" *** cutoff detected at level %d - branch in other direction\n", SCIPgetProbingDepth(scip));
748#ifdef SCIP_STATISTIC
749 ++ndivenodes;
750 ++notherdirections;
751#endif
752 otherdirection = TRUE;
753 }
754 else
755 otherdirection = FALSE;
756
757 /* If branching in the other direction did not work or has not been tried, choose another variable */
758 if( !otherdirection && !backtracked )
759 {
760 /* Single backtracking (go back only one node) */
762 {
763 SCIPdebugMessage(" *** cutoff detected at level %d - backtrack one node\n", SCIPgetProbingDepth(scip));
766 --divedepth;
767
768 tabulist[discrepancy] = bestcand;
769 ++discrepancy;
770
771#ifdef SCIP_STATISTIC
772 ++nbacktracks;
773#endif
774 backtracked = TRUE;
775 }
776 /* Limited discrepancy search: If single backtracking was unsuccessful, backtrack further */
777 else if( heurdata->maxdiscdepth > 0 )
778 {
779 SCIPdebugMessage(" *** cutoff or infeasibility detected at level %d - performing discrepancy search\n", SCIPgetProbingDepth(scip));
780
781 /* go back until the search can differ from the previous search tree */
782 do
783 {
785 --divedepth;
786 }
787 while( divedepth > 0 &&
789
791 assert(divedepth < heurdata->maxdiscdepth);
792
794 {
795 /* add variable selected previously at this depth to the tabu list */
799 for( i = discrepancy; i < heurdata->maxdiscrepancy; ++i )
800 tabulist[i] = NULL;
801 for( i = divedepth + 1; i < heurdata->maxdiscdepth; ++i )
803
804#ifdef SCIP_STATISTIC
805 ++ndiscsearches;
806#endif
807 backtracked = TRUE;
808 }
809 else
810 {
811 assert(divedepth == 0);
812 }
813 }
814 }
815 else
816 backtracked = FALSE;
817 }
818 else
819 {
820 otherdirection = FALSE;
821 backtracked = FALSE;
822 }
823 }
824 while( backtracked || farkaspricing || otherdirection );
825
827 {
828 /* get new objective value */
830 objval = lpobj;
831
832 /* update pseudo cost values */
834 {
835 if( bestcandroundup )
836 {
838 objval - oldobjval, 1.0) );
839 }
840 else
841 {
843 objval - oldobjval, 1.0) );
844 }
845 }
846
847 /* get new number of fractional variables */
849 }
850 SCIPdebugMessage(" -> lpsolstat=%d, objval=%g/%g, nfrac=%d\n", lpsolstat, objval, searchbound, nlpcands);
851 }
852
853 /* check if a solution has been found */
854 /** @todo maybe this is unneccessary since solutions are also added in GCGrelaxUpdateCurrentSol() */
856 {
858
859 /* create solution from diving LP */
861 SCIPdebugMessage("%s found primal solution: obj=%g\n", SCIPheurGetName(heur), SCIPgetSolOrigObj(scip, heurdata->sol));
862
863 /* try to add solution to SCIP */
864#ifdef SCIP_DEBUG
866#else
868#endif
869
870 /* check, if solution was feasible and good enough */
871 if( success )
872 {
873 SCIPdebugMessage(" -> solution was feasible and good enough\n");
875 }
876
877#ifdef SCIP_STATISTIC
878 ++heurdata->nsols;
879 ++heurdata->ndivesols;
880
881 /* @todo: I need some better way to check whether the diving solution is improving */
883 {
884 ++heurdata->nimpsols;
885 ++heurdata->nimpdivesols;
886 }
887
888 if( SCIPgetSolTransObj(scip, heurdata->sol) < heurdata->bestprimalbd )
889 {
890 heurdata->bestprimalbd = SCIPgetSolTransObj(scip, heurdata->sol);
891 heurdata->bestsolrounded = FALSE;
892 }
893
894 SCIPstatisticPrintf("Origdiving statistic: %s found solution %13.6e , improving = %u , rounded = 0\n",
897#endif
898 }
899
900 /* end diving */
902
903 if( *result == SCIP_FOUNDSOL )
905
906#ifdef SCIP_STATISTIC
907 eventhdlrdata->runningheur = NULL;
908 heurdata->ndivenodes += ndivenodes;
909 heurdata->nfarkas += nfarkas;
910 heurdata->notherdirections += notherdirections;
911 heurdata->nbacktracks += nbacktracks;
912 heurdata->ndiscsearches += ndiscsearches;
913
914 if( ndivenodes > 0 )
915 {
916 SCIPstatisticPrintf("Origdiving statistic: %s at node %"SCIP_LONGINT_FORMAT" , %d dive nodes, max depth = %d, lptime = %6.1f sec, %"SCIP_LONGINT_FORMAT" lp iters, %d pricing rds, %d Farkas repairs, %d otherdir, %d single backtracks, %d disc searches\n",
917 SCIPheurGetName(heur), SCIPgetNNodes(scip), ndivenodes, maxreacheddepth, SCIPgetClockTime(scip, lptime), totallpiters, totalpricerounds, nfarkas, notherdirections, nbacktracks, ndiscsearches);
918 }
919#endif
920
921 /* free memory */
922 if( heurdata->divingexitexec != NULL )
923 {
924 SCIP_CALL( heurdata->divingexitexec(gcg, heur) );
925 }
930
931 SCIPdebugMessage("(node %"SCIP_LONGINT_FORMAT") finished %s heuristic: %d fractionals, dive %d/%d, LP iter %"SCIP_LONGINT_FORMAT"/%"SCIP_LONGINT_FORMAT", pricerounds %d/%d, objval=%g/%g, lpsolstat=%d, cutoff=%u\n",
934
935 return SCIP_OKAY;
936}
937
938
939#ifdef SCIP_STATISTIC
940/** destructor of event handler to free user data (called when SCIP is exiting) */
941static
942SCIP_DECL_EVENTFREE(eventFreeOrigdiving)
943{ /*lint --e{715}*/
944 SCIP_EVENTHDLRDATA* eventhdlrdata;
945
946 eventhdlrdata = SCIPeventhdlrGetData(eventhdlr);
947 assert(eventhdlrdata != NULL);
948
949 /* free memory */
950 assert((eventhdlrdata->heurs == NULL) == (eventhdlrdata->nheurs == 0));
951 SCIPfreeMemoryArrayNull(scip, &eventhdlrdata->heurs);
952
953 SCIPfreeMemory(scip, &eventhdlrdata);
954
955 SCIPeventhdlrSetData(eventhdlr, NULL);
956
957 return SCIP_OKAY;
958}
959
960/** initialization method of event handler (called after problem was transformed) */
961static
962SCIP_DECL_EVENTINIT(eventInitOrigdiving)
963{ /*lint --e{715}*/
964 assert(eventhdlr != NULL);
965
966 /* notify GCG that this event should catch the SOLFOUND event */
968
969 return SCIP_OKAY;
970}
971
972/** deinitialization method of event handler (called before transformed problem is freed) */
973static
974SCIP_DECL_EVENTEXIT(eventExitOrigdiving)
975{ /*lint --e{715}*/
976 assert(eventhdlr != NULL);
977
978 /* notify GCG that this event should drop the SOLFOUND event */
980
981 return SCIP_OKAY;
982}
983
984/** solving process deinitialization method of event handler (called before branch and bound process data is freed) */
985static
986SCIP_DECL_EVENTEXITSOL(eventExitsolOrigdiving)
987{ /*lint --e{715}*/
988 SCIP_EVENTHDLRDATA* eventhdlrdata;
989 int i;
990
991 assert(eventhdlr != NULL);
992
993 /* get event handler data */
994 eventhdlrdata = SCIPeventhdlrGetData(eventhdlr);
995 assert(eventhdlrdata != NULL);
996
997 /* print detailed statistics */
998 SCIPstatisticPrintf("Original Diving Heuristics : Calls Sols Improving DiveSols Improving RoundSols Improving Nodes LP iters Price rds max nFarkas Otherdir Single bt Discsrch BestPrimal Rounded?\n");
999 for( i = 0; i < eventhdlrdata->nheurs; ++i )
1000 {
1001 SCIP_HEUR* heur;
1003
1004 heur = eventhdlrdata->heurs[i];
1005
1006 /* get heuristic data */
1007 heurdata = SCIPheurGetData(heur);
1008 assert(heurdata != NULL);
1009
1011 SCIPheurGetName(heur), heurdata->ncalls, heurdata->nsols, heurdata->nimpsols, heurdata->ndivesols, heurdata->nimpdivesols, heurdata->nroundsols, heurdata->nimproundsols, heurdata->ndivenodes, heurdata->nlpiterations, heurdata->npricerounds, heurdata->maxpricerounds, heurdata->nfarkas, heurdata->notherdirections, heurdata->nbacktracks, heurdata->ndiscsearches);
1012 if( SCIPisInfinity(scip, heurdata->bestprimalbd) )
1013 SCIPstatisticPrintf(" infinity");
1014 else
1015 SCIPstatisticPrintf(" %13.6e", heurdata->bestprimalbd);
1016 SCIPstatisticPrintf(heurdata->bestsolrounded ? " yes\n" : " no\n");
1017 }
1018 SCIPstatisticPrintf("END\n");
1019 SCIPstatisticPrintf("\n");
1020
1021 return SCIP_OKAY;
1022}
1023
1024
1025/** execution method of event handler */
1026static
1027SCIP_DECL_EVENTEXEC(eventExecOrigdiving)
1028{ /*lint --e{715}*/
1029 SCIP_EVENTHDLRDATA* eventhdlrdata;
1030 SCIP_HEUR* heur;
1032 SCIP_SOL* sol;
1033 SCIP_HEUR* solheur;
1034
1035 assert(eventhdlr != NULL);
1036
1037 /* get event handler data */
1038 eventhdlrdata = SCIPeventhdlrGetData(eventhdlr);
1039 assert(eventhdlrdata != NULL);
1040
1041 /* get the diving heuristic which is currently running;
1042 * if no diving heuristic is currently running, abort
1043 */
1044 heur = eventhdlrdata->runningheur;
1045 if( heur == NULL )
1046 return SCIP_OKAY;
1047 assert(heur != NULL);
1048
1049 /* get heuristic data */
1050 heurdata = SCIPheurGetData(heur);
1051 assert(heurdata != NULL);
1052
1053 /* get new primal solution */
1054 sol = SCIPeventGetSol(event);
1055 assert(sol != NULL);
1056
1057 /* get the heuristic that found the solution (might differ from the diving heuristic) */
1058 solheur = SCIPgetSolHeur(scip, sol);
1059
1060 /* update the solution statistics */
1061 if( solheur != NULL && strcmp(SCIPheurGetName(solheur), "simplerounding") == 0 )
1062 {
1063 ++heurdata->nsols;
1064 ++heurdata->nroundsols;
1065
1067 {
1068 ++heurdata->nimpsols;
1069 ++heurdata->nimproundsols;
1070 }
1071
1072 if( SCIPgetSolTransObj(scip, sol) < heurdata->bestprimalbd )
1073 {
1074 heurdata->bestprimalbd = SCIPgetSolTransObj(scip, sol);
1075 heurdata->bestsolrounded = TRUE;
1076 }
1077
1078 SCIPstatisticPrintf("Origdiving statistic: %s found solution %13.6e , improving = %u , rounded = 1\n",
1080 }
1081
1082 return SCIP_OKAY;
1083}
1084#endif
1085
1086
1087/*
1088 * heuristic specific interface methods
1089 */
1090
1091/** gets diving rule specific data of a diving heuristic */
1093 SCIP_HEUR* heur /**< primal heuristic */
1094 )
1095{
1097
1098 assert(heur != NULL);
1099
1100 /* get heuristic data */
1101 heurdata = SCIPheurGetData(heur);
1102 assert(heurdata != NULL);
1103
1104 return heurdata->divingdata;
1105}
1106
1107/** sets diving rule specific data of a diving heuristic */
1109 SCIP_HEUR* heur, /**< primal heuristic */
1110 GCG_DIVINGDATA* divingdata /**< diving rule specific data */
1111 )
1112{
1114
1115 assert(heur != NULL);
1116
1117 /* get heuristic data */
1118 heurdata = SCIPheurGetData(heur);
1119 assert(heurdata != NULL);
1120
1122}
1123
1124/** creates an original diving heuristic and includes it in GCG */
1126 GCG* gcg, /**< GCG data structure */
1127 SCIP_HEUR** heur, /**< pointer to diving heuristic */
1128 const char* name, /**< name of primal heuristic */
1129 const char* desc, /**< description of primal heuristic */
1130 char dispchar, /**< display character of primal heuristic */
1131 int priority, /**< priority of the primal heuristic */
1132 int freq, /**< frequency for calling primal heuristic */
1133 int freqofs, /**< frequency offset for calling primal heuristic */
1134 int maxdepth, /**< maximal depth level to call heuristic at (-1: no limit) */
1135 GCG_DECL_DIVINGFREE ((*divingfree)), /**< destructor of diving heuristic */
1136 GCG_DECL_DIVINGINIT ((*divinginit)), /**< initialize diving heuristic */
1137 GCG_DECL_DIVINGEXIT ((*divingexit)), /**< deinitialize diving heuristic */
1138 GCG_DECL_DIVINGINITSOL ((*divinginitsol)), /**< solving process initialization method of diving heuristic */
1139 GCG_DECL_DIVINGEXITSOL ((*divingexitsol)), /**< solving process deinitialization method of diving heuristic */
1140 GCG_DECL_DIVINGINITEXEC ((*divinginitexec)), /**< execution initialization method of diving heuristic */
1141 GCG_DECL_DIVINGEXITEXEC ((*divingexitexec)), /**< execution deinitialization method of diving heuristic */
1142 GCG_DECL_DIVINGSELECTVAR ((*divingselectvar)), /**< variable selection method of diving heuristic */
1143 GCG_DIVINGDATA* divingdata /**< diving rule specific data (or NULL) */
1144 )
1145{
1146#ifdef SCIP_STATISTIC
1148 SCIP_EVENTHDLRDATA* eventhdlrdata;
1149 SCIP_EVENTHDLR* eventhdlr;
1150#endif
1152 char paramname[SCIP_MAXSTRLEN];
1153 SCIP* origprob;
1154
1156
1157#ifdef SCIP_STATISTIC
1158 /* get master problem */
1161
1162 /* get origdiving event handler and its data */
1164 assert(eventhdlr != NULL);
1165 eventhdlrdata = SCIPeventhdlrGetData(eventhdlr);
1166 assert(eventhdlrdata != NULL);
1167#endif
1168
1169 /* create original diving primal heuristic data */
1171
1172 /* set diving rule callbacks and data */
1173 heurdata->gcg = gcg;
1174 heurdata->divingfree = divingfree;
1175 heurdata->divinginit = divinginit;
1176 heurdata->divingexit = divingexit;
1177 heurdata->divinginitsol = divinginitsol;
1178 heurdata->divingexitsol = divingexitsol;
1179 heurdata->divinginitexec = divinginitexec;
1180 heurdata->divingexitexec = divingexitexec;
1181 heurdata->divingselectvar = divingselectvar;
1183
1184 /* include primal heuristic */
1186 name, desc, dispchar, priority, freq, freqofs,
1187 maxdepth, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecOrigdiving, heurdata) );
1188
1189 assert(*heur != NULL);
1190
1191 /* set non-NULL pointers to callback methods */
1192 SCIP_CALL( SCIPsetHeurFree(origprob, *heur, heurFreeOrigdiving) );
1193 SCIP_CALL( SCIPsetHeurInit(origprob, *heur, heurInitOrigdiving) );
1194 SCIP_CALL( SCIPsetHeurExit(origprob, *heur, heurExitOrigdiving) );
1195 SCIP_CALL( SCIPsetHeurInitsol(origprob, *heur, heurInitsolOrigdiving) );
1196 SCIP_CALL( SCIPsetHeurExitsol(origprob, *heur, heurExitsolOrigdiving) );
1197
1198 /* origdiving heuristic parameters */
1199 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/minreldepth", name);
1201 paramname,
1202 "minimal relative depth to start diving",
1204 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxreldepth", name);
1206 paramname,
1207 "maximal relative depth to start diving",
1209 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxlpiterquot", name);
1211 paramname,
1212 "maximal fraction of diving LP iterations compared to node LP iterations",
1214 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxlpiterofs", name);
1216 paramname,
1217 "additional number of allowed LP iterations",
1219 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxpricerounds", name);
1221 paramname,
1222 "maximal number of allowed pricing rounds (-1: no limit)",
1224 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/usefarkasonly", name);
1226 paramname,
1227 "perform pricing only if infeasibility is encountered",
1229 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxdiveubquot", name);
1231 paramname,
1232 "maximal quotient (curlowerbound - lowerbound)/(cutoffbound - lowerbound) where diving is performed (0.0: no limit)",
1234 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxdiveavgquot", name);
1236 paramname,
1237 "maximal quotient (curlowerbound - lowerbound)/(avglowerbound - lowerbound) where diving is performed (0.0: no limit)",
1239 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxdiveubquotnosol", name);
1241 paramname,
1242 "maximal UBQUOT when no solution was found yet (0.0: no limit)",
1244 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxdiveavgquotnosol", name);
1246 paramname,
1247 "maximal AVGQUOT when no solution was found yet (0.0: no limit)",
1249 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/otherdirection", name);
1251 paramname,
1252 "try to branch the diving variable in the other direction in case of infeasibility",
1254 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/backtrack", name);
1256 paramname,
1257 "single backtracking by choosing another variable in case of infeasibility",
1259 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxdiscdepth", name);
1261 paramname,
1262 "maximal depth until which a limited discrepancy search is performed",
1264 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxdiscrepancy", name);
1266 paramname,
1267 "maximal discrepancy allowed in backtracking and limited discrepancy search",
1269
1270#ifdef SCIP_STATISTIC
1271 /* register the diving heuristic to the origdiving event handler */
1272 assert((eventhdlrdata->heurs == NULL) == (eventhdlrdata->nheurs == 0));
1273 if( eventhdlrdata->nheurs == 0 )
1274 {
1275 SCIP_CALL( SCIPallocMemoryArray(masterprob, &eventhdlrdata->heurs, 1) ); /*lint !e506*/
1276 }
1277 else
1278 {
1279 SCIP_CALL( SCIPreallocMemoryArray(masterprob, &eventhdlrdata->heurs, eventhdlrdata->nheurs+1) );
1280 }
1281 eventhdlrdata->heurs[eventhdlrdata->nheurs] = *heur;
1282 ++eventhdlrdata->nheurs;
1283#endif
1284
1285 return SCIP_OKAY;
1286}
1287
1288/** creates event handler for origdiving event and includes it in the master problem */
1290 GCG* gcg /**< GCG data structure */
1291 )
1292{
1293#ifdef SCIP_STATISTIC
1295 SCIP_EVENTHDLRDATA* eventhdlrdata;
1296 SCIP_EVENTHDLR* eventhdlr;
1297
1298 /* get master problem */
1301
1302 /* create master event handler data */
1303 SCIP_CALL( SCIPallocMemory(masterprob, &eventhdlrdata) );
1304 assert(eventhdlrdata != NULL);
1305
1306 eventhdlr = NULL;
1307
1308 /* include event handler into the GCG master problem */
1310 eventExecOrigdiving, eventhdlrdata) );
1311 assert(eventhdlr != NULL);
1312
1313 /* set non fundamental callbacks via setter functions */
1314 SCIP_CALL( SCIPsetEventhdlrFree(masterprob, eventhdlr, eventFreeOrigdiving) );
1315 SCIP_CALL( SCIPsetEventhdlrInit(masterprob, eventhdlr, eventInitOrigdiving) );
1316 SCIP_CALL( SCIPsetEventhdlrExit(masterprob, eventhdlr, eventExitOrigdiving) );
1317 SCIP_CALL( SCIPsetEventhdlrExitsol(masterprob, eventhdlr, eventExitsolOrigdiving) );
1318
1319 /* initialize origdiving event handler data */
1320 eventhdlrdata->heurs = NULL;
1321 eventhdlrdata->nheurs = 0;
1322 eventhdlrdata->runningheur = NULL;
1323#endif
1324
1325 return SCIP_OKAY;
1326}
SCIP_DECL_EVENTEXEC(EventhdlrNewSol::scip_exec)
SCIP_DECL_EVENTINIT(EventhdlrNewSol::scip_init)
SCIP_DECL_EVENTEXIT(EventhdlrNewSol::scip_exit)
SCIP_DECL_EVENTEXITSOL(EventhdlrNewSol::scip_exitsol)
SCIP_DECL_EVENTFREE(EventhdlrNewSol::scip_free)
SCIP_DECL_HEUREXIT(Heur2opt::scip_exit)
SCIP_DECL_HEUREXITSOL(Heur2opt::scip_exitsol)
SCIP_DECL_HEURINIT(Heur2opt::scip_init)
SCIP_DECL_HEURINITSOL(Heur2opt::scip_initsol)
SCIP_DECL_HEURFREE(Heur2opt::scip_free)
SCIP_DECL_HEUREXEC(Heur2opt::scip_exec)
#define EVENTHDLR_DESC
#define EVENTHDLR_NAME
#define SCIP_MAXSTRLEN
#define SCIP_Longint
#define SCIP_REAL_MAX
#define SCIP_Bool
#define MIN(x, y)
#define SCIP_Real
#define MAX(x, y)
#define SCIP_LONGINT_FORMAT
#define TRUE
#define FALSE
GCG interface methods.
GCG_EXPORT int GCGgetNRelPricingprobs(GCG *gcg)
Definition relax_gcg.c:4095
SCIP * GCGgetOrigprob(GCG *gcg)
Definition gcg.cpp:87
GCG_EXPORT int GCGgetNPricingprobs(GCG *gcg)
Definition relax_gcg.c:4113
SCIP * GCGgetMasterprob(GCG *gcg)
Definition gcg.cpp:99
SCIP_Bool SCIPisStopped(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
int SCIPgetNIntVars(SCIP *scip)
int SCIPgetNBinVars(SCIP *scip)
SCIP_Bool SCIPisObjIntegral(SCIP *scip)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
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 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 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)
int SCIPgetNExternBranchCands(SCIP *scip)
SCIP_RETCODE SCIPincludeEventhdlrBasic(SCIP *scip, SCIP_EVENTHDLR **eventhdlrptr, const char *name, const char *desc, SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
SCIP_EVENTHDLR * SCIPfindEventhdlr(SCIP *scip, const char *name)
SCIP_EVENTHDLRDATA * SCIPeventhdlrGetData(SCIP_EVENTHDLR *eventhdlr)
SCIP_RETCODE SCIPsetEventhdlrExitsol(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTEXITSOL((*eventexitsol)))
void SCIPeventhdlrSetData(SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTHDLRDATA *eventhdlrdata)
SCIP_RETCODE SCIPsetEventhdlrFree(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTFREE((*eventfree)))
SCIP_RETCODE SCIPsetEventhdlrExit(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTEXIT((*eventexit)))
SCIP_RETCODE SCIPsetEventhdlrInit(SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_DECL_EVENTINIT((*eventinit)))
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
SCIP_SOL * SCIPeventGetSol(SCIP_EVENT *event)
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
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_RETCODE SCIPsetHeurExit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEUREXIT((*heurexit)))
SCIP_Longint SCIPheurGetNBestSolsFound(SCIP_HEUR *heur)
SCIP_Longint SCIPheurGetNCalls(SCIP_HEUR *heur)
SCIP_RETCODE SCIPsetHeurInitsol(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINITSOL((*heurinitsol)))
SCIP_RETCODE SCIPsetHeurInit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
const char * SCIPheurGetName(SCIP_HEUR *heur)
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
SCIP_Longint SCIPgetLastDivenode(SCIP *scip)
SCIP_Bool SCIPhasCurrentNodeLP(SCIP *scip)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
SCIP_Bool SCIPisLPSolBasic(SCIP *scip)
#define SCIPfreeMemoryArrayNull(scip, ptr)
#define SCIPreallocMemoryArray(scip, ptr, newnum)
#define SCIPallocMemoryArray(scip, ptr, num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPallocMemory(scip, ptr)
int SCIPgetProbingDepth(SCIP *scip)
SCIP_RETCODE SCIPchgVarUbProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_RETCODE SCIPchgVarLbProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_RETCODE SCIPpropagateProbing(SCIP *scip, int maxproprounds, SCIP_Bool *cutoff, SCIP_Longint *ndomredsfound)
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_RETCODE SCIProundSol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *success)
SCIP_RETCODE SCIPlinkRelaxSol(SCIP *scip, SCIP_SOL *sol)
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_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
SCIP_Real SCIPretransformObj(SCIP *scip, SCIP_Real obj)
SCIP_Longint SCIPgetNSolsFound(SCIP *scip)
int SCIPgetMaxDepth(SCIP *scip)
SCIP_Longint SCIPgetNNodes(SCIP *scip)
SCIP_Real SCIPgetDualbound(SCIP *scip)
SCIP_Real SCIPgetLowerbound(SCIP *scip)
SCIP_Real SCIPgetAvgLowerbound(SCIP *scip)
SCIP_Longint SCIPgetNNodeLPIterations(SCIP *scip)
SCIP_Real SCIPgetAvgDualbound(SCIP *scip)
SCIP_Real SCIPgetCutoffbound(SCIP *scip)
SCIP_RETCODE SCIPcreateClock(SCIP *scip, SCIP_CLOCK **clck)
SCIP_RETCODE SCIPstopClock(SCIP *scip, SCIP_CLOCK *clck)
SCIP_RETCODE SCIPfreeClock(SCIP *scip, SCIP_CLOCK **clck)
SCIP_Real SCIPgetClockTime(SCIP *scip, SCIP_CLOCK *clck)
SCIP_RETCODE SCIPstartClock(SCIP *scip, SCIP_CLOCK *clck)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Real SCIPfeasFrac(SCIP *scip, SCIP_Real val)
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 SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
int SCIPgetDepth(SCIP *scip)
SCIP_Real SCIPgetRelaxSolObj(SCIP *scip)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Bool SCIPisRelaxSolValid(SCIP *scip)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_RETCODE SCIPupdateVarPseudocost(SCIP *scip, SCIP_VAR *var, SCIP_Real solvaldelta, SCIP_Real objdelta, SCIP_Real weight)
void SCIPenableVarHistory(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIPfreeMemory(GCGgetOrigprob(gcg), &divingdata)
* bestcandmayround
static assert(heur !=NULL)
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
GCGheurSetDivingDataOrig(heur, NULL)
int nlpcands
SCIP * origprob
#define HEUR_TIMING
#define HEUR_USESSUBSCIP
* result
SCIP_Longint ncalls
#define DEFAULT_MAXLPITERQUOT
SCIP_Longint nsolsfound
#define MINLPITER
#define DEFAULT_MAXLPITEROFS
SCIP_Longint nlpiterations
SCIP_Bool success
SCIP_Longint maxnlpiterations
SCIPdebugMessage("feasibility pump finished [%d iterations done].\n", nloops)
int i
static SCIP_HEURDATA * heurdata
SCIPfreeBufferArray(scip, &cycles)
SCIP_Real bestfrac
SCIP_SOL * sol
SCIPstatistic(SCIP_CALL(SCIPfreeClock(scip, &lptime)))
int divedepth
#define DEFAULT_MAXDIVEUBQUOT
int maxdivedepth
SCIP_Real searchavgbound
SCIP_Bool lperror
#define DEFAULT_MAXPRICEROUNDS
int discrepancy
#define DEFAULT_MAXDISCREPANCY
SCIP_VAR ** selectedvars
SCIP_Real searchubbound
static SCIP_LPSOLSTAT lpsolstat
#define DEFAULT_MAXDIVEAVGQUOT
heurdata npricerounds
#define DEFAULT_BACKTRACK
#define DEFAULT_USEFARKASONLY
#define DEFAULT_MAXDIVEUBQUOTNOSOL
#define DEFAULT_MAXRELDEPTH
SCIP_Real oldobjval
#define DEFAULT_MAXDIVEAVGQUOTNOSOL
SCIP_Real searchbound
int startnlpcands
int maxdepth
int * discrepancies
int depth
#define DEFAULT_MINRELDEPTH
SCIP_Bool cutoff
#define DEFAULT_MAXDISCDEPTH
SCIP_VAR ** tabulist
SCIP_Real objval
int totalpricerounds
int divedepth
SCIP_Real lpobj
SCIP_Bool lpsolved
SCIP_RETCODE GCGincludeDivingHeurOrig(GCG *gcg, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, GCG_DECL_DIVINGFREE((*divingfree)), GCG_DECL_DIVINGINIT((*divinginit)), GCG_DECL_DIVINGEXIT((*divingexit)), GCG_DECL_DIVINGINITSOL((*divinginitsol)), GCG_DECL_DIVINGEXITSOL((*divingexitsol)), GCG_DECL_DIVINGINITEXEC((*divinginitexec)), GCG_DECL_DIVINGEXITEXEC((*divingexitexec)), GCG_DECL_DIVINGSELECTVAR((*divingselectvar)), GCG_DIVINGDATA *divingdata)
int discrepancy
SCIP_RETCODE GCGincludeEventHdlrOrigdiving(GCG *gcg)
#define DEFAULT_OTHERDIRECTION
GCG_DIVINGDATA * GCGheurGetDivingDataOrig(SCIP_HEUR *heur)
int depth
int totalpricerounds
primal heuristic interface for LP diving heuristics on the original variables
#define NULL
#define SCIPstatisticPrintf
SCIP_RETCODE GCGrelaxNewProbingnodeMaster(GCG *gcg)
Definition relax_gcg.c:4508
SCIP_RETCODE GCGrelaxPerformProbing(GCG *gcg, int maxlpiterations, SCIP_Longint *nlpiterations, SCIP_Real *lpobjvalue, SCIP_Bool *lpsolved, SCIP_Bool *lperror, SCIP_Bool *cutoff)
Definition relax_gcg.c:4756
SCIP_RETCODE GCGrelaxStartProbing(GCG *gcg, SCIP_HEUR *probingheur)
Definition relax_gcg.c:4390
SCIP_RETCODE GCGrelaxNewProbingnodeOrig(GCG *gcg)
Definition relax_gcg.c:4459
SCIP_RETCODE GCGrelaxPerformProbingWithPricing(GCG *gcg, int maxpricerounds, SCIP_Longint *nlpiterations, int *npricerounds, SCIP_Real *lpobjvalue, SCIP_Bool *lpsolved, SCIP_Bool *lperror, SCIP_Bool *cutoff)
Definition relax_gcg.c:4775
SCIP_RETCODE GCGrelaxEndProbing(GCG *gcg)
Definition relax_gcg.c:4794
SCIP_RETCODE GCGrelaxBacktrackProbing(GCG *gcg, int probingdepth)
Definition relax_gcg.c:4618
GCG relaxator.
SCIP_Real maxdiveubquot
GCG_DECL_DIVINGEXITSOL((*divingexitsol))
SCIP_Real maxlpiterquot
SCIP_Real maxdiveavgquotnosol
SCIP_Longint nlpiterations
GCG_DECL_DIVINGINITSOL((*divinginitsol))
SCIP_Bool otherdirection
GCG_DECL_DIVINGEXIT((*divingexit))
SCIP_Real maxreldepth
SCIP_Bool usefarkasonly
SCIP_Longint npricerounds
GCG_DECL_DIVINGSELECTVAR((*divingselectvar))
SCIP_Real maxdiveubquotnosol
GCG_MASTER_DIVINGDATA * divingdata
GCG_DECL_DIVINGEXITEXEC((*divingexitexec))
SCIP_Real maxdiveavgquot
GCG_DECL_DIVINGFREE((*divingfree))
GCG_DECL_DIVINGINITEXEC((*divinginitexec))
SCIP_Real minreldepth
GCG_DECL_DIVINGINIT((*divinginit))
struct SCIP_Clock SCIP_CLOCK
struct SCIP_Eventhdlr SCIP_EVENTHDLR
struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA
#define SCIP_EVENTTYPE_BESTSOLFOUND
#define SCIP_EVENTTYPE_SOLFOUND
struct Gcg GCG
Definition type_gcg.h:44
struct SCIP_HeurData SCIP_HEURDATA
struct SCIP_Heur SCIP_HEUR
enum SCIP_LPSolStat SCIP_LPSOLSTAT
SCIP_LPSOLSTAT_OPTIMAL
SCIP_LPSOLSTAT_INFEASIBLE
#define GCG_DECL_DIVINGFREE(x)
#define GCG_DECL_DIVINGEXIT(x)
#define GCG_DECL_DIVINGINITSOL(x)
#define GCG_DECL_DIVINGINITEXEC(x)
#define GCG_DECL_DIVINGINIT(x)
#define GCG_DECL_DIVINGSELECTVAR(x)
#define GCG_DECL_DIVINGEXITEXEC(x)
struct GCG_DivingData GCG_DIVINGDATA
#define GCG_DECL_DIVINGEXITSOL(x)
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