GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
heur_gcgpscostdiving.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_gcgpscostdiving.c
30 * @brief LP diving heuristic that chooses fixings w.r.t. the pseudo cost values
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
41#include "gcg/heur_origdiving.h"
42#include "gcg/gcg.h"
43#include "gcg/pricer_gcg.h"
44
45
46#define HEUR_NAME "gcgpscostdiving"
47#define HEUR_DESC "LP diving heuristic that chooses fixings w.r.t. the pseudo cost values"
48#define HEUR_DISPCHAR 'p'
49#define HEUR_PRIORITY -1002000
50#define HEUR_FREQ 10
51#define HEUR_FREQOFS 2
52#define HEUR_MAXDEPTH -1
53
54
55/*
56 * Default diving rule specific parameter settings
57 */
58
59#define DEFAULT_USEMASTERPSCOSTS FALSE /**< shall pseudocosts be calculated w.r.t. the master problem? */
60
61
62/* locally defined diving heuristic data */
63struct GCG_DivingData
64{
65 SCIP_Bool usemasterpscosts; /**< shall pseudocosts be calculated w.r.t. the master problem? */
66 SCIP_SOL* rootsol; /**< relaxation solution at the root node */
67 SCIP_Bool firstrun; /**< is the heuristic running for the first time? */
68 SCIP_Real* masterpscosts; /**< pseudocosts of the master variables */
69};
70
71
72/*
73 * local methods
74 */
75
76/** get relaxation solution of root node (in original variables) */
77static
79 GCG* gcg, /**< GCG data structure */
80 SCIP_SOL** rootsol /**< pointer to store root relaxation solution */
81 )
82{
84 SCIP_SOL* masterrootsol;
86 int nmastervars;
87 int i;
88
89 /* get master problem */
92
93 /* allocate memory for master root LP solution */
94 SCIP_CALL( SCIPcreateSol(masterprob, &masterrootsol, NULL) );
95
96 /* get master variable information */
99 assert(nmastervars >= 0);
100
101 /* store root LP values in working master solution */
102 for( i = 0; i < nmastervars; i++ )
104
105 /* calculate original root LP solution */
107
108 /* free memory */
109 SCIP_CALL( SCIPfreeSol(masterprob, &masterrootsol) );
110
111 return SCIP_OKAY;
112}
113
114/** calculate pseudocosts for the master variables */
115static
117 GCG* gcg, /**< GCG data structure */
118 SCIP_Real** masterpscosts /**< pointer to store the array of master pseudocosts */
119 )
120{
123 int nbinvars;
124 int nintvars;
125
126 int i;
127 int j;
128
130
131 /* get master problem */
134
135 /* get master variable data */
137
138 /* allocate memory */
140
141 /* calculate pseudocosts */
142 for( i = 0; i < nbinvars + nintvars; ++i )
143 {
144 SCIP_VAR* mastervar;
145 SCIP_VAR** masterorigvars;
146 SCIP_Real* masterorigvals;
147 int nmasterorigvars;
148
149 mastervar = mastervars[i];
150 masterorigvars = GCGmasterVarGetOrigvars(mastervar);
151 masterorigvals = GCGmasterVarGetOrigvals(mastervar);
152 nmasterorigvars = GCGmasterVarGetNOrigvars(mastervar);
153
154 (*masterpscosts)[i] = 0.0;
155 for( j = 0; j < nmasterorigvars; ++j )
156 {
157 SCIP_VAR* origvar;
158
159 origvar = masterorigvars[j];
160 if( !SCIPvarIsBinary(origvar) && !SCIPvarIsIntegral(origvar) )
161 continue;
162 (*masterpscosts)[i] += SCIPgetVarPseudocostVal(origprob, origvar, 0.0-masterorigvals[j]);
163 }
164 }
165
166 return SCIP_OKAY;
167}
168
169/** check whether an original variable and a master variable belong to the same block */
170static
172 SCIP_VAR* origvar, /**< original variable */
173 SCIP_VAR* mastervar /**< master variable */
174 )
175{
176 int origblock;
177 int masterblock;
178
179 /* get the blocks the variables belong to */
180 origblock = GCGvarGetBlock(origvar);
181 masterblock = GCGvarGetBlock(mastervar);
182
183 /* the original variable is a linking variable:
184 * check whether the master variable is either its direct copy
185 * or in one of its blocks
186 */
187 if( GCGoriginalVarIsLinking(origvar) )
188 {
189 assert(origblock == -2);
190 if( masterblock == -1 )
191 {
193
195
196 return mastervars[0] == mastervar;
197 }
198 else
199 {
200 assert(masterblock >= 0);
201 return GCGisLinkingVarInBlock(origvar, masterblock);
202 }
203 }
204 /* the original variable was directly copied to the master problem:
205 * check whether the master variable is its copy
206 */
207 else if( origblock == -1 )
208 {
210
213
214 return mastervars[0] == mastervar;
215 }
216 /* the original variable belongs to exactly one block */
217 else
218 {
219 assert(origblock >= 0);
220 return origblock == masterblock;
221 }
222}
223
224/** calculates the down-pseudocost for a given original variable w.r.t. the master variables in which it is contained */
225static
227 GCG* gcg, /**< GCG data structure */
228 SCIP_VAR* var, /**< problem variable */
229 SCIP_Real* masterpscosts, /**< master variable pseudocosts */
230 SCIP_Real* pscostdown /**< pointer to store the pseudocost value */
231 )
232{
235 SCIP_VAR** origmastervars;
236 SCIP_Real* origmastervals;
237 int nbinmastervars;
238 int nintmastervars;
239 int norigmastervars;
240 SCIP_Real roundval;
241 SCIP_Real masterlpval;
242 int idx;
243 int i;
245
246 /* get master problem */
249
250 /* get master variable information */
251 SCIP_CALL( SCIPgetVarsData(masterprob, &mastervars, NULL, &nbinmastervars, &nintmastervars, NULL, NULL) );
252
253 /* get master variables in which the original variable appears */
254 origmastervars = GCGoriginalVarGetMastervars(var);
255 origmastervals = GCGoriginalVarGetMastervals(var);
256 norigmastervars = GCGoriginalVarGetNMastervars(var);
257
259 *pscostdown = 0.0;
260
261 /* calculate sum of pseudocosts over all master variables
262 * which would violate the new original variable bound
263 */
264 if( SCIPisFeasNegative(masterprob, roundval) )
265 {
266 for( i = 0; i < nbinmastervars + nintmastervars; ++i )
267 {
269 {
270 masterlpval = SCIPgetSolVal(masterprob, NULL, mastervars[i]);
271 *pscostdown += masterpscosts[i] * SCIPfeasFrac(masterprob, masterlpval);
272 }
273 }
274 for( i = 0; i < norigmastervars; ++i )
275 {
276 idx = SCIPvarGetProbindex(origmastervars[i]);
277 masterlpval = SCIPgetSolVal(masterprob, NULL, origmastervars[i]);
278 if( (SCIPvarIsBinary(origmastervars[i]) || SCIPvarIsIntegral(origmastervars[i]) )
279 && SCIPisFeasLE(masterprob, origmastervals[i], roundval) )
280 *pscostdown -= masterpscosts[idx] * SCIPfeasFrac(masterprob, masterlpval);
281 }
282 }
283 else
284 {
285 for( i = 0; i < norigmastervars; ++i )
286 {
287 idx = SCIPvarGetProbindex(origmastervars[i]);
288 masterlpval = SCIPgetSolVal(masterprob, NULL, mastervars[i]);
289 if( (SCIPvarIsBinary(origmastervars[i]) || SCIPvarIsIntegral(origmastervars[i]) )
290 && SCIPisFeasGT(masterprob, origmastervals[i], roundval) )
291 *pscostdown += masterpscosts[idx] * SCIPfeasFrac(masterprob, masterlpval);
292 }
293 }
294
295 return SCIP_OKAY;
296}
297
298/** calculates the up-pseudocost for a given original variable w.r.t. the master variables in which it is contained */
299static
301 GCG* gcg, /**< GCG data structure */
302 SCIP_VAR* var, /**< problem variable */
303 SCIP_Real* masterpscosts, /**< master variable pseudocosts */
304 SCIP_Real* pscostup /**< pointer to store the pseudocost value */
305 )
306{
309 SCIP_VAR** origmastervars;
310 SCIP_Real* origmastervals;
311 int nbinmastervars;
312 int nintmastervars;
313 int norigmastervars;
314 SCIP_Real roundval;
315 SCIP_Real masterlpval;
316 int idx;
317 int i;
319
320 /* get master problem */
323
324 /* get master variable information */
325 SCIP_CALL( SCIPgetVarsData(masterprob, &mastervars, NULL, &nbinmastervars, &nintmastervars, NULL, NULL) );
326
327 /* get master variables in which the original variable appears */
328 origmastervars = GCGoriginalVarGetMastervars(var);
329 origmastervals = GCGoriginalVarGetMastervals(var);
330 norigmastervars = GCGoriginalVarGetNMastervars(var);
331
333 *pscostup = 0.0;
334
335 /* calculate sum of pseudocosts over all master variables
336 * which would violate the new original variable bound
337 */
338 if( SCIPisFeasPositive(masterprob, roundval) )
339 {
340 for( i = 0; i < nbinmastervars + nintmastervars; ++i )
341 {
343 {
344 masterlpval = SCIPgetSolVal(masterprob, NULL, mastervars[i]);
345 *pscostup += masterpscosts[i] * SCIPfeasFrac(masterprob, masterlpval);
346 }
347 }
348 for( i = 0; i < norigmastervars; ++i )
349 {
350 idx = SCIPvarGetProbindex(origmastervars[i]);
351 masterlpval = SCIPgetSolVal(masterprob, NULL, origmastervars[i]);
352 if( (SCIPvarIsBinary(origmastervars[i]) || SCIPvarIsIntegral(origmastervars[i]) )
353 && SCIPisFeasGE(masterprob, origmastervals[i], roundval) )
354 *pscostup -= masterpscosts[idx] * SCIPfeasFrac(masterprob, masterlpval);
355 }
356 }
357 else
358 {
359 for( i = 0; i < norigmastervars; ++i )
360 {
361 idx = SCIPvarGetProbindex(origmastervars[i]);
362 masterlpval = SCIPgetSolVal(masterprob, NULL, mastervars[i]);
363 if( (SCIPvarIsBinary(origmastervars[i]) || SCIPvarIsIntegral(origmastervars[i]) )
364 && SCIPisFeasLT(masterprob, origmastervals[i], roundval) )
365 *pscostup += masterpscosts[idx] * SCIPfeasFrac(masterprob, masterlpval);
366 }
367 }
368
369 return SCIP_OKAY;
370}
371
372/** calculates the pseudocost score for a given variable w.r.t. a given solution value and a given rounding direction */
373static
375 GCG* gcg, /**< GCG data structure */
376 GCG_DIVINGDATA* divingdata, /**< diving data */
377 SCIP_VAR* var, /**< problem variable */
378 SCIP_Real primsol, /**< primal solution of variable */
379 SCIP_Real rootsolval, /**< root relaxation solution of variable */
380 SCIP_Real frac, /**< fractionality of variable */
381 int rounddir, /**< -1: round down, +1: round up, 0: select due to pseudo cost values */
382 SCIP_Real* pscostquot, /**< pointer to store pseudo cost quotient */
383 SCIP_Bool* roundup /**< pointer to store whether the variable should be rounded up */
384 )
385{
386 SCIP_Real pscostdown;
387 SCIP_Real pscostup;
389
390 assert(pscostquot != NULL);
391 assert(roundup != NULL);
392 assert(SCIPisEQ(origprob, frac, primsol - SCIPfeasFloor(origprob, primsol)));
393
394 /* bound fractions to not prefer variables that are nearly integral */
395 frac = MAX(frac, 0.1);
396 frac = MIN(frac, 0.9);
397
398 /* get pseudo cost quotient */
399 if( divingdata->usemasterpscosts )
400 {
401 SCIP_CALL( calcPscostDownMaster(gcg, var, divingdata->masterpscosts, &pscostdown) );
402 SCIP_CALL( calcPscostUpMaster(gcg, var, divingdata->masterpscosts, &pscostup) );
403 }
404 else
405 {
406 pscostdown = SCIPgetVarPseudocostVal(origprob, var, 0.0-frac);
407 pscostup = SCIPgetVarPseudocostVal(origprob, var, 1.0-frac);
408 }
409 SCIPdebugMessage("Pseudocosts of variable %s: %g down, %g up\n", SCIPvarGetName(var), pscostdown, pscostup);
410 assert(!SCIPisNegative(origprob, pscostdown) && !SCIPisNegative(origprob,pscostup));
411
412 /* choose rounding direction */
413 if( rounddir == -1 )
414 *roundup = FALSE;
415 else if( rounddir == +1 )
416 *roundup = TRUE;
417 else if( primsol < rootsolval - 0.4 )
418 *roundup = FALSE;
419 else if( primsol > rootsolval + 0.4 )
420 *roundup = TRUE;
421 else if( frac < 0.3 )
422 *roundup = FALSE;
423 else if( frac > 0.7 )
424 *roundup = TRUE;
425 else if( pscostdown < pscostup )
426 *roundup = FALSE;
427 else
428 *roundup = TRUE;
429
430 /* calculate pseudo cost quotient */
431 if( *roundup )
432 *pscostquot = sqrt(frac) * (1.0+pscostdown) / (1.0+pscostup);
433 else
434 *pscostquot = sqrt(1.0-frac) * (1.0+pscostup) / (1.0+pscostdown);
435
436 /* prefer decisions on binary variables */
437 if( SCIPvarIsBinary(var) )
438 (*pscostquot) *= 1000.0;
439
440 return SCIP_OKAY;
441}
442
443
444/*
445 * Callback methods
446 */
447
448/** destructor of diving heuristic to free user data (called when GCG is exiting) */
449static
450GCG_DECL_DIVINGFREE(heurFreeGcgpscostdiving) /*lint --e{715}*/
451{ /*lint --e{715}*/
453
454 assert(heur != NULL);
455
456 /* free diving rule specific data */
461
462 return SCIP_OKAY;
463}
464
465
466/** initialization method of diving heuristic (called after problem was transformed) */
467static
468GCG_DECL_DIVINGINIT(heurInitGcgpscostdiving) /*lint --e{715}*/
469{ /*lint --e{715}*/
471
472 assert(heur != NULL);
473
474 /* get diving data */
477
478 /* initialize data */
479 divingdata->firstrun = TRUE;
480 divingdata->rootsol = NULL;
481 divingdata->masterpscosts = NULL;
482
483 return SCIP_OKAY;
484}
485
486
487/** deinitialization method of diving heuristic (called before transformed problem is freed) */
488static
489GCG_DECL_DIVINGEXIT(heurExitGcgpscostdiving) /*lint --e{715}*/
490{ /*lint --e{715}*/
493
494 assert(heur != NULL);
495
496 /* get diving data */
499
500 assert(divingdata->firstrun == TRUE || divingdata->rootsol != NULL);
501
502 /* free root relaxation solution */
503 if( divingdata->rootsol != NULL )
505
506 return SCIP_OKAY;
507}
508
509
510/** execution initialization method of diving heuristic (called when execution of diving heuristic is about to begin) */
511static
512GCG_DECL_DIVINGINITEXEC(heurInitexecGcgpscostdiving) /*lint --e{715}*/
513{ /*lint --e{715}*/
515
516 assert(heur != NULL);
517
518 /* get diving data */
521
522 /* if the heuristic is running for the first time, the root relaxation solution needs to be stored */
523 if( divingdata->firstrun )
524 {
525 assert(divingdata->rootsol == NULL);
527 assert(divingdata->rootsol != NULL);
528 divingdata->firstrun = FALSE;
529 }
530
531 SCIP_CALL( calcMasterPscosts(gcg, &divingdata->masterpscosts) );
532
533 return SCIP_OKAY;
534}
535
536
537/** execution deinitialization method of diving heuristic (called when execution data is freed) */
538static
539GCG_DECL_DIVINGEXITEXEC(heurExitexecGcgpscostdiving) /*lint --e{715}*/
540{ /*lint --e{715}*/
543
544 assert(heur != NULL);
545
546 /* get diving data */
549
550 /* free memory */
552
553 return SCIP_OKAY;
554}
555
556
557/** variable selection method of diving heuristic;
558 * finds best candidate variable w.r.t. pseudo costs:
559 * - prefer variables that may not be rounded without destroying LP feasibility:
560 * - of these variables, round variable with largest rel. difference of pseudo cost values in corresponding
561 * direction
562 * - if all remaining fractional variables may be rounded without destroying LP feasibility:
563 * - round variable in the objective value direction
564 * - binary variables are preferred
565 */
566static
567GCG_DECL_DIVINGSELECTVAR(heurSelectVarGcgpscostdiving) /*lint --e{715}*/
568{ /*lint --e{715}*/
576 int c;
578
579 /* check preconditions */
581 assert(heur != NULL);
582 assert(bestcand != NULL);
584 assert(bestcandroundup != NULL);
585
586 /* get diving data */
589 assert(divingdata->rootsol != NULL);
590
591 /* get fractional variables that should be integral */
595
598 bestpscostquot = -1.0;
599
600 /* get best candidate */
601 for( c = 0; c < nlpcands; ++c )
602 {
603 SCIP_VAR* var;
604 SCIP_Real primsol;
605
606 SCIP_Bool mayrounddown;
607 SCIP_Bool mayroundup;
608 SCIP_Bool roundup;
610 SCIP_Real pscostquot;
611 SCIP_Real rootsolval;
612
613 int i;
614
615 var = lpcands[c];
616
617 /* if the variable is on the tabu list, do not choose it */
618 for( i = 0; i < tabulistsize; ++i )
619 if( tabulist[i] == var )
620 break;
621 if( i < tabulistsize )
622 continue;
623
624 mayrounddown = SCIPvarMayRoundDown(var);
625 mayroundup = SCIPvarMayRoundUp(var);
626 primsol = lpcandssol[c];
627 rootsolval = SCIPgetSolVal(origprob, divingdata->rootsol, var);
629
630 if( mayrounddown || mayroundup )
631 {
632 /* the candidate may be rounded: choose this candidate only, if the best candidate may also be rounded */
634 {
635 /* choose rounding direction:
636 * - if variable may be rounded in both directions, round corresponding to the pseudo cost values
637 * - otherwise, round in the infeasible direction, because feasible direction is tried by rounding
638 * the current fractional solution
639 */
640 roundup = FALSE;
641 if( mayrounddown && mayroundup )
642 {
643 SCIP_CALL( calcPscostQuot(gcg, divingdata, var, primsol, rootsolval, frac, 0, &pscostquot, &roundup) );
644 }
645 else if( mayrounddown )
646 {
647 SCIP_CALL( calcPscostQuot(gcg, divingdata, var, primsol, rootsolval, frac, +1, &pscostquot, &roundup) );
648 }
649 else
650 {
651 SCIP_CALL( calcPscostQuot(gcg, divingdata, var, primsol, rootsolval, frac, -1, &pscostquot, &roundup) );
652 }
653
654 /* check, if candidate is new best candidate */
655 if( pscostquot > bestpscostquot )
656 {
657 *bestcand = var;
658 bestpscostquot = pscostquot;
659 bestcandmayrounddown = mayrounddown;
660 bestcandmayroundup = mayroundup;
661 *bestcandroundup = roundup;
662 }
663 }
664 }
665 else
666 {
667 /* the candidate may not be rounded: calculate pseudo cost quotient and preferred direction */
668 SCIP_CALL( calcPscostQuot(gcg, divingdata, var, primsol, rootsolval, frac, 0, &pscostquot, &roundup) );
669
670 /* check, if candidate is new best candidate: prefer unroundable candidates in any case */
672 {
673 *bestcand = var;
674 bestpscostquot = pscostquot;
677 *bestcandroundup = roundup;
678 }
679 }
680 }
681
683
684 return SCIP_OKAY;
685}
686
687
688/*
689 * heuristic specific interface methods
690 */
691
692/** creates the gcgpscostdiving heuristic and includes it in GCG */
694 GCG* gcg /**< GCG data structure */
695 )
696{
697 SCIP_HEUR* heur;
700
701 /* create gcgpscostdiving primal heuristic data */
703
704 /* include diving heuristic */
707 HEUR_MAXDEPTH, heurFreeGcgpscostdiving, heurInitGcgpscostdiving, heurExitGcgpscostdiving, NULL, NULL,
708 heurInitexecGcgpscostdiving, heurExitexecGcgpscostdiving, heurSelectVarGcgpscostdiving, divingdata) );
709
710 assert(heur != NULL);
711
712 /* add gcgpscostdiving specific parameters */
713 SCIP_CALL( SCIPaddBoolParam(origprob, "heuristics/"HEUR_NAME"/usemasterpscosts",
714 "shall pseudocosts be calculated w.r.t. the master problem?",
715 &divingdata->usemasterpscosts, TRUE, DEFAULT_USEMASTERPSCOSTS, NULL, NULL) );
716
717 return SCIP_OKAY;
718}
719
#define SCIP_Bool
#define MIN(x, y)
#define SCIP_Real
#define MAX(x, y)
#define TRUE
#define FALSE
GCG interface methods.
int GCGmasterVarGetNOrigvars(SCIP_VAR *var)
Definition gcgvar.c:971
SCIP_VAR ** GCGoriginalVarGetMastervars(SCIP_VAR *var)
Definition gcgvar.c:666
SCIP_Bool GCGoriginalVarIsLinking(SCIP_VAR *var)
Definition gcgvar.c:247
SCIP_Real * GCGoriginalVarGetMastervals(SCIP_VAR *var)
Definition gcgvar.c:684
SCIP_VAR ** GCGmasterVarGetOrigvars(SCIP_VAR *var)
Definition gcgvar.c:993
SCIP_Bool GCGisLinkingVarInBlock(SCIP_VAR *var, int block)
Definition gcgvar.c:1149
SCIP_Real * GCGmasterVarGetOrigvals(SCIP_VAR *var)
Definition gcgvar.c:1017
int GCGoriginalVarGetNMastervars(SCIP_VAR *var)
Definition gcgvar.c:648
int GCGvarGetBlock(SCIP_VAR *var)
Definition gcgvar.c:1118
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_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
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 SCIPgetExternBranchCands(SCIP *scip, SCIP_VAR ***externcands, SCIP_Real **externcandssol, SCIP_Real **externcandsscore, int *nexterncands, int *nprioexterncands, int *nprioexternbins, int *nprioexternints, int *nprioexternimpls)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPallocMemory(scip, ptr)
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
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_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPfeasFrac(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfeasCeil(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfeasFloor(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasNegative(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasPositive(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPvarMayRoundUp(SCIP_VAR *var)
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
SCIP_Bool SCIPvarMayRoundDown(SCIP_VAR *var)
int SCIPvarGetProbindex(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPvarGetRootSol(SCIP_VAR *var)
SCIP_Real SCIPgetVarPseudocostVal(SCIP *scip, SCIP_VAR *var, SCIP_Real solvaldelta)
SCIP_Real SCIPgetRelaxSolVal(SCIP *scip, SCIP_VAR *var)
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
SCIPfreeMemory(GCGgetOrigprob(gcg), &divingdata)
* bestcandmayround
static assert(heur !=NULL)
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
#define HEUR_FREQOFS
#define HEUR_DESC
SCIP_Bool bestcandmayroundup
GCGheurSetDivingDataOrig(heur, NULL)
SCIP_Bool bestcandmayrounddown
#define HEUR_DISPCHAR
#define HEUR_MAXDEPTH
#define HEUR_PRIORITY
SCIP_Real * lpcandssol
#define HEUR_NAME
static SCIP_VAR ** lpcands
int nlpcands
SCIP * origprob
#define HEUR_FREQ
static SCIP_Bool areVarsInSameBlock(SCIP_VAR *origvar, SCIP_VAR *mastervar)
static SCIP_RETCODE getRootRelaxSol(GCG *gcg, SCIP_SOL **rootsol)
SCIP_VAR * var
int nbinvars
int j
int nintvars
SCIP_Real frac
SCIPdebugMessage("feasibility pump finished [%d iterations done].\n", nloops)
int i
SCIPfreeBufferArray(scip, &cycles)
divingdata rootsol
#define DEFAULT_USEMASTERPSCOSTS
divingdata masterpscosts
SCIP_RETCODE GCGincludeHeurGcgpscostdiving(GCG *gcg)
static SCIP_RETCODE calcMasterPscosts(GCG *gcg, SCIP_Real **masterpscosts)
SCIP_Real bestpscostquot
static SCIP_RETCODE calcPscostDownMaster(GCG *gcg, SCIP_VAR *var, SCIP_Real *masterpscosts, SCIP_Real *pscostdown)
static SCIP_RETCODE calcPscostQuot(GCG *gcg, GCG_DIVINGDATA *divingdata, SCIP_VAR *var, SCIP_Real primsol, SCIP_Real rootsolval, SCIP_Real frac, int rounddir, SCIP_Real *pscostquot, SCIP_Bool *roundup)
static SCIP_RETCODE calcPscostUpMaster(GCG *gcg, SCIP_VAR *var, SCIP_Real *masterpscosts, SCIP_Real *pscostup)
LP diving heuristic that chooses fixings w.r.t. the pseudo cost values.
SCIP_VAR ** mastervars
int nmastervars
SCIP_VAR ** tabulist
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)
GCG_DIVINGDATA * GCGheurGetDivingDataOrig(SCIP_HEUR *heur)
primal heuristic interface for LP diving heuristics on the original variables
#define NULL
GCG variable pricer.
SCIP_Real * masterpscosts
struct Gcg GCG
Definition type_gcg.h:44
struct SCIP_Heur SCIP_HEUR
#define GCG_DECL_DIVINGFREE(x)
#define GCG_DECL_DIVINGEXIT(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
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
struct SCIP_Sol SCIP_SOL
struct SCIP_Var SCIP_VAR