GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
branch_orig.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 branch_orig.c
30 * @brief branching rule for the original problem in GCG
31 * @author Gerald Gamrath
32 * @author Marcel Schmickerath
33 * @author Christian Puchert
34 * @author Jonas Witt
35 * @author Oliver Gaul
36 */
37
38/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
39/*#define SCIP_DEBUG*/
40#include <assert.h>
41#include <string.h>
42
43#include "gcg/branch_orig.h"
44#include "gcg/gcg.h"
46#include "gcg/branch_bpstrong.h"
49#include "gcg/cons_origbranch.h"
50#include "gcg/relax_gcg.h"
51#include "gcg/pricer_gcg.h"
52#include "gcg/type_branchgcg.h"
53
54#include "scip/cons_linear.h"
55
56
57#define BRANCHRULE_NAME "orig"
58#define BRANCHRULE_DESC "branching for the original program in generic column generation"
59#define BRANCHRULE_PRIORITY 100
60#define BRANCHRULE_MAXDEPTH -1
61#define BRANCHRULE_MAXBOUNDDIST 1.0
62
63#define DEFAULT_ENFORCEBYCONS FALSE
64#define DEFAULT_USEPSEUDO TRUE
65#define DEFAULT_MOSTFRAC FALSE
66#define DEFAULT_USERANDOM FALSE
67#define DEFAULT_USEPSSTRONG FALSE
68
69/* strong branching */
70#define DEFAULT_USESTRONG FALSE
71
72#define DEFAULT_MINPHASE0OUTCANDS 10
73#define DEFAULT_MAXPHASE0OUTCANDS 50
74#define DEFAULT_MAXPHASE0OUTCANDSFRAC 0.7
75#define DEFAULT_PHASE1GAPWEIGHT 0.25
76
77#define DEFAULT_MINPHASE1OUTCANDS 3
78#define DEFAULT_MAXPHASE1OUTCANDS 20
79#define DEFAULT_MAXPHASE1OUTCANDSFRAC 0.7
80#define DEFAULT_PHASE2GAPWEIGHT 1
81/**/
82
83
84/** branching rule data */
86{
87 GCG* gcg; /**< GCG data structure */
88 SCIP_Bool enforcebycons; /**< should bounds on variables be enforced by constraints(TRUE) or by
89 * bounds(FALSE) */
90 SCIP_Bool usepseudocosts; /**< should pseudocosts be used to determine the variable on which the
91 * branching is performed? */
92 SCIP_Bool mostfrac; /**< should branching be performed on the most fractional variable?
93 * (only if usepseudocosts = FALSE) */
94 SCIP_Bool userandom; /**< should the variable on which the branching is performed be
95 * selected randomly? (only if usepseudocosts = mostfrac = FALSE) */
96 SCIP_Bool usepsstrong; /**< should strong branching with propagation be used to determine the
97 * variable on which the branching is performed?
98 * (only if usepseudocosts = mostfrac = random = FALSE)*/
99 SCIP_Bool usestrong; /**< should strong branching be used to determine the variable on which
100 * the branching is performed? */
101 GCG_BRANCHRULE* gcgbranchrule; /**< GCG branchrule structure */
102};
103
104/** branching data for branching decisions */
105struct GCG_BranchData
106{
107 SCIP_VAR* origvar; /**< original variable on which the branching is done */
108 GCG_BOUNDTYPE boundtype; /**< type of the new bound of original variable */
109 SCIP_Real newbound; /**< new lower/upper bound of the original variable */
110 SCIP_Real oldbound; /**< old lower/upper bound of the pricing variable */
111 SCIP_Real oldvalue; /**< old value of the original variable */
112 SCIP_Real olddualbound; /**< dual bound before the branching was performed */
113 SCIP_CONS* cons; /**< constraint that enforces the branching restriction in the original
114 * problem, or NULL if this is done by variable bounds */
115};
116
117/* returns TRUE iff
118 * iter = 0 and branchcand is an integer variable belonging to a unique block with fractional value, or
119 * iter = 1 and branchcand is an integer variable that belongs to no block but was directly transferred to the
120 * master problem and which has a fractional value in the current solution
121 */
122static
124 GCG* gcg,
125 SCIP_VAR* branchcand,
126 int iter
127 )
128{
130 assert(GCGvarIsOriginal(branchcand));
131 /* continue if variable belongs to a block in second iteration*/
132 if (iter == 0)
133 {
134 /* variable belongs to no block */
135 if (GCGvarGetBlock(branchcand) == -1)
136 return FALSE;
137
138 /* block is not unique (non-linking variables) */
139 if (!GCGoriginalVarIsLinking(branchcand) && GCGgetNIdenticalBlocks(gcg, GCGvarGetBlock(branchcand)) != 1)
140 return FALSE;
141
142 /* check that blocks of linking variable are unique */
143 if (GCGoriginalVarIsLinking(branchcand))
144 {
145 int nvarblocks;
146 int *varblocks;
147 SCIP_Bool unique;
148 int j;
149
150 nvarblocks = GCGlinkingVarGetNBlocks(branchcand);
151 SCIP_CALL(SCIPallocBufferArray(scip, &varblocks, nvarblocks));
152 SCIP_CALL(GCGlinkingVarGetBlocks(branchcand, nvarblocks, varblocks));
153
154 unique = TRUE;
155 for (j = 0; j < nvarblocks; ++j)
156 if (GCGgetNIdenticalBlocks(gcg, varblocks[j]) != 1)
157 unique = FALSE;
158
159 SCIPfreeBufferArray(scip, &varblocks);
160
161 if (!unique)
162 return FALSE;
163 }
164 /* candidate is valid in first iteration */
165 return TRUE;
166
167 }
168 else /* iter == 1 */
169 {
170 if (GCGvarGetBlock(branchcand) != -1)
171 return FALSE;
172
173 /* candidate is valid in second iteration */
174 return TRUE;
175 }
176 return FALSE;
177}
178
179/** branches on a integer variable x
180 * if solution value x' is fractional, two child nodes will be created
181 * (x <= floor(x'), x >= ceil(x')),
182 * if solution value is integral, the bounds of x are finite, then two child nodes will be created
183 * (x <= x", x >= x"+1 with x" = floor((lb + ub)/2)),
184 * otherwise (up to) three child nodes will be created
185 * (x <= x'-1, x == x', x >= x'+1)
186 * if solution value is equal to one of the bounds and the other bound is infinite, only two child nodes
187 * will be created (the third one would be infeasible anyway)
188 */
189static
191 GCG* gcg, /**< GCG data structure */
192 GCG_BRANCHRULE* branchrule, /**< pointer to the original variable branching rule */
193 SCIP_VAR* branchvar, /**< variable to branch on */
194 SCIP_Real solval, /**< value of the variable in the current solution */
195 SCIP_Bool upinf, /**< have we seen during strong branching that the upbranch is
196 * infeasible? */
197 SCIP_Bool downinf /**< have we seen during strong branching that the downbranch is
198 * infeasible? */
199 )
200{
201 SCIP* origprob;
203 /* data for b&b child creation */
204 SCIP_Real downub;
205 SCIP_Real fixval;
206 SCIP_Real uplb;
207 SCIP_BRANCHRULEDATA* branchruledata;
208
211
212 branchruledata = GCGbranchGetScipBranchruledata(branchrule);
213 assert(branchruledata != NULL);
214
216
217 assert(origprob != NULL);
218 assert(branchrule != NULL);
219 assert(branchvar != NULL);
220
221 downub = SCIP_INVALID;
222 fixval = SCIP_INVALID;
223 uplb = SCIP_INVALID;
224
226 {
227 SCIP_Real lb;
228 SCIP_Real ub;
229
230 lb = SCIPvarGetLbLocal(branchvar);
231 ub = SCIPvarGetUbLocal(branchvar);
232
233 /* if there was no explicit value given for branching, the variable has a finite domain and the current LP/pseudo
234 * solution is one of the bounds, we branch in the center of the domain */
235 if( !SCIPisInfinity(origprob, -lb) && !SCIPisInfinity(origprob, ub) )
236 {
237 SCIP_Real center;
238
239 /* create child nodes with x <= x", and x >= x"+1 with x" = floor((lb + ub)/2);
240 * if x" is integral, make the interval smaller in the child in which the current solution x'
241 * is still feasible
242 */
243 center = (ub + lb) / 2.0;
244 if( solval <= center )
245 {
246 downub = SCIPfeasFloor(origprob, center);
247 uplb = downub + 1.0;
248 }
249 else
250 {
251 uplb = SCIPfeasCeil(origprob, center);
252 downub = uplb - 1.0;
253 }
254 }
255 else
256 {
257 /* create child nodes with x <= x'-1, x = x', and x >= x'+1 */
259
260 fixval = solval;
261
262 /* create child node with x <= x'-1, if this would be feasible */
263 if( SCIPisFeasGE(origprob, fixval-1.0, lb) )
264 downub = fixval - 1.0;
265
266 /* create child node with x >= x'+1, if this would be feasible */
267 if( SCIPisFeasLE(origprob, fixval+1.0, ub) )
268 uplb = fixval + 1.0;
269 }
270 SCIPdebugMessage("integral branch on variable <%s> with value %g, priority %d (current lower bound: %g)\n",
271 SCIPvarGetName(branchvar), solval, SCIPvarGetBranchPriority(branchvar),
273 }
274 else
275 {
276 /* create child nodes with x <= floor(x'), and x >= ceil(x') */
277 downub = SCIPfeasFloor(origprob, solval);
278 uplb = downub + 1.0;
280 }
281
282 if( uplb != SCIP_INVALID && !upinf ) /*lint !e777*/
283 {
284 SCIP_CONS* cons;
285 SCIP_NODE* child;
286 SCIP_CONS** origbranchconss;
287 GCG_BRANCHDATA* branchdata;
288 char name[SCIP_MAXSTRLEN];
289
290 int norigbranchconss;
291 int maxorigbranchconss;
292
293 origbranchconss = NULL;
294 norigbranchconss = 0;
295 maxorigbranchconss = 0;
296
297 /* create child node x >= uplb */
299
300 SCIP_CALL( SCIPallocBlockMemory(origprob, &branchdata) );
301
302 branchdata->origvar = branchvar;
303 branchdata->oldvalue = solval;
305 branchdata->boundtype = GCG_BOUNDTYPE_LOWER;
306 branchdata->newbound = uplb;
307 branchdata->oldbound = SCIPvarGetLbLocal(branchvar);
308
309 SCIPdebugMessage(" -> creating child: <%s> >= %g\n",
310 SCIPvarGetName(branchvar), uplb);
311
312 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s %s %f", SCIPvarGetName(branchdata->origvar),
313 ">=", branchdata->newbound);
314
315 if( branchruledata->enforcebycons )
316 {
317 /* enforce new bounds by linear constraints */
318 SCIP_CONS* consup;
319
320 SCIPdebugMessage("enforced by cons\n");
321
322 norigbranchconss = 1;
323 maxorigbranchconss = SCIPcalcMemGrowSize(origprob, 1);
324 SCIP_CALL( SCIPallocBlockMemoryArray(origprob, &origbranchconss, maxorigbranchconss) );
325
326 /* create corresponding constraints */
327 SCIP_CALL( SCIPcreateConsLinear(origprob, &consup, name, 0, NULL, NULL,
330
331 SCIP_CALL( SCIPaddCoefLinear(origprob, consup, branchvar, 1.0) );
332
333 origbranchconss[0] = consup;
334 branchdata->cons = consup;
335 }
336 else
337 branchdata->cons = NULL;
338
339 /* create and add the masterbranch constraint */
340 SCIP_CALL( GCGcreateConsMasterbranch(gcg, &cons, name, child,
341 GCGconsMasterbranchGetActiveCons(gcg), branchrule, branchdata, origbranchconss, norigbranchconss,
342 maxorigbranchconss) );
343 SCIP_CALL( SCIPaddConsNode(masterprob, child, cons, NULL) );
344 }
345
346 if( downub != SCIP_INVALID && !downinf ) /*lint !e777*/
347 {
348 SCIP_CONS* cons;
349 SCIP_NODE* child;
350 SCIP_CONS** origbranchconss;
351 GCG_BRANCHDATA* branchdata;
352 char name[SCIP_MAXSTRLEN];
353
354 int norigbranchconss;
355 int maxorigbranchconss;
356
357 origbranchconss = NULL;
358 norigbranchconss = 0;
359 maxorigbranchconss = 0;
360
361 /* create child node x <= downub */
363
364 SCIP_CALL( SCIPallocBlockMemory(origprob, &branchdata) );
365
366 branchdata->origvar = branchvar;
367 branchdata->oldvalue = solval;
369 branchdata->boundtype = GCG_BOUNDTYPE_UPPER;
370 branchdata->newbound = downub;
371 branchdata->oldbound = SCIPvarGetUbLocal(branchvar);
372
373 SCIPdebugMessage(" -> creating child: <%s> <= %g\n",
374 SCIPvarGetName(branchvar), downub);
375
376 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s %s %f", SCIPvarGetName(branchdata->origvar),
377 "<=", branchdata->newbound);
378
379 /* enforce branching decision by a constraint rather than by bound changes */
380 if( branchruledata->enforcebycons )
381 {
382 /* enforce new bounds by linear constraints */
383 SCIP_CONS* consdown;
384
385 norigbranchconss = 1;
386 maxorigbranchconss = SCIPcalcMemGrowSize(origprob, 1);
387 SCIP_CALL( SCIPallocBlockMemoryArray(origprob, &origbranchconss, maxorigbranchconss) );
388
389 /* create corresponding constraints */
390 SCIP_CALL( SCIPcreateConsLinear(origprob, &consdown, name, 0, NULL, NULL,
393 SCIP_CALL( SCIPaddCoefLinear(origprob, consdown, branchvar, 1.0) );
394
395 origbranchconss[0] = consdown;
396 branchdata->cons = consdown;
397 }
398 else
399 branchdata->cons = NULL;
400
401 /* create and add the masterbranch constraint */
402 SCIP_CALL( GCGcreateConsMasterbranch(gcg, &cons, name, child,
403 GCGconsMasterbranchGetActiveCons(gcg), branchrule, branchdata, origbranchconss, norigbranchconss,
404 maxorigbranchconss) );
405 SCIP_CALL( SCIPaddConsNode(masterprob, child, cons, NULL) );
406 }
407
408 if( fixval != SCIP_INVALID ) /*lint !e777*/
409 {
410 SCIP_CONS* cons;
411 SCIP_NODE* child;
412 SCIP_CONS** origbranchconss;
413 GCG_BRANCHDATA* branchdata;
414 char name[SCIP_MAXSTRLEN];
415
416 int norigbranchconss;
417 int maxorigbranchconss;
418
419 origbranchconss = NULL;
420 norigbranchconss = 0;
421 maxorigbranchconss = 0;
422
423 /* create child node x = fixval */
425
426 SCIP_CALL( SCIPallocBlockMemory(origprob, &branchdata) );
427
428 branchdata->origvar = branchvar;
429 branchdata->oldvalue = solval;
431 branchdata->boundtype = GCG_BOUNDTYPE_FIXED;
432 branchdata->newbound = fixval;
433 branchdata->oldbound = SCIPvarGetUbLocal(branchvar);
434
435 SCIPdebugMessage(" -> creating child: <%s> == %g\n",
436 SCIPvarGetName(branchvar), fixval);
437
438 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s %s %f", SCIPvarGetName(branchdata->origvar),
439 "==", branchdata->newbound);
440
441 /* enforce branching decision by a constraint rather than by bound changes */
442 if( branchruledata->enforcebycons )
443 {
444 /* enforce new bounds by linear constraints */
445 SCIP_CONS* consfix;
446
447 norigbranchconss = 1;
448 maxorigbranchconss = SCIPcalcMemGrowSize(origprob, 1);
449 SCIP_CALL( SCIPallocBlockMemoryArray(origprob, &origbranchconss, maxorigbranchconss) );
450
451 /* create corresponding constraints */
452 SCIP_CALL( SCIPcreateConsLinear(origprob, &consfix, name, 0, NULL, NULL,
453 fixval, fixval, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE) );
454 SCIP_CALL( SCIPaddCoefLinear(origprob, consfix, branchvar, 1.0) );
455
456 origbranchconss[0] = consfix;
457 branchdata->cons = consfix;
458 }
459 else
460 branchdata->cons = NULL;
461
462 /* create and add the masterbranch constraint */
463 SCIP_CALL( GCGcreateConsMasterbranch(gcg, &cons, name, child,
464 GCGconsMasterbranchGetActiveCons(gcg), branchrule, branchdata, origbranchconss, norigbranchconss,
465 maxorigbranchconss) );
466 SCIP_CALL( SCIPaddConsNode(masterprob, child, cons, NULL) );
467 }
468
469 return SCIP_OKAY;
470}
471
472/* Evaluates the given variable based on a score function of choice. Higher scores are given to better
473 * variables.
474 */
476 SCIP *scip,
477 SCIP_BRANCHRULEDATA* branchruledata, /* pointer to branching rule data */
478 SCIP_VAR *var, /* var to be scored */
479 SCIP_Real solval, /* the var's current solution value */
480 SCIP_Real *score /* stores the computed score */
481 )
482{
483 assert(branchruledata != NULL);
484
485 /* define score functions and calculate score for all variables for sorting dependent on used heuristic */
486 if( branchruledata->usepseudocosts )
487 {
489 }
490 else
491 {
492 if( !branchruledata->mostfrac )
493 return 1;
494
495 *score = solval - SCIPfloor(scip, solval);
496 *score = MIN(*score, 1.0 - *score);
497 }
498
499 return SCIP_OKAY;
500}
501
502/** branching method for relaxation solutions */
503static
505 GCG* gcg, /**< GCG data structure */
506 GCG_BRANCHRULE* branchrule, /**< pointer to the original variable branching rule */
507 SCIP_RESULT* result /**< pointer to store the result of the branching call */
508 )
509{
510 SCIP_BRANCHRULEDATA* branchruledata;
511 SCIP* origprob;
512
513 /* branching candidates */
514 SCIP_VAR** branchcands;
515 SCIP_Real* branchcandssol;
516 int nbranchcands;
517 int npriobranchcands;
518
519 SCIP_Bool upinf;
520 SCIP_Bool downinf;
521
522 /* values for choosing the variable to branch on */
523 SCIP_VAR* branchvar;
525
526 SCIP_Real maxscore;
527 SCIP_Real score;
528
529 assert(branchrule != NULL);
531 assert(gcg != NULL);
532 assert(result != NULL);
533
535
537
538 branchruledata = GCGbranchGetScipBranchruledata(branchrule);
539 assert(branchruledata != NULL);
540
542
543 /* get the branching candidates */
544 SCIP_CALL( SCIPgetExternBranchCands(origprob, &branchcands, &branchcandssol, NULL, &nbranchcands,
545 &npriobranchcands, NULL, NULL, NULL) );
546
547 branchvar = NULL;
548 solval = 0.0;
549
550 upinf = FALSE;
551 downinf = FALSE;
552
553 maxscore = -1.0;
554
555 if( !branchruledata->usestrong )
556 {
557 if( branchruledata->usepseudocosts || branchruledata->mostfrac || branchruledata->userandom )
558 {
559 /* iter = 0: integer variables belonging to a unique block with fractional value,
560 * iter = 1: we did not find enough variables to branch on so far, so we look for integer variables that
561 * belong to no block
562 * but were directly transferred to the master problem and which have a fractional value in the current
563 * solution
564 */
565 for( int iter = 0; iter <= 1 && branchvar == NULL; iter++ )
566 {
567 for( int i = 0; i < npriobranchcands; i++ )
568 {
569 if( !getUniqueBlockFlagForIter(gcg, branchcands[i], iter) )
570 continue;
571
572 if( !branchruledata->userandom )
573 {
574 SCIP_CALL( score_function(origprob, branchruledata, branchcands[i], branchcandssol[i], &score) );
575
576 if( score > maxscore )
577 {
578 maxscore = score;
579 branchvar = branchcands[i];
580 solval = branchcandssol[i];
581 }
582 }
583 else
584 {
585 branchvar = branchcands[i];
586 solval = branchcandssol[i];
587 break;
588 }
589 }
590 }
591 }
592 else if( branchruledata->usepsstrong )
593 {
594 SCIP_CALL( GCGgetRelpsprobBranchVar(gcg, branchcands, branchcandssol, npriobranchcands,
595 npriobranchcands, result, &branchvar) );
596 assert(branchvar != NULL || *result == SCIP_CUTOFF);
598
599 if( *result == SCIP_CUTOFF )
600 return SCIP_OKAY;
601
602 solval = SCIPgetRelaxSolVal(origprob, branchvar);
603 }
604
605
606 }
607 else
608 {
609 SCIP_CALL( GCGbranchSelectCandidateStrongBranchingOrig(gcg, branchrule, &branchvar, &upinf, &downinf, result,
610 &branchruledata->usestrong) );
611 }
612
613 if( upinf && downinf )
614 return SCIP_OKAY;
615
616 if( branchvar == NULL )
617 {
618 SCIPdebugMessage("Original branching rule could not find a variable to branch on!\n");
619 return SCIP_OKAY;
620 }
621
622 assert(!(upinf && downinf));
623
624 SCIPdebugMessage("Original branching rule selected variable %s%s\n",
625 SCIPvarGetName(branchvar), (upinf || downinf)? ", which is infeasible in one direction" : "");
626
627 SCIP_CALL( branchVar(gcg, branchrule, branchvar, solval, upinf, downinf) );
629
630 return SCIP_OKAY;
631}
632
633/*
634 * Callback methods for enforcing branching constraints
635 */
636
637#define branchDeactiveMasterOrig NULL
638#define branchPropMasterOrig NULL
639
640/** callback activation method */
641static
642GCG_DECL_BRANCHACTIVEMASTER(branchActiveMasterOrig)
643{
645 SCIP_CONS* mastercons;
646
648
650 assert(branchdata != NULL);
651
652 /* branching restrictions are enforced by variable bounds, this is done automatically, so we can abort here */
653 if( branchdata->cons == NULL )
654 return SCIP_OKAY;
655
656 assert(branchdata->origvar != NULL);
657
658 SCIPdebugMessage("branchActiveMasterOrig: %s %s %f\n", SCIPvarGetName(branchdata->origvar),
659 ( branchdata->boundtype == GCG_BOUNDTYPE_LOWER ?
660 ">=" : branchdata->boundtype == GCG_BOUNDTYPE_UPPER ? "<=" : "==" ), branchdata->newbound);
661
662 /* transform constraint to the master variable space */
663 SCIP_CALL( GCGrelaxTransOrigToMasterCons(gcg, branchdata->cons, &mastercons) );
664 assert(mastercons != NULL);
665
666 /* add constraint to the master problem */
668
669 /* constraint was added locally to the node where it is needed, so we do not need to care about this
670 * at the next activation of the node and can set the constraint pointer to NULL */
671 SCIP_CALL( SCIPreleaseCons(masterprob, &branchdata->cons) );
672 branchdata->cons = NULL;
673
674 return SCIP_OKAY;
675}
676
677/** callback solved method */
678static
679GCG_DECL_BRANCHMASTERSOLVED(branchMasterSolvedOrig)
680{
683 assert(origprob != NULL);
685 assert(branchdata != NULL);
686 assert(branchdata->origvar != NULL);
687
688 SCIPdebugMessage("branchMasterSolvedOrig: %s %s %f\n", SCIPvarGetName(branchdata->origvar),
689 ( branchdata->boundtype == GCG_BOUNDTYPE_LOWER ?
690 ">=" : branchdata->boundtype == GCG_BOUNDTYPE_UPPER ? "<=" : "==" ), branchdata->newbound);
691
694 {
695 SCIP_CALL( SCIPupdateVarPseudocost(origprob, branchdata->origvar,
696 SCIPgetRelaxSolVal(origprob, branchdata->origvar) - branchdata->oldvalue,
697 newlowerbound - branchdata->olddualbound, 1.0) );
698 }
699
700 return SCIP_OKAY;
701}
702
703/** callback deletion method for branching data */
704static
705GCG_DECL_BRANCHDATADELETE(branchDataDeleteOrig)
706{
708 assert(origprob != NULL);
709 assert(branchdata != NULL);
710
711 if( !origbranch && !force )
712 return SCIP_OKAY;
713
714 if( *branchdata == NULL )
715 return SCIP_OKAY;
716
717 SCIPdebugMessage("branchDataDeleteOrig: %s %s %f\n", SCIPvarGetName((*branchdata)->origvar),
718 ( (*branchdata)->boundtype == GCG_BOUNDTYPE_LOWER ?
719 ">=" : (*branchdata)->boundtype == GCG_BOUNDTYPE_UPPER ? "<=" : "==" ),
720 (*branchdata)->newbound);
721
722 /* release constraint */
723 if( (*branchdata)->cons != NULL )
724 {
725 SCIP_CALL( SCIPreleaseCons(origprob, &(*branchdata)->cons) );
726 (*branchdata)->cons = NULL;
727 }
728
730 *branchdata = NULL;
731
732 return SCIP_OKAY;
733}
734
735static
736SCIP_DECL_BRANCHFREE(branchFreeOrig)
737{ /*lint --e{715}*/
738 SCIP_BRANCHRULEDATA* branchruledata;
739
740 branchruledata = SCIPbranchruleGetData(branchrule);
741
742 SCIPfreeBlockMemory(scip, &branchruledata);
743 SCIPbranchruleSetData(branchrule, NULL);
744
745 return SCIP_OKAY;
746}
747
748/*
749 * Callback methods
750 */
751
752/** branching execution method for fractional LP solutions */
753static
754SCIP_DECL_BRANCHEXECLP(branchExeclpOrig)
755{ /*lint --e{715}*/
756 SCIP* origprob;
757 SCIP_BRANCHRULEDATA* branchruledata;
758
759 //SCIPdebugMessage("Execlp method of orig branching\n");
760
761 branchruledata = SCIPbranchruleGetData(branchrule);
762 assert(branchruledata != NULL);
763
764 /* get original problem */
765 origprob = GCGgetOrigprob(branchruledata->gcg);
766 assert(origprob != NULL);
767
768 if( GCGcurrentNodeIsGeneric(branchruledata->gcg) )
769 {
770 SCIPdebugMessage("Not executing orig branching, node was branched by generic branchrule\n");
772 return SCIP_OKAY;
773 }
774
775 /* if the transferred master solution is feasible, the current node is solved to optimality and can be pruned */
776 if( GCGrelaxIsOrigSolFeasible(branchruledata->gcg) )
777 {
779 SCIPdebugMessage("solution was feasible, node can be cut off!");
780 }
781
783 {
785 SCIP_CALL( branchExtern(branchruledata->gcg, branchruledata->gcgbranchrule, result) );
786 }
787
788 return SCIP_OKAY;
789}
790
791/** branching execution method for relaxation solutions */
792static
793SCIP_DECL_BRANCHEXECEXT(branchExecextOrig)
794{ /*lint --e{715}*/
795 SCIP_BRANCHRULEDATA* branchruledata;
796
797 SCIPdebugMessage("Execext method of orig branching\n");
798
799 branchruledata = SCIPbranchruleGetData(branchrule);
800 assert(branchruledata != NULL);
801
802 if( GCGcurrentNodeIsGeneric(branchruledata->gcg) )
803 {
804 SCIPdebugMessage("Not executing orig branching, node was branched by generic branchrule\n");
806 return SCIP_OKAY;
807 }
808
809 /* if the transferred master solution is feasible, the current node is solved to optimality and can be pruned */
810 if( GCGrelaxIsOrigSolFeasible(branchruledata->gcg) )
811 {
813 SCIPdebugMessage("solution was feasible, node can be cut off!");
814 }
815 SCIP_CALL( branchExtern(branchruledata->gcg, branchruledata->gcgbranchrule, result) );
816
817 return SCIP_OKAY;
818}
819
820/** initialization method of branching rule (called after problem was transformed) */
821static
822SCIP_DECL_BRANCHINIT(branchInitOrig)
823{
824 return SCIP_OKAY;
825}
826
827/** branching execution method for not completely fixed pseudo solutions */
828static
829SCIP_DECL_BRANCHEXECPS(branchExecpsOrig)
830{ /*lint --e{715}*/
831 int i;
832 SCIP_BRANCHRULEDATA* branchruledata;
833 SCIP* origprob;
834
835 /* branching candidates */
836 SCIP_VAR** branchcands;
837 int nbranchcands;
838 int npriobranchcands;
839
840 /* values for choosing the variable to branch on */
841 SCIP_VAR* branchvar;
843 SCIP_Real lb;
844 SCIP_Real ub;
845
846 assert(branchrule != NULL);
847 assert(strcmp(SCIPbranchruleGetName(branchrule), BRANCHRULE_NAME) == 0);
848 assert(scip != NULL);
849 assert(result != NULL);
850
851 branchruledata = SCIPbranchruleGetData(branchrule);
852 assert(branchruledata != NULL);
853
854 SCIPdebugMessage("EXECPS orig branching rule\n");
855
856 /* get original problem */
857 origprob = GCGgetOrigprob(branchruledata->gcg);
858 assert(origprob != NULL);
859
860 if( GCGcurrentNodeIsGeneric(branchruledata->gcg) )
861 {
862 SCIPdebugMessage("Not executing orig branching, node was branched by generic branchrule\n");
864 return SCIP_OKAY;
865 }
866
867 SCIPdebugMessage("Execps method of orig branching\n");
868
871 return SCIP_OKAY;
872
873 /* get the branching candidates */
874 SCIP_CALL( SCIPgetPseudoBranchCands(origprob, &branchcands, &nbranchcands, &npriobranchcands) );
875
876 branchvar = NULL;
877 solval = 0.0;
878
879 /* branch on an integer variable belonging to a unique block with fractional value */
880 for( i = 0; i < npriobranchcands; i++ )
881 {
882 assert(GCGvarIsOriginal(branchcands[i]));
883
884 /* variable belongs to no block or the block is not unique */
885 if( GCGvarGetBlock(branchcands[i]) <= -1 || GCGgetNIdenticalBlocks(branchruledata->gcg, GCGvarGetBlock(branchcands[i])) != 1 )
886 continue;
887
888 branchvar = branchcands[i];
889 lb = SCIPvarGetLbLocal(branchvar);
890 ub = SCIPvarGetUbLocal(branchvar);
891
892 assert(ub - lb > 0.8);
893
894 /* if the bounds of the branching variable x are finite, then the solution value
895 * is floor((lb + ub)/2)) + 0.5,
896 * otherwise the solution value is set to a finite bound
897 * if no finite bound exists, the solution value is set to 0.
898 */
899 if( !SCIPisInfinity(origprob, ub) && !SCIPisInfinity(origprob, -lb) )
900 solval = SCIPfeasFloor(scip, (ub + lb) / 2.0) + 0.5;
901 else if( !SCIPisInfinity(origprob, -lb) )
902 solval = lb;
903 else if( !SCIPisInfinity(origprob, ub) )
904 solval = ub;
905 else
906 solval = 0.0;
907
908 break;
909 }
910
911 /* we did not find a variable to branch on so far, so we look for an unfixed linking variable or an integer variable
912 * that belongs to no block but was directly transferred to the master problem
913 */
914 if( branchvar == NULL )
915 {
916 for( i = 0; i < npriobranchcands; i++ )
917 {
918 assert(GCGvarIsOriginal(branchcands[i]));
919
920 /* continue if variable belongs to a block */
921 if( GCGvarGetBlock(branchcands[i]) > -1 )
922 continue;
923
924 /* check that blocks of linking variable are unique */
925 if( GCGoriginalVarIsLinking(branchcands[i]) )
926 {
927 int nvarblocks;
928 int* varblocks;
929 SCIP_Bool unique;
930 int j;
931
932 nvarblocks = GCGlinkingVarGetNBlocks(branchcands[i]);
933 SCIP_CALL( SCIPallocBufferArray(origprob, &varblocks, nvarblocks) );
934 SCIP_CALL( GCGlinkingVarGetBlocks(branchcands[i], nvarblocks, varblocks) );
935
936 unique = TRUE;
937 for( j = 0; j < nvarblocks; ++j )
938 if( GCGgetNIdenticalBlocks(branchruledata->gcg, varblocks[j]) != 1 )
939 unique = FALSE;
940
941 SCIPfreeBufferArray(origprob, &varblocks);
942
943 if( !unique )
944 continue;
945 }
946
947 branchvar = branchcands[i];
948 lb = SCIPvarGetLbLocal(branchvar);
949 ub = SCIPvarGetUbLocal(branchvar);
950
951 assert(ub - lb > 0.8);
952
953 /* if the bounds of the branching variable x are finite, then the solution value
954 * is floor((lb + ub)/2)) + 0.5,
955 * otherwise the solution value is set to a finite bound
956 * if no finite bound exists, the solution value is set to 0.
957 */
958 if( !SCIPisInfinity(origprob, ub) && !SCIPisInfinity(origprob, -lb) )
959 solval = SCIPfeasFloor(scip, (ub + lb) / 2.0) + 0.5;
960 else if( !SCIPisInfinity(origprob, -lb) )
961 solval = lb;
962 else if( !SCIPisInfinity(origprob, ub) )
963 solval = ub;
964 else
965 solval = 0.0;
966
967 break;
968 }
969 }
970
971 if( branchvar == NULL )
972 {
973 SCIPdebugMessage("Original branching rule could not find a variable to branch on!\n");
974 return SCIP_OKAY;
975 }
976
977 assert(branchvar != NULL);
978
979 SCIP_CALL( branchVar(branchruledata->gcg, branchruledata->gcgbranchrule, branchvar, solval, FALSE, FALSE) );
980
982
983 return SCIP_OKAY;
984}
985
986
987
988/*
989 * branching specific interface methods
990 */
991
992/** creates the branching on original variable branching rule and includes it in SCIP */
994 GCG* gcg /**< GCG data structure */
995 )
996{
997 SCIP* origprob;
999 SCIP_BRANCHRULE* branchrule;
1000 GCG_BRANCHRULE* gcgbranchrule;
1001 SCIP_BRANCHRULEDATA* branchruledata;
1002
1003 SCIPdebugMessage("Include orig branching rule\n");
1004 assert(gcg != NULL);
1005
1006 /* get original problem */
1008 assert(origprob != NULL);
1011
1012 /* alloc branching rule data */
1013 SCIP_CALL( SCIPallocBlockMemory(masterprob, &branchruledata) );
1014
1015 branchruledata->gcg = gcg;
1016
1017 /* include branching rule */
1018 SCIP_CALL( GCGrelaxIncludeBranchrule(branchruledata->gcg, &branchrule, &gcgbranchrule, BRANCHRULE_NAME, BRANCHRULE_DESC, BRANCHRULE_PRIORITY,
1019 BRANCHRULE_MAXDEPTH, BRANCHRULE_MAXBOUNDDIST, branchruledata, branchActiveMasterOrig,
1020 branchDeactiveMasterOrig, branchPropMasterOrig, branchMasterSolvedOrig, branchDataDeleteOrig, NULL, NULL, NULL) );
1021 assert(branchrule != NULL);
1022 branchruledata->gcgbranchrule = gcgbranchrule;
1023
1024 /* set non fundamental callbacks via setter functions */
1025 SCIP_CALL( SCIPsetBranchruleInit(masterprob, branchrule, branchInitOrig) );
1026 SCIP_CALL( SCIPsetBranchruleExecLp(masterprob, branchrule, branchExeclpOrig) );
1027 SCIP_CALL( SCIPsetBranchruleExecExt(masterprob, branchrule, branchExecextOrig) );
1028 SCIP_CALL( SCIPsetBranchruleExecPs(masterprob, branchrule, branchExecpsOrig) );
1029 SCIP_CALL( SCIPsetBranchruleFree(masterprob, branchrule, branchFreeOrig) );
1030
1031 /* add original variable branching rule parameters */
1032
1033 SCIP_CALL( SCIPaddBoolParam(origprob, "branching/orig/enforcebycons",
1034 "should bounds on variables be enforced by constraints(TRUE) or by bounds(FALSE)",
1035 &branchruledata->enforcebycons, FALSE, DEFAULT_ENFORCEBYCONS, NULL, NULL) );
1036
1037 SCIP_CALL( SCIPaddBoolParam(origprob, "branching/orig/usepseudocosts",
1038 "should pseudocosts be used to determine the variable on which the branching is performed?",
1039 &branchruledata->usepseudocosts, FALSE, DEFAULT_USEPSEUDO, NULL, NULL) );
1040
1041 SCIP_CALL( SCIPaddBoolParam(origprob, "branching/orig/mostfrac",
1042 "should branching be performed on the most fractional variable? (only if usepseudocosts = FALSE)",
1043 &branchruledata->mostfrac, FALSE, DEFAULT_MOSTFRAC, NULL, NULL) );
1044
1045 SCIP_CALL( SCIPaddBoolParam(origprob, "branching/orig/userandom",
1046 "should the variable on which the branching is performed be selected randomly? (only if usepseudocosts = mostfrac = FALSE)",
1047 &branchruledata->userandom, FALSE, DEFAULT_USERANDOM, NULL, NULL) );
1048
1049 SCIP_CALL( SCIPaddBoolParam(origprob, "branching/orig/usepsstrong",
1050 "should strong branching with propagation be used to determine the variable on which the branching is performed? (only if usepseudocosts = mostfrac = random = FALSE)",
1051 &branchruledata->usepsstrong, FALSE, DEFAULT_USEPSSTRONG, NULL, NULL) );
1052
1053 SCIP_CALL( SCIPaddBoolParam(origprob, "branching/orig/usestrong",
1054 "should strong branching be used to determine the variable on which the branching is performed?",
1055 &branchruledata->usestrong, FALSE, DEFAULT_USESTRONG, NULL, NULL) );
1056
1057 /* strong branching */
1058 SCIP_CALL( SCIPaddIntParam(origprob, "branching/orig/minphase0outcands",
1059 "minimum number of output candidates from phase 0 during strong branching",
1060 NULL, FALSE, DEFAULT_MINPHASE0OUTCANDS, 1, INT_MAX, NULL, NULL) );
1061
1062 SCIP_CALL( SCIPaddIntParam(origprob, "branching/orig/maxphase0outcands",
1063 "maximum number of output candidates from phase 0 during strong branching",
1064 NULL, FALSE, DEFAULT_MAXPHASE0OUTCANDS, 1, INT_MAX, NULL, NULL) );
1065
1066 SCIP_CALL( SCIPaddRealParam(origprob, "branching/orig/maxphase0outcandsfrac",
1067 "maximum number of output candidates from phase 0 as fraction of total cands during strong branching",
1069
1070 SCIP_CALL( SCIPaddRealParam(origprob, "branching/orig/phase1gapweight",
1071 "how much impact should the node gap have on the number of precisely evaluated candidates in phase 1 during strong branching?",
1073
1074 SCIP_CALL( SCIPaddIntParam(origprob, "branching/orig/minphase1outcands",
1075 "minimum number of output candidates from phase 1 during strong branching",
1076 NULL, FALSE, DEFAULT_MINPHASE1OUTCANDS, 1, INT_MAX, NULL, NULL) );
1077
1078 SCIP_CALL( SCIPaddIntParam(origprob, "branching/orig/maxphase1outcands",
1079 "maximum number of output candidates from phase 1 during strong branching",
1080 NULL, FALSE, DEFAULT_MAXPHASE1OUTCANDS, 1, INT_MAX, NULL, NULL) );
1081
1082 SCIP_CALL( SCIPaddRealParam(origprob, "branching/orig/maxphase1outcandsfrac",
1083 "maximum number of output candidates from phase 1 as fraction of phase 1 cands during strong branching",
1085
1086 SCIP_CALL( SCIPaddRealParam(origprob, "branching/orig/phase2gapweight",
1087 "how much impact should the node gap have on the number of precisely evaluated candidates in phase 2 during strong branching?",
1089
1090 return SCIP_OKAY;
1091}
1092
1093/** get the original variable on which the branching was performed */
1095 GCG_BRANCHDATA* branchdata /**< branching data */
1096 )
1097{
1098 assert(branchdata != NULL);
1099
1100 return branchdata->origvar;
1101}
1102
1103/** get the type of the new bound which resulted of the performed branching */
1105 GCG_BRANCHDATA* branchdata /**< branching data */
1106 )
1107{
1108 assert(branchdata != NULL);
1109
1110 return branchdata->boundtype;
1111}
1112
1113/** get the new bound which resulted of the performed branching */
1115 GCG_BRANCHDATA* branchdata /**< branching data */
1116 )
1117{
1118 assert(branchdata != NULL);
1119
1120 return branchdata->newbound;
1121}
1122
1123/** updates extern branching candidates before branching */
1125 GCG* gcg /**< GCG data structure */
1126)
1127{
1128 SCIP* scip;
1129 SCIP_VAR** origvars;
1130 int norigvars;
1131 int i;
1132
1135
1136 origvars = SCIPgetVars(scip);
1137 norigvars = SCIPgetNVars(scip);
1138 assert(origvars != NULL);
1139
1141
1142 /* store branching candidates */
1143 for( i = 0; i < norigvars; i++ )
1144 {
1146 SCIPgetRelaxSolVal(scip, origvars[i])) )
1147 {
1148 assert(!SCIPisEQ(scip, SCIPvarGetLbLocal(origvars[i]), SCIPvarGetUbLocal(origvars[i])));
1149
1151 origvars[i]) - SCIPfloor(scip, SCIPgetRelaxSolVal(scip, origvars[i])),
1152 SCIPgetRelaxSolVal(scip, origvars[i])) );
1153 }
1154 }
1155 SCIPdebugMessage("updated relaxation branching candidates\n");
1156
1157 return SCIP_OKAY;
1158}
#define BRANCHRULE_DESC
#define BRANCHRULE_PRIORITY
static SCIP_DECL_BRANCHFREE(branchFreeBPStrong)
static SCIP_Real score_function(GCG *gcg, SCIP_BRANCHRULE *branchrule, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Real solval1, SCIP_Real solval2, int candinfo, SCIP_Bool useheuristic, SCIP_Bool usehistorical, SCIP_Bool usecolgen, SCIP_Real *score, SCIP_Bool *upinf, SCIP_Bool *downinf)
#define DEFAULT_USESTRONG
#define DEFAULT_USEPSSTRONG
static SCIP_DECL_BRANCHINIT(branchInitBPStrong)
#define BRANCHRULE_NAME
SCIP_RETCODE GCGbranchSelectCandidateStrongBranchingOrig(GCG *gcg, GCG_BRANCHRULE *origbranchrule, SCIP_VAR **branchvar, SCIP_Bool *upinf, SCIP_Bool *downinf, SCIP_RESULT *result, SCIP_Bool *stillusestrong)
#define DEFAULT_USEPSEUDO
#define DEFAULT_ENFORCEBYCONS
#define DEFAULT_MOSTFRAC
#define BRANCHRULE_MAXDEPTH
#define BRANCHRULE_MAXBOUNDDIST
generic branch and price strong branching as described in Pecin, D., Pessoa, A., Poggi,...
static SCIP_DECL_BRANCHEXECLP(branchExeclpCompBnd)
static SCIP_DECL_BRANCHEXECEXT(branchExecextCompBnd)
static SCIP_DECL_BRANCHEXECPS(branchExecpsCompBnd)
#define DEFAULT_USERANDOM
Definition branch_orig.c:66
#define DEFAULT_MAXPHASE1OUTCANDSFRAC
Definition branch_orig.c:79
SCIP_RETCODE GCGincludeBranchruleOrig(GCG *gcg)
GCG_BOUNDTYPE GCGbranchOrigGetBoundtype(GCG_BRANCHDATA *branchdata)
#define DEFAULT_MINPHASE1OUTCANDS
Definition branch_orig.c:77
static SCIP_Bool getUniqueBlockFlagForIter(GCG *gcg, SCIP_VAR *branchcand, int iter)
#define DEFAULT_MINPHASE0OUTCANDS
Definition branch_orig.c:72
SCIP_Real GCGbranchOrigGetNewbound(GCG_BRANCHDATA *branchdata)
#define DEFAULT_MAXPHASE0OUTCANDS
Definition branch_orig.c:73
#define branchDeactiveMasterOrig
static SCIP_RETCODE branchVar(GCG *gcg, GCG_BRANCHRULE *branchrule, SCIP_VAR *branchvar, SCIP_Real solval, SCIP_Bool upinf, SCIP_Bool downinf)
#define DEFAULT_PHASE1GAPWEIGHT
Definition branch_orig.c:75
#define DEFAULT_MAXPHASE1OUTCANDS
Definition branch_orig.c:78
#define DEFAULT_PHASE2GAPWEIGHT
Definition branch_orig.c:80
#define branchPropMasterOrig
static SCIP_RETCODE branchExtern(GCG *gcg, GCG_BRANCHRULE *branchrule, SCIP_RESULT *result)
#define DEFAULT_MAXPHASE0OUTCANDSFRAC
Definition branch_orig.c:74
SCIP_RETCODE GCGbranchOrigUpdateExternBranchcands(GCG *gcg)
SCIP_VAR * GCGbranchOrigGetOrigvar(GCG_BRANCHDATA *branchdata)
branching rule for original problem in GCG
SCIP_RETCODE GCGgetRelpsprobBranchVar(GCG *gcg, SCIP_VAR **branchcands, SCIP_Real *branchcandssol, int nbranchcands, int nvars, SCIP_RESULT *result, SCIP_VAR **branchvar)
reliable pseudo costs branching rule
SCIP_BRANCHRULEDATA * GCGbranchGetScipBranchruledata(GCG_BRANCHRULE *branchrule)
Definition branchgcg.c:113
SCIP_BRANCHRULE * GCGbranchGetScipBranchrule(GCG_BRANCHRULE *branchrule)
Definition branchgcg.c:102
constraint handler for the integrality constraint
SCIP_CONS * GCGconsMasterbranchGetActiveCons(GCG *gcg)
SCIP_Bool GCGcurrentNodeIsGeneric(GCG *gcg)
SCIP_RETCODE GCGcreateConsMasterbranch(GCG *gcg, SCIP_CONS **cons, const char *name, SCIP_NODE *node, SCIP_CONS *parentcons, GCG_BRANCHRULE *branchrule, GCG_BRANCHDATA *branchdata, SCIP_CONS **origbranchconss, int norigbranchconss, int maxorigbranchconss)
constraint handler for storing the branching decisions at each node of the tree
constraint handler for storing the branching decisions at each node of the tree
#define SCIP_MAXSTRLEN
#define SCIP_INVALID
#define SCIP_Bool
#define MIN(x, y)
#define SCIP_Real
#define TRUE
#define FALSE
GCG interface methods.
SCIP_Bool GCGvarIsOriginal(SCIP_VAR *var)
Definition gcgvar.c:231
int GCGlinkingVarGetNBlocks(SCIP_VAR *var)
Definition gcgvar.c:572
SCIP_Bool GCGoriginalVarIsLinking(SCIP_VAR *var)
Definition gcgvar.c:247
SCIP_RETCODE GCGlinkingVarGetBlocks(SCIP_VAR *var, int nblocks, int *blocks)
Definition gcgvar.c:529
int GCGvarGetBlock(SCIP_VAR *var)
Definition gcgvar.c:1118
SCIP_RETCODE SCIPaddCoefLinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
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_Bool GCGisOriginal(SCIP *scip)
Definition misc.c:699
SCIP * GCGgetOrigprob(GCG *gcg)
Definition gcg.cpp:87
GCG_EXPORT int GCGgetNIdenticalBlocks(GCG *gcg, int pricingprobnr)
Definition relax_gcg.c:4185
SCIP * GCGgetMasterprob(GCG *gcg)
Definition gcg.cpp:99
SCIP_STAGE SCIPgetStage(SCIP *scip)
int SCIPgetNVars(SCIP *scip)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
SCIP_RETCODE SCIPaddConsNode(SCIP *scip, SCIP_NODE *node, SCIP_CONS *cons, SCIP_NODE *validnode)
SCIP_Real SCIPgetLocalLowerbound(SCIP *scip)
SCIP_Real SCIPgetLocalTransEstimate(SCIP *scip)
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)
SCIP_RETCODE SCIPsetBranchruleExecExt(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECEXT((*branchexecext)))
SCIP_RETCODE SCIPsetBranchruleExecLp(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECLP((*branchexeclp)))
SCIP_RETCODE SCIPsetBranchruleExecPs(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECPS((*branchexecps)))
const char * SCIPbranchruleGetName(SCIP_BRANCHRULE *branchrule)
SCIP_BRANCHRULEDATA * SCIPbranchruleGetData(SCIP_BRANCHRULE *branchrule)
SCIP_RETCODE SCIPsetBranchruleFree(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHFREE((*branchfree)))
SCIP_RETCODE SCIPsetBranchruleInit(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHINIT((*branchinit)))
void SCIPbranchruleSetData(SCIP_BRANCHRULE *branchrule, SCIP_BRANCHRULEDATA *branchruledata)
SCIP_RETCODE SCIPgetExternBranchCands(SCIP *scip, SCIP_VAR ***externcands, SCIP_Real **externcandssol, SCIP_Real **externcandsscore, int *nexterncands, int *nprioexterncands, int *nprioexternbins, int *nprioexternints, int *nprioexternimpls)
SCIP_RETCODE SCIPaddExternBranchCand(SCIP *scip, SCIP_VAR *var, SCIP_Real score, SCIP_Real solval)
void SCIPclearExternBranchCands(SCIP *scip)
int SCIPgetNExternBranchCands(SCIP *scip)
SCIP_RETCODE SCIPgetPseudoBranchCands(SCIP *scip, SCIP_VAR ***pseudocands, int *npseudocands, int *npriopseudocands)
SCIP_RETCODE SCIPcreateChild(SCIP *scip, SCIP_NODE **node, SCIP_Real nodeselprio, SCIP_Real estimate)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPfreeBlockMemoryNull(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPinfinity(SCIP *scip)
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 SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPgetRelaxSolVal(SCIP *scip, 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)
int SCIPvarGetBranchPriority(SCIP_VAR *var)
SCIP_Real SCIPgetVarPseudocostScore(SCIP *scip, SCIP_VAR *var, SCIP_Real solval)
int SCIPsnprintf(char *t, int len, const char *s,...)
static assert(heur !=NULL)
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
SCIP * origprob
* result
SCIP_VAR * var
int j
SCIP_Real solval
SCIPdebugMessage("feasibility pump finished [%d iterations done].\n", nloops)
int i
SCIPfreeBufferArray(scip, &cycles)
#define NULL
GCG variable pricer.
SCIP_RETCODE GCGrelaxIncludeBranchrule(GCG *gcg, SCIP_BRANCHRULE **branchrule, GCG_BRANCHRULE **gcgbranchrule, const char *name, const char *desc, int priority, int maxdepth, SCIP_Real maxbounddist, SCIP_BRANCHRULEDATA *branchruledata, GCG_DECL_BRANCHACTIVEMASTER((*branchactivemaster)), GCG_DECL_BRANCHDEACTIVEMASTER((*branchdeactivemaster)), GCG_DECL_BRANCHPROPMASTER((*branchpropmaster)), GCG_DECL_BRANCHMASTERSOLVED((*branchmastersolved)), GCG_DECL_BRANCHDATADELETE((*branchdatadelete)), GCG_DECL_BRANCHNEWCOL((*branchnewcol)), GCG_DECL_BRANCHGETEXTENDEDMASTERCONS((*branchgetextendedmastercons)),)
Definition relax_gcg.c:3717
SCIP_RETCODE GCGrelaxTransOrigToMasterCons(GCG *gcg, SCIP_CONS *cons, SCIP_CONS **transcons)
Definition relax_gcg.c:3982
SCIP_Bool GCGrelaxIsOrigSolFeasible(GCG *gcg)
Definition relax_gcg.c:4328
GCG relaxator.
SCIP_VAR * origvar
SCIP_Real oldvalue
SCIP_Real newbound
GCG_BOUNDTYPE boundtype
SCIP_Real olddualbound
SCIP_CONS * cons
SCIP_Real oldbound
SCIP_Bool enforcebycons
Definition branch_orig.c:88
GCG_BRANCHRULE * gcgbranchrule
SCIP_Bool usepsstrong
Definition branch_orig.c:96
struct SCIP_Branchrule SCIP_BRANCHRULE
struct SCIP_BranchruleData SCIP_BRANCHRULEDATA
type definitions for branching rules in GCG projects
#define GCG_DECL_BRANCHDATADELETE(x)
struct GCG_BranchData GCG_BRANCHDATA
enum GCG_BoundType GCG_BOUNDTYPE
@ GCG_BOUNDTYPE_UPPER
@ GCG_BOUNDTYPE_FIXED
@ GCG_BOUNDTYPE_LOWER
struct GCG_Branchrule GCG_BRANCHRULE
#define GCG_DECL_BRANCHACTIVEMASTER(x)
#define GCG_DECL_BRANCHMASTERSOLVED(x)
struct SCIP_Cons SCIP_CONS
struct Gcg GCG
Definition type_gcg.h:44
SCIP_DIDNOTRUN
SCIP_CUTOFF
SCIP_DIDNOTFIND
SCIP_BRANCHED
enum SCIP_Result SCIP_RESULT
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
SCIP_STAGE_SOLVING
struct SCIP_Node SCIP_NODE
struct SCIP_Var SCIP_VAR
SCIP_VARTYPE_INTEGER