Scippy

GCG

Branch-and-Price & Column Generation for Everyone

branch_relpsprob.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_relpsprob.c
30 *
31 * @brief generalized reliable pseudo costs branching rule
32 * @author Tobias Achterberg
33 * @author Timo Berthold
34 * @author Jens Schulz
35 * @author Gerald Gamrath
36 *
37 * - probing is executed until depth 10 and afterwards with stepsize 5
38 * by that all pseudocost scores and inference informations are updated
39 * otherwise the variable with best score is branched on
40 * - NEW! probing is done according to reliability values per candidate depending on tree size and probing rounds
41 * - the node is reevaluated immediately if MAXBDCHGS occur during probing
42 */
43
44/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
45/* #define SCIP_DEBUG */
46#include <assert.h>
47#include <string.h>
48
50#include "gcg/relax_gcg.h"
52#include "gcg/pricer_gcg.h"
53#include "gcg/gcg.h"
54
61#include "scip/branch_mostinf.h"
63#include "scip/branch_pscost.h"
64#include "scip/branch_random.h"
66#include "scip/nodesel_bfs.h"
67#include "scip/nodesel_dfs.h"
68
69
70#define BRANCHRULE_NAME "relpsprob"
71#define BRANCHRULE_DESC "generalized reliability branching using probing"
72#define BRANCHRULE_PRIORITY -100
73#define BRANCHRULE_MAXDEPTH -1
74#define BRANCHRULE_MAXBOUNDDIST 1.0
75
76#define DEFAULT_CONFLICTWEIGHT 0.01 /**< weight in score calculations for conflict score */
77#define DEFAULT_CONFLENGTHWEIGHT 0.0001 /**< weight in score calculations for conflict length score*/
78#define DEFAULT_INFERENCEWEIGHT 0.1 /**< weight in score calculations for inference score */
79#define DEFAULT_CUTOFFWEIGHT 0.0001 /**< weight in score calculations for cutoff score */
80#define DEFAULT_PSCOSTWEIGHT 1.0 /**< weight in score calculations for pseudo cost score */
81#define DEFAULT_MINRELIABLE 1.0 /**< minimal value for minimum pseudo cost size to regard pseudo cost value as reliable */
82#define DEFAULT_MAXRELIABLE 8.0 /**< maximal value for minimum pseudo cost size to regard pseudo cost value as reliable */
83#define DEFAULT_ITERQUOT 0.5 /**< maximal fraction of branching LP iterations compared to normal iters */
84#define DEFAULT_ITEROFS 100000 /**< additional number of allowed LP iterations */
85#define DEFAULT_MAXLOOKAHEAD 8 /**< maximal number of further variables evaluated without better score */
86#define DEFAULT_INITCAND 100 /**< maximal number of candidates initialized with strong branching per node */
87#define DEFAULT_MAXBDCHGS 20 /**< maximal number of bound tightenings before the node is immediately reevaluated (-1: unlimited) */
88#define DEFAULT_MINBDCHGS 1 /**< minimal number of bound tightenings before the node is reevaluated */
89#define DEFAULT_USELP TRUE /**< shall the lp be solved during probing? */
90#define DEFAULT_RELIABILITY 0.8 /**< reliability value for probing */
91
92#define HASHSIZE_VARS 131101 /**< minimal size of hash table in bdchgdata */
93
94
95/** branching rule data */
97{
98 SCIP_Real conflictweight; /**< weight in score calculations for conflict score */
99 SCIP_Real conflengthweight; /**< weight in score calculations for conflict length score */
100 SCIP_Real inferenceweight; /**< weight in score calculations for inference score */
101 SCIP_Real cutoffweight; /**< weight in score calculations for cutoff score */
102 SCIP_Real pscostweight; /**< weight in score calculations for pseudo cost score */
103 SCIP_Real minreliable; /**< minimal value for minimum pseudo cost size to regard pseudo cost value as reliable */
104 SCIP_Real maxreliable; /**< maximal value for minimum pseudo cost size to regard pseudo cost value as reliable */
105 SCIP_Real iterquot; /**< maximal fraction of branching LP iterations compared to normal iters */
106 SCIP_Longint nlpiterations; /**< total number of used LP iterations */
107 int iterofs; /**< additional number of allowed LP iterations */
108 int maxlookahead; /**< maximal number of further variables evaluated without better score */
109 int initcand; /**< maximal number of candidates initialized with strong branching per node */
110 int maxbdchgs; /**< maximal number of bound tightenings before the node is immediately reevaluated (-1: unlimited) */
111 int minbdchgs; /**< minimal number of bound tightenings before bound changes are applied */
112 SCIP_Bool uselp; /**< shall the lp be solved during probing? */
113 int nprobingnodes; /**< counter to store the total number of probing nodes */
114 int ninfprobings; /**< counter to store the number of probings which led to an infeasible branch */
115 SCIP_Real reliability; /**< reliability value for branching variables */
116 int nbranchings; /**< counter to store the total number of nodes that are branched */
117 int nresolvesminbdchgs; /**< counter to store how often node is reevaluated due to min bdchgs */
118 int nresolvesinfcands; /**< counter to store how often node is reevaluated since candidate with inf branch is chosen */
119 int nprobings; /**< counter to store the total number of probings that were performed */
120 SCIP_HASHMAP* varhashmap; /**< hash storing variables; image is position in following arrays */
121 int* nvarbranchings; /**< array to store number of branchings per variable */
122 int* nvarprobings; /**< array to store number of probings per variable */
123 int nvars; /**< number of variables that are in hashmap */
124 int maxvars; /**< capacity of nvarbranchings and nvarprobings */
125};
126
127/** data for pending bound changes */
129{
130 SCIP_HASHMAP* varhashmap; /**< hash storing variables; image is position in lbchgs-array */
131 SCIP_Real* lbchgs; /**< array containing lower bounds per variable */
132 SCIP_Real* ubchgs; /**< array containing upper bounds per variable */
133 SCIP_Bool* infroundings; /**< array to store for each var if some rounding is infeasible */
134 int nvars; /**< number of variables that are considered so far */
135};
136typedef struct BdchgData BDCHGDATA;
137
138
139/*
140 * local methods
141 */
142
143/** creates bound change data structure:
144 * all variables are put into a hashmap and arrays containig current lower and upper bounds are created
145 */
146static
148 SCIP* scip, /**< SCIP data structure */
149 BDCHGDATA** bdchgdata, /**< bound change data to be allocated */
150 SCIP_VAR** vars, /**< array of variables to be watched */
151 int nvars /**< number of variables to be watched */
152 )
153{
154
155 int i;
156
157 assert(scip != NULL);
158 assert(*bdchgdata == NULL);
159
160 /* get memory for bound change data structure */
161 SCIP_CALL( SCIPallocBuffer(scip, bdchgdata) );
162
163 /* create hash map */
164 SCIP_CALL( SCIPhashmapCreate(&(*bdchgdata)->varhashmap, SCIPblkmem(scip), HASHSIZE_VARS) );
165
166 /* get all variables */
167 SCIP_CALL( SCIPallocBufferArray(scip, &(*bdchgdata)->lbchgs, nvars) );
168 SCIP_CALL( SCIPallocBufferArray(scip, &(*bdchgdata)->ubchgs, nvars) );
169 SCIP_CALL( SCIPallocBufferArray(scip, &(*bdchgdata)->infroundings, nvars) );
170 (*bdchgdata)->nvars = nvars;
171
172 /* store current local bounds and capture variables */
173 for( i = 0; i < nvars; ++i )
174 {
175 SCIP_CALL( SCIPhashmapInsert((*bdchgdata)->varhashmap, vars[i], (void*) (size_t)i) );
176
177 (*bdchgdata)->lbchgs[i] = SCIPfeasCeil(scip, SCIPvarGetLbLocal(vars[i]));
178 (*bdchgdata)->ubchgs[i] = SCIPfeasFloor(scip, SCIPvarGetUbLocal(vars[i]));
179 (*bdchgdata)->infroundings[i] = FALSE;
180 }
181
182 return SCIP_OKAY;
183}
184
185/** method to free bound change data strucutre */
186static
188 SCIP* scip, /**< SCIP data structure */
189 BDCHGDATA* bdchgdata /**< bound change data to be allocated */
190 )
191{
192
193 assert(scip != NULL);
194 assert(bdchgdata != NULL);
195
196 /* free arrays & hashmap */
198 SCIPfreeBufferArray(scip, &bdchgdata->ubchgs);
199 SCIPfreeBufferArray(scip, &bdchgdata->lbchgs);
200
201 SCIPhashmapFree(&(bdchgdata->varhashmap));
202
203 /* free memory for bound change data structure */
204 SCIPfreeBuffer(scip, &bdchgdata);
205
206 return SCIP_OKAY;
207}
208
209
210/** adds given variable and bound change to hashmap and bound change arrays */
211static
213 SCIP* scip, /**< SCIP data structure */
214 BDCHGDATA* bdchgdata, /**< structure to keep bound chage data */
215 SCIP_VAR* var, /**< variable to store bound change */
216 SCIP_Real newbound, /**< new bound for given variable */
217 SCIP_BOUNDTYPE boundtype, /**< lower or upper bound change */
218 SCIP_Bool infrounding, /**< is the bdchg valid due to an infeasible rounding of the given var */
219 int* nbdchgs, /**< total number of bound changes occured so far */
220 SCIP_Bool* infeasible /**< pointer to store whether bound change makes the node infeasible */
221 )
222{
223 int nvars;
224 int pos;
225
226 assert(scip != NULL);
227 assert(bdchgdata != NULL);
228 assert(bdchgdata->varhashmap != NULL);
229 assert(bdchgdata->lbchgs != NULL);
230 assert(bdchgdata->ubchgs != NULL);
231 assert(var != NULL);
232
233 nvars = bdchgdata->nvars;
234
235 if( infeasible != NULL )
236 *infeasible = FALSE;
237
238 /* if variable is not in hashmap insert it and increase array sizes */
239 if( !SCIPhashmapExists(bdchgdata->varhashmap, var) )
240 {
241 SCIP_CALL( SCIPhashmapInsert(bdchgdata->varhashmap, var, (void*) (size_t)nvars) );
242 SCIP_CALL( SCIPreallocBufferArray(scip, &bdchgdata->lbchgs, nvars + 1) );
243 SCIP_CALL( SCIPreallocBufferArray(scip, &bdchgdata->ubchgs, nvars + 1) );
244
245 bdchgdata->lbchgs[nvars] = SCIPfeasCeil(scip, SCIPvarGetLbLocal(var));
246 bdchgdata->ubchgs[nvars] = SCIPfeasFloor(scip, SCIPvarGetUbLocal(var));
247 (bdchgdata->nvars)++;
248
249 assert(SCIPhashmapExists(bdchgdata->varhashmap, var)
250 && (int)(size_t) SCIPhashmapGetImage(bdchgdata->varhashmap, var) == nvars); /*lint !e507*/
251
252 }
253
254 /* get position of this variable */
255 pos = (int)(size_t) SCIPhashmapGetImage(bdchgdata->varhashmap, var); /*lint !e507*/
256
257 if( infrounding )
258 {
259 bdchgdata->infroundings[pos] = TRUE;
260 }
261
262 /* update bounds if necessary */
263 if( boundtype == SCIP_BOUNDTYPE_LOWER )
264 {
265 if( bdchgdata->lbchgs[pos] < newbound )
266 {
267 bdchgdata->lbchgs[pos] = newbound;
268 (*nbdchgs)++;
269 }
270
271 if( (infeasible != NULL) && (newbound > bdchgdata->ubchgs[pos]) )
272 {
273 *infeasible = TRUE;
274 }
275
276 }
277 else
278 {
279 if( newbound < bdchgdata->ubchgs[pos] )
280 {
281 bdchgdata->ubchgs[pos] = newbound;
282 (*nbdchgs)++;
283 }
284 if( (infeasible != NULL) && (newbound < bdchgdata->lbchgs[pos]) )
285 {
286 *infeasible = TRUE;
287 }
288 }
289
290 return SCIP_OKAY;
291}
292
293
294
295/** applies bound changes stored in bound change arrays */
296static
298 SCIP* scip, /**< SCIP data structure */
299 BDCHGDATA* bdchgdata, /**< structure containing bound changes for almost all variables */
300 SCIP_NODE* node /**< node for which bound changes are applied, NULL for curnode */
301 )
302{
303 SCIP_VAR** vars;
304
305 int nintvars;
306 int nbinvars;
307 int nvars;
308 int nbdchgs;
309 int i;
310
311 assert(scip != NULL);
312 assert(bdchgdata != NULL);
313
314 SCIPdebugMessage("apply bound changes\n");
315
316 nbdchgs = 0;
317
318 /* get all variables */
319 SCIP_CALL( SCIPgetVarsData(scip, &vars, NULL, &nbinvars, &nintvars, NULL, NULL) );
320 nvars = nbinvars + nintvars;
321 assert(vars != NULL);
322
323 /* get variable image in hashmap and update bounds if better ones found */
324 for( i = 0; i < nvars; ++i )
325 {
326 if( SCIPhashmapExists(bdchgdata->varhashmap, vars[i]) )
327 {
328 int pos;
329 pos = (int)(size_t)SCIPhashmapGetImage(bdchgdata->varhashmap, vars[i]); /*lint !e507*/
330
331 /* update lower bounds */
332 if( SCIPisFeasGT(scip, (bdchgdata->lbchgs)[pos], SCIPvarGetLbLocal(vars[i])) )
333 {
334 SCIPdebugMessage("branch_relpsprob: update lower bound of <%s> from %g to %g\n",
335 SCIPvarGetName(vars[i]), SCIPvarGetLbLocal(vars[i]), (bdchgdata->lbchgs)[pos]);
336 SCIP_CALL( SCIPchgVarLbNode(scip, node, vars[i], (bdchgdata->lbchgs)[pos]) );
337 ++nbdchgs;
338 }
339 /* update upper bounds */
340 if( SCIPisFeasLT(scip, (bdchgdata->ubchgs)[pos], SCIPvarGetUbLocal(vars[i])) )
341 {
342 SCIPdebugMessage("branch_relpsprob: update upper bound of <%s> from %g to %g\n",
343 SCIPvarGetName(vars[i]), SCIPvarGetUbLocal(vars[i]), (bdchgdata->ubchgs)[pos]);
344
345 SCIP_CALL( SCIPchgVarUbNode(scip, node, vars[i], (bdchgdata->ubchgs)[pos]) );
346 ++nbdchgs;
347 }
348 }
349 }
350
351 SCIPdebugMessage("applied %d bound changes\n", nbdchgs);
352 return SCIP_OKAY;
353}
354
355
356/** calculates an overall score value for the given individual score values */
357static
359 SCIP* scip, /**< SCIP data structure */
360 SCIP_BRANCHRULEDATA* branchruledata, /**< branching rule data */
361 SCIP_Real conflictscore, /**< conflict score of current variable */
362 SCIP_Real avgconflictscore, /**< average conflict score */
363 SCIP_Real conflengthscore, /**< conflict length score of current variable */
364 SCIP_Real avgconflengthscore, /**< average conflict length score */
365 SCIP_Real inferencescore, /**< inference score of current variable */
366 SCIP_Real avginferencescore, /**< average inference score */
367 SCIP_Real cutoffscore, /**< cutoff score of current variable */
368 SCIP_Real avgcutoffscore, /**< average cutoff score */
369 SCIP_Real pscostscore, /**< pscost score of current variable */
370 SCIP_Real avgpscostscore, /**< average pscost score */
371 SCIP_Real frac /**< fractional value of variable in current solution */
372 )
373{
374 SCIP_Real score;
375
376 assert(branchruledata != NULL);
377 /* assert(0.0 < frac && frac < 1.0); */
378
379 score = branchruledata->conflictweight * (1.0 - 1.0/(1.0+conflictscore/avgconflictscore))
380 + branchruledata->conflengthweight * (1.0 - 1.0/(1.0+conflengthscore/avgconflengthscore))
381 + branchruledata->inferenceweight * (1.0 - 1.0/(1.0+inferencescore/avginferencescore))
382 + branchruledata->cutoffweight * (1.0 - 1.0/(1.0+cutoffscore/avgcutoffscore))
383 + branchruledata->pscostweight * (1.0 - 1.0/(1.0+pscostscore/avgpscostscore));
384
385 /* values close to integral are possible and are adjusted to small non-zero values */
386 if( frac < 0.00000001 || frac > 0.999999 )
387 frac = 0.0001;
388 if( MIN(frac, 1.0 - frac) < 10.0*SCIPfeastol(scip) )
389 score *= 1e-6;
390
391 return score;
392}
393
394
395/* calculates variable bounds for an up-branch and a down-branch, supposig a LP or pseudo solution is given */
396static
398 SCIP* scip, /**< SCIP data structure */
399 SCIP_VAR* branchvar, /**< branching variable */
400 SCIP_Real* downlb, /**< lower bound of variable in down branch */
401 SCIP_Real* downub, /**< upper bound of variable in down branch */
402 SCIP_Real* uplb, /**< lower bound of variable in up branch */
403 SCIP_Real* upub /**< upper bound of variable in up branch */
404 )
405{
406 SCIP_Real varsol;
407 SCIP_Real lbdown;
408 SCIP_Real ubdown;
409 SCIP_Real lbup;
410 SCIP_Real ubup;
411
412 SCIP_Real lblocal;
413 SCIP_Real ublocal;
414
415 assert(scip != NULL);
416 assert(branchvar != NULL);
417
418 varsol = SCIPgetVarSol(scip, branchvar);
419
420 lblocal = SCIPfeasCeil(scip, SCIPvarGetLbLocal(branchvar));
421 ublocal = SCIPfeasFloor(scip, SCIPvarGetUbLocal(branchvar));
422
423 /* calculate bounds in down branch */
424 lbdown = lblocal;
425
426 /* in down branch: new upper bound is at most local upper bound - 1 */
427 ubdown = SCIPfeasFloor(scip, varsol) ;
428 if( SCIPisEQ(scip, ubdown, ublocal) )
429 ubdown -= 1.0;
430
431 assert(lbdown <= ubdown);
432
433 /* calculate bounds in up branch */
434 ubup = ublocal;
435
436 /* in right branch: new lower bound is at least local lower bound + 1 */
437 lbup = SCIPfeasCeil(scip, varsol);
438 if( SCIPisEQ(scip, lbup, lblocal) )
439 lbup += 1.0;
440
441 assert(SCIPisLE(scip, lbup, ubup));
442
443 /* ensure that both branches partition the domain */
444 if( SCIPisEQ(scip, lbup, ubdown) )
445 {
446 SCIP_Real middle = SCIPfloor(scip, lblocal/2 + ublocal/2);
447
448 if( SCIPisLE(scip, lbup, middle) )
449 ubdown -= 1.0;
450 else
451 lbup += 1.0;
452 }
453
454 /* ensure a real partition of the domain */
455 assert(SCIPisLT(scip, ubdown, lbup));
456 assert(SCIPisLE(scip, lbdown, ubdown));
457 assert(SCIPisLE(scip, lbup, ubup));
458
459 /* set return values */
460 if( downlb != NULL )
461 *downlb = lbdown;
462 if( downub != NULL )
463 *downub = ubdown;
464 if( uplb != NULL )
465 *uplb = lbup;
466 if( upub != NULL )
467 *upub = ubup;
468
469 return SCIP_OKAY;
470}
471
472
473/** applies probing of a single variable in the given direction, and stores evaluation in given arrays */
474static
476 GCG* gcg, /**< GCG data structure */
477 SCIP_VAR** vars, /**< problem variables */
478 int nvars, /**< number of problem variables */
479 SCIP_VAR* probingvar, /**< variable to perform probing on */
480 SCIP_Bool probingdir, /**< value to fix probing variable to */
481 SCIP_Bool solvelp, /**< value to decide whether pricing loop shall be performed */
482 SCIP_Longint* nlpiterations, /**< pointer to store the number of used LP iterations */
483 SCIP_Real* proplbs, /**< array to store lower bounds after full propagation */
484 SCIP_Real* propubs, /**< array to store upper bounds after full propagation */
485 SCIP_Real* lpobjvalue, /**< pointer to store the lp obj value if lp was solved */
486 SCIP_Bool* lpsolved, /**< pointer to store whether the lp was solved */
487 SCIP_Bool* lperror, /**< pointer to store whether an unresolved LP error occured or the
488 * solving process should be stopped (e.g., due to a time limit) */
489 SCIP_Bool* cutoff /**< pointer to store whether the probing direction is infeasible */
490 )
491{
492 SCIP* origprob;
493 SCIP* masterprob;
494 /* SCIP_Real varsol; */
495 SCIP_Real leftlbprobing;
496 SCIP_Real leftubprobing;
497 SCIP_Real rightlbprobing;
498 SCIP_Real rightubprobing;
499
500 origprob = GCGgetOrigprob(gcg);
501 masterprob = GCGgetMasterprob(gcg);
502
503 leftubprobing = -1.0;
504 leftlbprobing = -1.0;
505 rightlbprobing = -1.0;
506 rightubprobing = -1.0;
507
508 assert(proplbs != NULL);
509 assert(propubs != NULL);
510 assert(cutoff != NULL);
511 assert(SCIPvarGetLbLocal(probingvar) - 0.5 < SCIPvarGetUbLocal(probingvar));
512 assert(SCIPisFeasIntegral(origprob, SCIPvarGetLbLocal(probingvar)));
513 assert(SCIPisFeasIntegral(origprob, SCIPvarGetUbLocal(probingvar)));
514
515 assert(!solvelp || (lpsolved!=NULL && lpobjvalue!=NULL && lperror!=NULL));
516
517 /* varsol = SCIPgetRelaxSolVal(scip, probingvar); */
518
519 if( probingdir == FALSE )
520 {
521
522 SCIP_CALL( calculateBounds(origprob, probingvar,
523 &leftlbprobing, &leftubprobing, NULL, NULL) );
524 }
525 else
526 {
527 SCIP_CALL( calculateBounds(origprob, probingvar,
528 NULL, NULL, &rightlbprobing, &rightubprobing) );
529 }
530
531 SCIPdebugMessage("applying probing on variable <%s> == %u [%g,%g] (nlocks=%d/%d, impls=%d/%d, clqs=%d/%d)\n",
532 SCIPvarGetName(probingvar), probingdir,
533 probingdir ? rightlbprobing : leftlbprobing, probingdir ? rightubprobing : leftubprobing,
534 SCIPvarGetNLocksDown(probingvar), SCIPvarGetNLocksUp(probingvar),
535 SCIPvarGetNImpls(probingvar, FALSE), SCIPvarGetNImpls(probingvar, TRUE),
536 SCIPvarGetNCliques(probingvar, FALSE), SCIPvarGetNCliques(probingvar, TRUE));
537
538 /* start probing mode */
541
542 *lpsolved = FALSE;
543 *lperror = FALSE;
544
545 /* change variable bounds for the probing directions*/
546 if( probingdir == FALSE )
547 {
548 SCIP_CALL( SCIPchgVarUbProbing(origprob, probingvar, leftubprobing) );
549 }
550 else
551 {
552 SCIP_CALL( SCIPchgVarLbProbing(origprob, probingvar, rightlbprobing) );
553 }
554
555 /* apply propagation */
556 if( !(*cutoff) )
557 {
558 SCIP_CALL( SCIPpropagateProbing(origprob, -1, cutoff, NULL) ); /** @todo use maxproprounds */
559 }
560
561 /* evaluate propagation */
562 if( !(*cutoff) )
563 {
564 int i;
565
566 for( i = 0; i < nvars; ++i )
567 {
568 proplbs[i] = SCIPvarGetLbLocal(vars[i]);
569 propubs[i] = SCIPvarGetUbLocal(vars[i]);
570 }
571 }
572
573 /* if parameter is set, we want to use the outcome of the LP relaxation */
574 if( !(*cutoff) && solvelp )
575 {
576 *nlpiterations -= SCIPgetNLPIterations(masterprob);
577
578 /** @todo handle the feasible result */
581 lpobjvalue, lpsolved, lperror, cutoff) );
582 }
583
584 /* exit probing mode */
586
587 SCIPdebugMessage("probing results in cutoff/lpsolved/lpobj: %s / %s / %g\n",
588 *cutoff?"cutoff":"no cutoff", *lpsolved?"lpsolved":"lp not solved", *lpobjvalue);
589
590 return SCIP_OKAY;
591}
592
593
594/** gets generalized strong branching information on problem variable */
595static
597 GCG* gcg, /**< GCG data structure */
598 SCIP_VAR* probingvar, /**< variable to get strong probing branching values for */
599 BDCHGDATA* bdchgdata, /**< structure containing bound changes for almost all variables */
600 SCIP_Bool solvelp, /**< value to decide whether pricing loop shall be performed */
601 SCIP_Longint* nlpiterations, /**< pointert to stroe the number of used LP iterations */
602 SCIP_Real* down, /**< stores dual bound after branching column down */
603 SCIP_Real* up, /**< stores dual bound after branching column up */
604 SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL;
605 * otherwise, it can only be used as an estimate value */
606 SCIP_Bool* upvalid, /**< stores whether the returned up value is a valid dual bound, or NULL;
607 * otherwise, it can only be used as an estimate value */
608 SCIP_Bool* downinf, /**< pointer to store whether the downwards branch is infeasible, or NULL */
609 SCIP_Bool* upinf, /**< pointer to store whether the upwards branch is infeasible, or NULL */
610 SCIP_Bool* lperror, /**< pointer to store whether an unresolved LP error occured or the
611 * solving process should be stopped (e.g., due to a time limit) */
612 int* nbdchgs /**< pointer to store number of total bound changes */
613 )
614{
615 SCIP* origprob;
616 /* data for variables and bdchg arrays */
617 SCIP_VAR** probvars;
618 SCIP_VAR** vars;
619 int nvars;
620 int nintvars;
621 int nbinvars;
622
623 SCIP_Real* leftproplbs;
624 SCIP_Real* leftpropubs;
625 SCIP_Real* rightproplbs;
626 SCIP_Real* rightpropubs;
627
628 SCIP_Real leftlpbound;
629 SCIP_Real rightlpbound;
630 SCIP_Bool leftlpsolved;
631 SCIP_Bool rightlpsolved;
632 SCIP_Bool leftlperror;
633 SCIP_Bool rightlperror;
634 SCIP_Bool leftcutoff;
635 SCIP_Bool rightcutoff;
636 SCIP_Bool cutoff;
637 int i;
638 int j;
639
640 origprob = GCGgetOrigprob(gcg);
641
642 assert(lperror != NULL);
643
644 if( downvalid != NULL )
645 *downvalid = FALSE;
646 if( upvalid != NULL )
647 *upvalid = FALSE;
648 if( downinf != NULL )
649 *downinf = FALSE;
650 if( upinf != NULL )
651 *upinf = FALSE;
652
653 if( SCIPisStopped(origprob) )
654 {
656 " (%.1fs) probing aborted: solving stopped\n", SCIPgetSolvingTime(origprob));
657 return SCIP_OKAY;
658 }
659
660 /* get all variables to store branching deductions of variable bounds */
661 /* get all variables and store them in array 'vars' */
662 SCIP_CALL( SCIPgetVarsData(origprob, &probvars, NULL, &nbinvars, &nintvars, NULL, NULL) );
663 nvars = nbinvars + nintvars; /* continuous variables are not considered here */
664
665 SCIP_CALL( SCIPduplicateBufferArray(origprob, &vars, probvars, nvars) );
666
667 /* capture variables to make sure the variables are not deleted */
668 for( i = 0; i < nvars; ++i )
669 {
670 SCIP_CALL( SCIPcaptureVar(origprob, vars[i]) );
671 }
672
673 /* get temporary memory for storing probing results */
674 SCIP_CALL( SCIPallocBufferArray(origprob, &leftproplbs, nvars) );
675 SCIP_CALL( SCIPallocBufferArray(origprob, &leftpropubs, nvars) );
676 SCIP_CALL( SCIPallocBufferArray(origprob, &rightproplbs, nvars) );
677 SCIP_CALL( SCIPallocBufferArray(origprob, &rightpropubs, nvars) );
678
679 /* for each binary variable, probe fixing the variable to left and right */
680 cutoff = FALSE;
681 leftcutoff = FALSE;
682 rightcutoff = FALSE;
683
684 /* better assume we don't have an error (fixes clang warning)*/
685 leftlperror = FALSE;
686 rightlperror = FALSE;
687
688 /* better assume we don't have solved the lp (fixes clang warning)*/
689 leftlpsolved = FALSE;
690 rightlpsolved = FALSE;
691
692
693 /* left branch: apply probing for setting ub to LP solution value */
694 SCIP_CALL( applyProbing(gcg, vars, nvars, probingvar, FALSE, solvelp, nlpiterations,
695 leftproplbs, leftpropubs,
696 &leftlpbound, &leftlpsolved, &leftlperror, &leftcutoff) );
697
698 if( leftcutoff )
699 {
700 SCIP_Real newbound;
701
702 SCIP_CALL( calculateBounds(origprob, probingvar, NULL, NULL, &newbound, NULL) );
703
704 /* lower bound can be updated */
705 SCIPdebugMessage("change lower bound of probing variable <%s> from %g to %g, nlocks=(%d/%d)\n",
706 SCIPvarGetName(probingvar), SCIPvarGetLbLocal(probingvar), newbound,
707 SCIPvarGetNLocksDown(probingvar), SCIPvarGetNLocksUp(probingvar));
708
709 SCIP_CALL( addBdchg(origprob, bdchgdata, probingvar, newbound, SCIP_BOUNDTYPE_LOWER, TRUE, nbdchgs, &cutoff) );
710 }
711
712 if( !cutoff )
713 {
714 /* right branch: apply probing for setting lb to LP solution value */
715 SCIP_CALL( applyProbing(gcg, vars, nvars, probingvar, TRUE, solvelp, nlpiterations,
716 rightproplbs, rightpropubs,
717 &rightlpbound, &rightlpsolved, &rightlperror, &rightcutoff) );
718
719 if( rightcutoff )
720 {
721 SCIP_Real newbound;
722
723 SCIP_CALL( calculateBounds(origprob, probingvar, NULL, &newbound, NULL, NULL) );
724
725 /* upper bound can be updated */
726 SCIPdebugMessage("change probing variable <%s> upper bound from %g to %g, nlocks=(%d/%d)\n",
727 SCIPvarGetName(probingvar), SCIPvarGetUbLocal(probingvar), newbound,
728 SCIPvarGetNLocksDown(probingvar), SCIPvarGetNLocksUp(probingvar));
729
730 SCIP_CALL( addBdchg(origprob, bdchgdata, probingvar, newbound, SCIP_BOUNDTYPE_UPPER, TRUE, nbdchgs, &cutoff) );
731 }
732 }
733
734 /* set return value of lperror */
735 cutoff = cutoff || (leftcutoff && rightcutoff);
736 *lperror = leftlperror || rightlperror;
737
738
739 /* analyze probing deductions */
740
741 /* 1. dualbounds */
742 if( leftlpsolved )
743 *down = leftlpbound;
744 if( rightlpsolved )
745 *up = rightlpbound; /*lint !e644*/
746
747 /* 2. update bounds */
748 for( j = 0; j < nvars && !cutoff; ++j )
749 {
750 SCIP_Real newlb;
751 SCIP_Real newub;
752
753 if( vars[j] == probingvar )
754 continue;
755
756 /* new bounds of the variable is the union of the propagated bounds of the left and right case */
757 newlb = MIN(leftproplbs[j], rightproplbs[j]);
758 newub = MAX(leftpropubs[j], rightpropubs[j]);
759
760 /* check for fixed variables */
761 if( SCIPisFeasEQ(origprob, newlb, newub) )
762 {
763 /* in both probings, variable j is deduced to a fixed value */
764 SCIP_CALL( addBdchg(origprob, bdchgdata, vars[j], newlb, SCIP_BOUNDTYPE_LOWER, FALSE, nbdchgs, &cutoff) );
765 SCIP_CALL( addBdchg(origprob, bdchgdata, vars[j], newub, SCIP_BOUNDTYPE_UPPER, FALSE, nbdchgs, &cutoff) );
766 continue;
767 }
768 else
769 {
770 SCIP_Real oldlb;
771 SCIP_Real oldub;
772
774
775 /* check for bound tightenings */
776 oldlb = SCIPvarGetLbLocal(vars[j]);
777 oldub = SCIPvarGetUbLocal(vars[j]);
778 if( SCIPisLbBetter(origprob, newlb, oldlb, oldub) )
779 {
780 /* in both probings, variable j is deduced to be at least newlb: tighten lower bound */
781 SCIP_CALL( addBdchg(origprob, bdchgdata, vars[j], newlb, SCIP_BOUNDTYPE_LOWER, FALSE, nbdchgs, &cutoff) );
782 }
783 if( SCIPisUbBetter(origprob, newub, oldlb, oldub) && !cutoff )
784 {
785 /* in both probings, variable j is deduced to be at most newub: tighten upper bound */
786 SCIP_CALL( addBdchg(origprob, bdchgdata, vars[j], newub, SCIP_BOUNDTYPE_UPPER, FALSE, nbdchgs, &cutoff) );
787 }
788
789 }
790
791 } /* end check for deductions */
792
793 /* set correct return values */
794 if( down != NULL && leftlpsolved )
795 *down = leftlpbound;
796 if( up != NULL && rightlpsolved )
797 *up = rightlpbound;
798 if( downvalid != NULL && leftlpsolved )
799 *downvalid = TRUE;
800 if( downvalid != NULL && !leftlpsolved )
801 *downvalid = FALSE;
802 if( upvalid != NULL && rightlpsolved )
803 *upvalid = TRUE;
804 if( upvalid != NULL && !rightlpsolved )
805 *upvalid = FALSE;
806 if( downinf != NULL )
807 *downinf = leftcutoff;
808 if( upinf != NULL )
809 *upinf = rightcutoff;
810
811 if( cutoff )
812 {
813 if( downinf != NULL )
814 *downinf = cutoff;
815 if( upinf != NULL )
816 *upinf = cutoff;
817 }
818
819 /* free temporary memory */
820 SCIPfreeBufferArray(origprob, &rightpropubs);
821 SCIPfreeBufferArray(origprob, &rightproplbs);
822 SCIPfreeBufferArray(origprob, &leftpropubs);
823 SCIPfreeBufferArray(origprob, &leftproplbs);
824
825 /* release variables */
826 for( i = 0; i < nvars; ++i )
827 {
828 SCIP_CALL( SCIPreleaseVar(origprob, &vars[i]) );
829 }
830 SCIPfreeBufferArray(origprob, &vars);
831
832
833 return SCIP_OKAY;
834}
835
836
837
838
839/** adds branching candidates to branchruledata to collect infos about it */
840static
842 SCIP* scip, /**< SCIP data structure */
843 SCIP_BRANCHRULE* branchrule, /**< branching rule */
844 SCIP_VAR** branchcands, /**< branching candidates */
845 int nbranchcands /**< number of branching candidates */
846 )
847{
848
849 SCIP_BRANCHRULEDATA* branchruledata;
850 int j;
851
852
853 /* get branching rule data */
854 branchruledata = SCIPbranchruleGetData(branchrule);
855 assert(branchruledata != NULL);
856
857 if( branchruledata->nvars == 0 )
858 { /* no variables known before, reinitialized hashmap and variable info storage */
859
860 /* create hash map */
861 assert(branchruledata->varhashmap == NULL);
863
864 branchruledata->maxvars = SCIPcalcMemGrowSize(scip, nbranchcands);
865 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &branchruledata->nvarprobings, branchruledata->maxvars) );
866 SCIP_CALL( SCIPallocBlockMemoryArray(scip, &branchruledata->nvarbranchings, branchruledata->maxvars) );
867 branchruledata->nvars = nbranchcands;
868
869 /* store each variable in hashmap and initialize array entries */
870 for( j = 0; j < nbranchcands; ++j )
871 {
872 SCIP_CALL( SCIPhashmapInsert(branchruledata->varhashmap, branchcands[j], (void*) (size_t)j) );
873 branchruledata->nvarprobings[j] = 0;
874 branchruledata->nvarbranchings[j] = 0;
875 }
876 }
877 else /* possibly new variables need to be added */
878 {
879
880 /* if var is not in hashmap, insert it */
881 for( j = 0; j < nbranchcands; ++j )
882 {
883 SCIP_VAR* var;
884 int nvars;
885
886 var = branchcands[j];
887 assert(var != NULL);
888 nvars = branchruledata->nvars;
889
890 /* if variable is not in hashmap insert it and increase array sizes */
891 if( !SCIPhashmapExists(branchruledata->varhashmap, var) )
892 {
893 int newsize = SCIPcalcMemGrowSize(scip, nvars + 1);
894 SCIP_CALL( SCIPhashmapInsert(branchruledata->varhashmap, var, (void*) (size_t)nvars) );
895 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &branchruledata->nvarprobings, branchruledata->maxvars,
896 newsize) );
897 SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &branchruledata->nvarbranchings, branchruledata->maxvars,
898 newsize) );
899 branchruledata->maxvars = newsize;
900
901 branchruledata->nvarprobings[nvars] = 0;
902 branchruledata->nvarbranchings[nvars] = 0;
903
904 assert(SCIPhashmapExists(branchruledata->varhashmap, var)
905 && (int)(size_t) SCIPhashmapGetImage(branchruledata->varhashmap, var) == nvars); /*lint !e507*/
906
907 ++(branchruledata->nvars);
908 }
909
910 }
911 }
912
913 return SCIP_OKAY;
914}
915
916/** increases number of branchings that took place on the given variable */
917static
919 SCIP* scip, /**< SCIP data structure */
920 SCIP_BRANCHRULE* branchrule, /**< branching rule */
921 SCIP_VAR* var /**< variable to increase number of branchings on */
922 )
923{
924 SCIP_BRANCHRULEDATA* branchruledata;
925 int pos;
926
927 assert(scip != NULL);
928 assert(branchrule != NULL);
929 assert(var != NULL);
930
931 /* get branching rule data */
932 branchruledata = SCIPbranchruleGetData(branchrule);
933 assert(branchruledata != NULL);
934
935 assert(SCIPhashmapExists(branchruledata->varhashmap, var) );
936
937 pos = (int)(size_t) SCIPhashmapGetImage(branchruledata->varhashmap, var); /*lint !e507*/
938 (branchruledata->nvarbranchings[pos])++;
939
940 (branchruledata->nbranchings)++;
941
942 return SCIP_OKAY;
943}
944
945/** increases number of probings that took place on the given variable */
946static
948 SCIP* scip, /**< SCIP data structure */
949 SCIP_BRANCHRULE* branchrule, /**< branching rule */
950 SCIP_VAR* var /**< variable to increase number of branchings on */
951 )
952{
953 SCIP_BRANCHRULEDATA* branchruledata;
954 int pos;
955
956 assert(scip != NULL);
957 assert(branchrule != NULL);
958 assert(var != NULL);
959
960 /* get branching rule data */
961 branchruledata = SCIPbranchruleGetData(branchrule);
962 assert(branchruledata != NULL);
963
964 assert(SCIPhashmapExists(branchruledata->varhashmap, var) );
965
966 pos = (int)(size_t) SCIPhashmapGetImage(branchruledata->varhashmap, var); /*lint !e507*/
967 (branchruledata->nvarprobings[pos])++;
968
969 (branchruledata->nprobings)++;
970
971 return SCIP_OKAY;
972}
973
974
975/** execute generalized reliability pseudo cost probing branching */
976static
978 GCG* gcg, /**< GCG data structure */
979 SCIP_BRANCHRULE* branchrule, /**< branching rule */
980 SCIP_VAR** branchcands, /**< branching candidates */
981 SCIP_Real* branchcandssol, /**< solution value for the branching candidates */
982 int nbranchcands, /**< number of branching candidates */
983 int nvars, /**< number of variables to be watched be bdchgdata */
984 SCIP_RESULT* result, /**< pointer to the result of the execution */
985 SCIP_VAR** branchvar /**< pointer to the variable to branch on */
986 )
987{
988 SCIP* origprob;
989 SCIP* masterprob;
990 SCIP_BRANCHRULEDATA* branchruledata;
991 BDCHGDATA* bdchgdata;
992 SCIP_Real lpobjval;
993#ifndef NDEBUG
994 SCIP_Real cutoffbound;
995#endif
996 SCIP_Real provedbound;
997#ifdef SCIP_DEBUG
998 SCIP_Bool bestisstrongbranch = FALSE;
999#endif
1000 int bestcand = -1;
1001
1002 *result = SCIP_DIDNOTRUN;
1003 origprob = GCGgetOrigprob(gcg);
1004 masterprob = GCGgetMasterprob(gcg);
1005
1006 SCIPdebugMessage("execrelpsprob method called\n relpsprob\n relpsprob\n relpsprob\n relpsprob\n relpsprob\n relpsprob\n relpsprob\n relpsprob\n");
1007
1008 /* get branching rule data */
1009 branchruledata = SCIPbranchruleGetData(branchrule);
1010 assert(branchruledata != NULL);
1011
1012 /* add all branching candidates into branchruledata if not yet inserted */
1013 SCIP_CALL( addBranchcandsToData(origprob, branchrule, branchcands, nbranchcands) );
1014
1015 bdchgdata = NULL;
1016 /* create data structure for bound change infos */
1017 SCIP_CALL( createBdchgData(origprob, &bdchgdata, branchcands, nvars) );
1018 assert(bdchgdata != NULL);
1019
1020 /* get current LP objective bound of the local sub problem and global cutoff bound */
1021 lpobjval = SCIPgetLocalLowerbound(origprob);
1022#ifndef NDEBUG
1023 cutoffbound = SCIPgetCutoffbound(origprob);
1024#endif
1025 provedbound = lpobjval;
1026
1027 if( nbranchcands == 1 )
1028 {
1029 /* only one candidate: nothing has to be done */
1030 bestcand = 0;
1031 }
1032 else
1033 {
1034 SCIP_Real* initcandscores;
1035 int* initcands;
1036 int maxninitcands;
1037 int nbdchgs;
1038 SCIP_Real avgconflictscore;
1039 SCIP_Real avgconflengthscore;
1040 SCIP_Real avginferencescore;
1041 SCIP_Real avgcutoffscore;
1042 SCIP_Real avgpscostscore;
1043 SCIP_Real bestpsscore;
1044 SCIP_Real bestsbscore;
1045 SCIP_Real bestuninitsbscore;
1046 SCIP_Real bestsbfracscore;
1047 SCIP_Real bestsbdomainscore;
1048 int ninfprobings;
1049 int maxbdchgs;
1050 int bestpscand;
1051 int bestsbcand;
1052 int i;
1053 int j;
1054 int c;
1055 int ninitcands = 0;
1056
1057 /* get average conflict, inference, and pseudocost scores */
1058 avgconflictscore = SCIPgetAvgConflictScore(origprob);
1059 avgconflictscore = MAX(avgconflictscore, 0.1);
1060 avgconflengthscore = SCIPgetAvgConflictlengthScore(origprob);
1061 avgconflengthscore = MAX(avgconflengthscore, 0.1);
1062 avginferencescore = SCIPgetAvgInferenceScore(origprob);
1063 avginferencescore = MAX(avginferencescore, 0.1);
1064 avgcutoffscore = SCIPgetAvgCutoffScore(origprob);
1065 avgcutoffscore = MAX(avgcutoffscore, 0.1);
1066 avgpscostscore = SCIPgetAvgPseudocostScore(origprob);
1067 avgpscostscore = MAX(avgpscostscore, 0.1);
1068
1069 /* get maximal number of candidates to initialize with strong branching; if the current solutions is not basic,
1070 * we cannot apply the simplex algorithm and therefore don't initialize any candidates
1071 */
1072 maxninitcands = MIN(nbranchcands, branchruledata->initcand);
1073
1074 if( !SCIPisLPSolBasic(masterprob) )
1075 {
1076 maxninitcands = 0;
1077 SCIPdebugMessage("solution is not basic\n");
1078 }
1079
1080 SCIPdebugMessage("maxninitcands = %d\n", maxninitcands);
1081
1082 /* get buffer for storing the unreliable candidates */
1083 SCIP_CALL( SCIPallocBufferArray(origprob, &initcands, maxninitcands+1) ); /* allocate one additional slot for convenience */
1084 SCIP_CALL( SCIPallocBufferArray(origprob, &initcandscores, maxninitcands+1) );
1085
1086 /* initialize bound change arrays */
1087 nbdchgs = 0;
1088 maxbdchgs = branchruledata->maxbdchgs;
1089
1090 ninfprobings = 0;
1091
1092
1093 /* search for the best pseudo cost candidate, while remembering unreliable candidates in a sorted buffer */
1094 bestpscand = -1;
1095 bestpsscore = -SCIPinfinity(origprob);
1096 for( c = 0; c < nbranchcands; ++c )
1097 {
1098 SCIP_Real conflictscore;
1099 SCIP_Real conflengthscore;
1100 SCIP_Real inferencescore;
1101 SCIP_Real cutoffscore;
1102 SCIP_Real pscostscore;
1103 SCIP_Real score;
1104
1105 assert(branchcands[c] != NULL);
1106
1107 /* get conflict, inference, cutoff, and pseudo cost scores for candidate */
1108 conflictscore = SCIPgetVarConflictScore(origprob, branchcands[c]);
1109 conflengthscore = SCIPgetVarConflictlengthScore(origprob, branchcands[c]);
1110 inferencescore = SCIPgetVarAvgInferenceScore(origprob, branchcands[c]);
1111 cutoffscore = SCIPgetVarAvgCutoffScore(origprob, branchcands[c]);
1112 pscostscore = SCIPgetVarPseudocostScore(origprob, branchcands[c], branchcandssol[c]);
1113
1114
1115 /* combine the four score values */
1116 score = calcScore(origprob, branchruledata, conflictscore, avgconflictscore, conflengthscore, avgconflengthscore,
1117 inferencescore, avginferencescore, cutoffscore, avgcutoffscore, pscostscore, avgpscostscore,
1118 branchcandssol[c] - SCIPfloor(origprob, branchcandssol[c]));
1119
1120 /* pseudo cost of variable is not reliable: insert candidate in initcands buffer */
1121 for( j = ninitcands; j > 0 && score > initcandscores[j-1]; --j )
1122 {
1123 initcands[j] = initcands[j-1];
1124 initcandscores[j] = initcandscores[j-1];
1125 }
1126
1127 initcands[j] = c;
1128 initcandscores[j] = score;
1129 ninitcands++;
1130 ninitcands = MIN(ninitcands, maxninitcands);
1131 }
1132
1133 /* initialize unreliable candidates with probing,
1134 * search best strong branching candidate
1135 */
1136 SCIPdebugMessage("ninitcands = %d\n", ninitcands);
1137
1138 bestsbcand = -1;
1139 bestsbscore = -SCIPinfinity(origprob);
1140 bestsbfracscore = -SCIPinfinity(origprob);
1141 bestsbdomainscore = -SCIPinfinity(origprob);
1142 for( i = 0; i < ninitcands; ++i )
1143 {
1144 SCIP_Real down;
1145 SCIP_Real up;
1146 SCIP_Real downgain;
1147 SCIP_Real upgain;
1148 SCIP_Bool downvalid;
1149 SCIP_Bool upvalid;
1150 SCIP_Bool lperror;
1151 SCIP_Bool downinf;
1152 SCIP_Bool upinf;
1153
1154 lperror = FALSE;
1155 up = 0.;
1156 down = 0.;
1157
1158 /* get candidate number to initialize */
1159 c = initcands[i];
1160
1161 SCIPdebugMessage("init pseudo cost (%g/%g) of <%s> with bounds [%g,%g] at %g (score:%g)\n",
1164 SCIPvarGetName(branchcands[c]), SCIPvarGetLbLocal(branchcands[c]), SCIPvarGetUbLocal(branchcands[c]),
1165 branchcandssol[c], initcandscores[i]);
1166
1167 /* try branching on this variable (propagation + lp solving (pricing) ) */
1168 SCIP_CALL( getVarProbingbranch(gcg, branchcands[c], bdchgdata, branchruledata->uselp, &branchruledata->nlpiterations,
1169 &down, &up, &downvalid, &upvalid, &downinf, &upinf, &lperror, &nbdchgs) );
1170
1171 branchruledata->nprobingnodes++;
1172 branchruledata->nprobingnodes++;
1173 SCIP_CALL( incNVarProbings(origprob, branchrule, branchcands[c]) );
1174
1175 /* check for an error in strong branching */
1176 if( lperror )
1177 {
1178 if( !SCIPisStopped(origprob) )
1179 {
1181 "(node %"SCIP_LONGINT_FORMAT") error in strong branching call for variable <%s> with solution %g\n",
1182 SCIPgetNNodes(origprob), SCIPvarGetName(branchcands[c]), branchcandssol[c]);
1183 }
1184 break;
1185 }
1186
1187
1188 if( SCIPisStopped(origprob) )
1189 {
1190 break;
1191 }
1192
1193 /* check if there are infeasible roundings */
1194 if( downinf && upinf )
1195 {
1196 /* both roundings are infeasible -> node is infeasible */
1197 SCIPdebugMessage(" -> variable <%s> is infeasible in both directions\n",
1198 SCIPvarGetName(branchcands[c]));
1199
1200 *result = SCIP_CUTOFF;
1201 break; /* terminate initialization loop, because node is infeasible */
1202 }
1203
1204
1205 /* evaluate strong branching */
1206 down = MAX(down, lpobjval);
1207 up = MAX(up, lpobjval);
1208 downgain = down - lpobjval;
1209 upgain = up - lpobjval;
1210 assert(!downvalid || downinf == SCIPisGE(origprob, down, cutoffbound));
1211 assert(!upvalid || upinf == SCIPisGE(origprob, up, cutoffbound));
1212
1213 /* the minimal lower bound of both children is a proved lower bound of the current subtree */
1214 if( downvalid && upvalid )
1215 {
1216 SCIP_Real minbound;
1217
1218 minbound = MIN(down, up);
1219 provedbound = MAX(provedbound, minbound);
1220 }
1221
1222
1223 /* terminate initialization loop, if enough roundings are performed */
1224 if( maxbdchgs >= 0 && nbdchgs >= maxbdchgs )
1225 break;
1226
1227 /* case one rounding is infeasible is regarded in method SCIPgetVarProbingbranch */
1228 if( downinf || upinf )
1229 {
1230 branchruledata->ninfprobings++;
1231 ninfprobings++;
1232 }
1233
1234 /* if both roundings are valid, update scores */
1235 if( !downinf && !upinf )
1236 {
1237 SCIP_Real frac;
1238 SCIP_Real conflictscore;
1239 SCIP_Real conflengthscore;
1240 SCIP_Real inferencescore;
1241 SCIP_Real cutoffscore;
1242 SCIP_Real pscostscore;
1243 SCIP_Real score;
1244
1245 frac = branchcandssol[c] - SCIPfloor(origprob, branchcandssol[c]);
1246
1247 /* check for a better score */
1248 conflictscore = SCIPgetVarConflictScore(origprob, branchcands[c]);
1249 conflengthscore = SCIPgetVarConflictlengthScore(origprob, branchcands[c]);
1250 inferencescore = SCIPgetVarAvgInferenceScore(origprob, branchcands[c]);
1251 cutoffscore = SCIPgetVarAvgCutoffScore(origprob, branchcands[c]);
1252 pscostscore = SCIPgetBranchScore(origprob, branchcands[c], downgain, upgain);
1253 score = calcScore(origprob, branchruledata, conflictscore, avgconflictscore, conflengthscore, avgconflengthscore,
1254 inferencescore, avginferencescore, cutoffscore, avgcutoffscore, pscostscore, avgpscostscore, frac);
1255
1256 if( SCIPisSumGE(origprob, score, bestsbscore) )
1257 {
1258 SCIP_Real fracscore;
1259 SCIP_Real domainscore;
1260
1261 fracscore = MIN(frac, 1.0 - frac);
1262 domainscore = -(SCIPvarGetUbLocal(branchcands[c]) - SCIPvarGetLbLocal(branchcands[c]));
1263 if( SCIPisSumGT(origprob, score, bestsbscore )
1264 || SCIPisSumGT(origprob, fracscore, bestsbfracscore)
1265 || (SCIPisSumGE(origprob, fracscore, bestsbfracscore) && domainscore > bestsbdomainscore) )
1266 {
1267 bestsbcand = c;
1268 bestsbscore = score;
1269 bestsbfracscore = fracscore;
1270 bestsbdomainscore = domainscore;
1271 }
1272 }
1273
1274 /* update pseudo cost values */
1275 assert(!SCIPisFeasNegative(origprob, frac));
1276 SCIP_CALL( SCIPupdateVarPseudocost(origprob, branchcands[c], 0.0-frac, downgain, 1.0) );
1277 SCIP_CALL( SCIPupdateVarPseudocost(origprob, branchcands[c], 1.0-frac, upgain, 1.0) );
1278
1279 SCIPdebugMessage(" -> variable <%s> (solval=%g, down=%g (%+g), up=%g (%+g), score=%g/ %g/%g %g/%g -> %g)\n",
1280 SCIPvarGetName(branchcands[c]), branchcandssol[c], down, downgain, up, upgain,
1281 pscostscore, conflictscore, conflengthscore, inferencescore, cutoffscore, score);
1282
1283 }
1284 }
1285#ifdef SCIP_DEBUG
1286 if( bestsbcand >= 0 )
1287 {
1288 SCIPdebugMessage(" -> best: <%s> (%g / %g / %g)\n",
1289 SCIPvarGetName(branchcands[bestsbcand]), bestsbscore, bestsbfracscore, bestsbdomainscore);
1290 }
1291#endif
1292 if( bestsbcand >= 0 )
1293 {
1294 SCIPdebugMessage(" -> best: <%s> (%g / %g / %g)\n",
1295 SCIPvarGetName(branchcands[bestsbcand]), bestsbscore, bestsbfracscore, bestsbdomainscore);
1296 }
1297
1298 /* get the score of the best uninitialized strong branching candidate */
1299 if( i < ninitcands )
1300 bestuninitsbscore = initcandscores[i];
1301 else
1302 bestuninitsbscore = -SCIPinfinity(origprob);
1303
1304 /* if the best pseudo cost candidate is better than the best uninitialized strong branching candidate,
1305 * compare it to the best initialized strong branching candidate
1306 */
1307 if( bestpsscore > bestuninitsbscore && SCIPisSumGT(origprob, bestpsscore, bestsbscore) )
1308 {
1309 bestcand = bestpscand;
1310#ifdef SCIP_DEBUG
1311 bestisstrongbranch = FALSE;
1312#endif
1313 }
1314 else if( bestsbcand >= 0 )
1315 {
1316 bestcand = bestsbcand;
1317#ifdef SCIP_DEBUG
1318 bestisstrongbranch = TRUE;
1319#endif
1320 }
1321 else
1322 {
1323 /* no candidate was initialized, and the best score is the one of the first candidate in the initialization
1324 * queue
1325 */
1326 assert(ninitcands >= 1);
1327 bestcand = initcands[0];
1328#ifdef SCIP_DEBUG
1329 bestisstrongbranch = FALSE;
1330#endif
1331 }
1332
1333 /* apply domain reductions */
1334 if( (nbdchgs >= branchruledata->minbdchgs || ninfprobings >= 5 )
1335 && *result != SCIP_CUTOFF && !SCIPisStopped(origprob) )
1336 {
1337 SCIP_CALL( applyBdchgs(origprob, bdchgdata, SCIPgetCurrentNode(origprob)) );
1338 branchruledata->nresolvesminbdchgs++;
1339 *result = SCIP_REDUCEDDOM; /* why was this commented out?? */
1340 }
1341
1342 /* free buffer for the unreliable candidates */
1343 SCIPfreeBufferArray(origprob, &initcandscores);
1344 SCIPfreeBufferArray(origprob, &initcands);
1345 }
1346
1347 /* if no domain could be reduced, create the branching */
1348 if( *result != SCIP_CUTOFF && *result != SCIP_REDUCEDDOM
1349 && *result != SCIP_CONSADDED && !SCIPisStopped(origprob) )
1350 {
1351 assert(*result == SCIP_DIDNOTRUN);
1352 assert(0 <= bestcand && bestcand < nbranchcands);
1353 assert(SCIPisLT(origprob, provedbound, cutoffbound));
1354
1355#ifdef SCIP_DEBUG
1356 SCIPdebugMessage(" -> best: <%s> (strongbranch = %ud)\n", SCIPvarGetName(branchcands[bestcand]), bestisstrongbranch);
1357#endif
1358 *branchvar = branchcands[bestcand];
1359 SCIP_CALL( incNVarBranchings(origprob, branchrule, *branchvar) );
1360 }
1361
1362 /* free data structure for bound change infos */
1363 SCIP_CALL( freeBdchgData(origprob, bdchgdata) );
1364
1365 return SCIP_OKAY;
1366}
1367
1368
1369/*
1370 * Callback methods
1371 */
1372
1373/** destructor of branching rule to free user data (called when SCIP is exiting) */
1374static
1375SCIP_DECL_BRANCHFREE(branchFreeRelpsprob)
1376{ /*lint --e{715}*/
1377 SCIP_BRANCHRULEDATA* branchruledata;
1378
1379 /* free branching rule data */
1380 branchruledata = SCIPbranchruleGetData(branchrule);
1381
1382 SCIPdebugMessage("**needed in total %d probing nodes\n", branchruledata->nprobingnodes);
1383
1384 SCIPfreeMemory(scip, &branchruledata);
1385 SCIPbranchruleSetData(branchrule, NULL);
1386
1387 return SCIP_OKAY;
1388}
1389
1390
1391/** solving process initialization method of branching rule (called when branch and bound process is about to begin) */
1392static
1393SCIP_DECL_BRANCHINITSOL(branchInitsolRelpsprob)
1394{ /*lint --e{715}*/
1395 SCIP_BRANCHRULEDATA* branchruledata;
1396
1397 /* free branching rule data */
1398 branchruledata = SCIPbranchruleGetData(branchrule);
1399
1400 branchruledata->nprobingnodes = 0;
1401 branchruledata->nlpiterations = 0;
1402
1403 branchruledata->nprobings = 0;
1404 branchruledata->nbranchings = 0;
1405 branchruledata->ninfprobings = 0;
1406 branchruledata->nresolvesminbdchgs = 0;
1407 branchruledata->nresolvesinfcands = 0;
1408
1409 branchruledata->varhashmap = NULL;
1410 branchruledata->nvarbranchings = NULL;
1411 branchruledata->nvarprobings = NULL;
1412 branchruledata->nvars = 0;
1413 branchruledata->maxvars = 0;
1414
1415 return SCIP_OKAY;
1416}
1417
1418/** solving process deinitialization method of branching rule (called before branch and bound process data is freed) */
1419static
1420SCIP_DECL_BRANCHEXITSOL(branchExitsolRelpsprob)
1421{ /*lint --e{715}*/
1422 SCIP_BRANCHRULEDATA* branchruledata;
1423
1424 /* free branching rule data */
1425 branchruledata = SCIPbranchruleGetData(branchrule);
1426
1427 SCIPdebugMessage("**in total: nprobings = %d; part of it are ninfprobings = %d\n",
1428 branchruledata->nprobings, branchruledata->ninfprobings );
1429
1430 SCIPdebugMessage("**nbranchings = %d, nresolvesinfcands = %d, nresolvesminbdchgs = %d\n",
1431 branchruledata->nbranchings, branchruledata->nresolvesinfcands, branchruledata->nresolvesminbdchgs );
1432
1433
1434 /* free arrays for variables & hashmap */
1435 SCIPfreeBlockMemoryArrayNull(scip, &branchruledata->nvarprobings, branchruledata->maxvars);
1436 SCIPfreeBlockMemoryArrayNull(scip, &branchruledata->nvarbranchings, branchruledata->maxvars);
1437 branchruledata->nvars = 0;
1438
1439 if( branchruledata->varhashmap != NULL )
1440 {
1441 SCIPhashmapFree(&(branchruledata->varhashmap));
1442 }
1443
1444 return SCIP_OKAY;
1445}
1446
1447
1448/*
1449 * branching specific interface methods
1450 */
1451
1452/** creates the reliable pseudo cost braching rule and includes it in SCIP */
1454 GCG* gcg /**< GCG data structure */
1455 )
1456{
1457 SCIP* origprob;
1458 SCIP* masterprob;
1459 SCIP_BRANCHRULE* branchrule;
1460 SCIP_BRANCHRULEDATA* branchruledata;
1461
1462 /* get original and master problem */
1463 origprob = GCGgetOrigprob(gcg);
1464 assert(origprob != NULL);
1465 masterprob = GCGgetMasterprob(gcg);
1466 assert(masterprob != NULL);
1467
1468 /* create relpsprob branching rule data */
1469 SCIP_CALL( SCIPallocMemory(masterprob, &branchruledata) );
1470
1471 /* include branching rule */
1473 BRANCHRULE_MAXDEPTH, BRANCHRULE_MAXBOUNDDIST, branchruledata) );
1474 assert(branchrule != NULL);
1475
1476 /* set non fundamental callbacks via setter functions */
1477 SCIP_CALL( SCIPsetBranchruleFree(masterprob, branchrule, branchFreeRelpsprob) );
1478 SCIP_CALL( SCIPsetBranchruleInitsol(masterprob, branchrule, branchInitsolRelpsprob) );
1479 SCIP_CALL( SCIPsetBranchruleExitsol(masterprob, branchrule, branchExitsolRelpsprob) );
1480
1481 /* relpsprob branching rule parameters */
1482 SCIP_CALL( SCIPaddRealParam(origprob,
1483 "branching/relpsprob/conflictweight",
1484 "weight in score calculations for conflict score",
1486 SCIP_CALL( SCIPaddRealParam(origprob,
1487 "branching/relpsprob/conflictlengthweight",
1488 "weight in score calculations for conflict length score",
1490 SCIP_CALL( SCIPaddRealParam(origprob,
1491 "branching/relpsprob/inferenceweight",
1492 "weight in score calculations for inference score",
1494 SCIP_CALL( SCIPaddRealParam(origprob,
1495 "branching/relpsprob/cutoffweight",
1496 "weight in score calculations for cutoff score",
1498 SCIP_CALL( SCIPaddRealParam(origprob,
1499 "branching/relpsprob/pscostweight",
1500 "weight in score calculations for pseudo cost score",
1502 SCIP_CALL( SCIPaddRealParam(origprob,
1503 "branching/relpsprob/minreliable",
1504 "minimal value for minimum pseudo cost size to regard pseudo cost value as reliable",
1505 &branchruledata->minreliable, TRUE, DEFAULT_MINRELIABLE, 0.0, SCIP_REAL_MAX, NULL, NULL) );
1506 SCIP_CALL( SCIPaddRealParam(origprob,
1507 "branching/relpsprob/maxreliable",
1508 "maximal value for minimum pseudo cost size to regard pseudo cost value as reliable",
1509 &branchruledata->maxreliable, TRUE, DEFAULT_MAXRELIABLE, 0.0, SCIP_REAL_MAX, NULL, NULL) );
1510 SCIP_CALL( SCIPaddRealParam(origprob,
1511 "branching/relpsprob/iterquot",
1512 "maximal fraction of branching LP iterations compared to node relaxation LP iterations",
1513 &branchruledata->iterquot, FALSE, DEFAULT_ITERQUOT, 0.0, SCIP_REAL_MAX, NULL, NULL) );
1514 SCIP_CALL( SCIPaddIntParam(origprob,
1515 "branching/relpsprob/iterofs",
1516 "additional number of allowed LP iterations",
1517 &branchruledata->iterofs, FALSE, DEFAULT_ITEROFS, 0, INT_MAX, NULL, NULL) );
1518 SCIP_CALL( SCIPaddIntParam(origprob,
1519 "branching/relpsprob/maxlookahead",
1520 "maximal number of further variables evaluated without better score",
1521 &branchruledata->maxlookahead, TRUE, DEFAULT_MAXLOOKAHEAD, 1, INT_MAX, NULL, NULL) );
1522 SCIP_CALL( SCIPaddIntParam(origprob,
1523 "branching/relpsprob/initcand",
1524 "maximal number of candidates initialized with strong branching per node",
1525 &branchruledata->initcand, FALSE, DEFAULT_INITCAND, 0, INT_MAX, NULL, NULL) );
1526 SCIP_CALL( SCIPaddIntParam(origprob,
1527 "branching/relpsprob/maxbdchgs",
1528 "maximal number of bound tightenings before the node is immediately reevaluated (-1: unlimited)",
1529 &branchruledata->maxbdchgs, TRUE, DEFAULT_MAXBDCHGS, -1, INT_MAX, NULL, NULL) );
1530 SCIP_CALL( SCIPaddIntParam(origprob,
1531 "branching/relpsprob/minbdchgs",
1532 "minimal number of bound tightenings before bound changes are applied",
1533 &branchruledata->minbdchgs, TRUE, DEFAULT_MINBDCHGS, 1, INT_MAX, NULL, NULL) );
1534 SCIP_CALL( SCIPaddBoolParam(origprob,
1535 "branching/relpsprob/uselp",
1536 "shall the LP be solved during probing? (TRUE)",
1537 &branchruledata->uselp, FALSE, DEFAULT_USELP, NULL, NULL) );
1538 SCIP_CALL( SCIPaddRealParam(origprob,
1539 "branching/relpsprob/reliability",
1540 "reliability value for probing",
1541 &branchruledata->reliability, FALSE, DEFAULT_RELIABILITY, 0.0, 1.0, NULL, NULL) );
1542
1543 return SCIP_OKAY;
1544}
1545
1546/** execution reliability pseudo cost probing branching with the given branching candidates */
1548 GCG* gcg, /**< SCIP data structure */
1549 SCIP_VAR** branchcands, /**< brancing candidates */
1550 SCIP_Real* branchcandssol, /**< solution value for the branching candidates */
1551 int nbranchcands, /**< number of branching candidates */
1552 int nvars, /**< number of variables to be watched by bdchgdata */
1553 SCIP_RESULT* result, /**< pointer to the result of the execution */
1554 SCIP_VAR** branchvar /**< pointer to the variable to branch on */
1555 )
1556{
1557 SCIP_BRANCHRULE* branchrule;
1558 SCIP* masterprob;
1559
1560 assert(gcg != NULL);
1561 assert(result != NULL);
1562
1563 masterprob = GCGgetMasterprob(gcg);
1564 assert(masterprob != NULL);
1565
1566 /* find branching rule */
1567 branchrule = SCIPfindBranchrule(masterprob, BRANCHRULE_NAME);
1568 assert(branchrule != NULL);
1569
1570 /* execute branching rule */
1571 SCIP_CALL( execRelpsprob(gcg, branchrule, branchcands, branchcandssol, nbranchcands, nvars, result, branchvar) );
1572
1573 return SCIP_OKAY;
1574}
#define BRANCHRULE_DESC
static SCIP_RETCODE applyProbing(GCG *gcg, SCIP_VAR **vars, int nvars, SCIP_VAR *probingvar, SCIP_Bool probingdir, SCIP_Bool solvelp, SCIP_Longint *nlpiterations, SCIP_Real *proplbs, SCIP_Real *propubs, SCIP_Real *lpobjvalue, SCIP_Bool *lpsolved, SCIP_Bool *lperror, SCIP_Bool *cutoff)
static SCIP_RETCODE incNVarProbings(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_VAR *var)
static SCIP_Real calcScore(SCIP *scip, SCIP_BRANCHRULEDATA *branchruledata, SCIP_Real conflictscore, SCIP_Real avgconflictscore, SCIP_Real conflengthscore, SCIP_Real avgconflengthscore, SCIP_Real inferencescore, SCIP_Real avginferencescore, SCIP_Real cutoffscore, SCIP_Real avgcutoffscore, SCIP_Real pscostscore, SCIP_Real avgpscostscore, SCIP_Real frac)
#define BRANCHRULE_PRIORITY
#define DEFAULT_RELIABILITY
#define DEFAULT_USELP
#define DEFAULT_ITERQUOT
static SCIP_RETCODE calculateBounds(SCIP *scip, SCIP_VAR *branchvar, SCIP_Real *downlb, SCIP_Real *downub, SCIP_Real *uplb, SCIP_Real *upub)
SCIP_RETCODE GCGgetRelpsprobBranchVar(GCG *gcg, SCIP_VAR **branchcands, SCIP_Real *branchcandssol, int nbranchcands, int nvars, SCIP_RESULT *result, SCIP_VAR **branchvar)
static SCIP_RETCODE addBdchg(SCIP *scip, BDCHGDATA *bdchgdata, SCIP_VAR *var, SCIP_Real newbound, SCIP_BOUNDTYPE boundtype, SCIP_Bool infrounding, int *nbdchgs, SCIP_Bool *infeasible)
SCIP_RETCODE GCGincludeBranchruleRelpsprob(GCG *gcg)
#define DEFAULT_MAXBDCHGS
#define DEFAULT_INFERENCEWEIGHT
#define BRANCHRULE_NAME
#define DEFAULT_MAXLOOKAHEAD
static SCIP_DECL_BRANCHINITSOL(branchInitsolRelpsprob)
#define DEFAULT_CONFLICTWEIGHT
static SCIP_RETCODE incNVarBranchings(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_VAR *var)
#define DEFAULT_CUTOFFWEIGHT
static SCIP_RETCODE freeBdchgData(SCIP *scip, BDCHGDATA *bdchgdata)
static SCIP_RETCODE getVarProbingbranch(GCG *gcg, SCIP_VAR *probingvar, BDCHGDATA *bdchgdata, SCIP_Bool solvelp, SCIP_Longint *nlpiterations, SCIP_Real *down, SCIP_Real *up, SCIP_Bool *downvalid, SCIP_Bool *upvalid, SCIP_Bool *downinf, SCIP_Bool *upinf, SCIP_Bool *lperror, int *nbdchgs)
static SCIP_RETCODE addBranchcandsToData(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_VAR **branchcands, int nbranchcands)
static SCIP_RETCODE createBdchgData(SCIP *scip, BDCHGDATA **bdchgdata, SCIP_VAR **vars, int nvars)
#define DEFAULT_ITEROFS
#define DEFAULT_CONFLENGTHWEIGHT
#define DEFAULT_MINRELIABLE
static SCIP_DECL_BRANCHEXITSOL(branchExitsolRelpsprob)
#define DEFAULT_MINBDCHGS
#define HASHSIZE_VARS
static SCIP_DECL_BRANCHFREE(branchFreeRelpsprob)
#define DEFAULT_INITCAND
#define BRANCHRULE_MAXDEPTH
#define DEFAULT_MAXRELIABLE
#define DEFAULT_PSCOSTWEIGHT
static SCIP_RETCODE execRelpsprob(GCG *gcg, SCIP_BRANCHRULE *branchrule, SCIP_VAR **branchcands, SCIP_Real *branchcandssol, int nbranchcands, int nvars, SCIP_RESULT *result, SCIP_VAR **branchvar)
#define BRANCHRULE_MAXBOUNDDIST
static SCIP_RETCODE applyBdchgs(SCIP *scip, BDCHGDATA *bdchgdata, SCIP_NODE *node)
reliable pseudo costs branching rule
constraint handler for the integrality constraint
#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 SCIP_REAL_MIN
#define SCIP_CALL(x)
#define TRUE
#define FALSE
GCG interface methods.
SCIP * GCGgetOrigprob(GCG *gcg)
Definition: gcg.cpp:87
SCIP * GCGgetMasterprob(GCG *gcg)
Definition: gcg.cpp:99
SCIP_Bool SCIPisStopped(SCIP *scip)
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
SCIP_Real SCIPgetLocalLowerbound(SCIP *scip)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, 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)
SCIP_BRANCHRULE * SCIPfindBranchrule(SCIP *scip, const char *name)
SCIP_RETCODE SCIPincludeBranchruleBasic(SCIP *scip, SCIP_BRANCHRULE **branchruleptr, const char *name, const char *desc, int priority, int maxdepth, SCIP_Real maxbounddist, SCIP_BRANCHRULEDATA *branchruledata)
SCIP_BRANCHRULEDATA * SCIPbranchruleGetData(SCIP_BRANCHRULE *branchrule)
SCIP_RETCODE SCIPsetBranchruleFree(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHFREE((*branchfree)))
SCIP_RETCODE SCIPsetBranchruleExitsol(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXITSOL((*branchexitsol)))
void SCIPbranchruleSetData(SCIP_BRANCHRULE *branchrule, SCIP_BRANCHRULEDATA *branchruledata)
SCIP_RETCODE SCIPsetBranchruleInitsol(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHINITSOL((*branchinitsol)))
SCIP_Real SCIPgetBranchScore(SCIP *scip, SCIP_VAR *var, SCIP_Real downgain, SCIP_Real upgain)
SCIP_Bool SCIPisLPSolBasic(SCIP *scip)
#define SCIPfreeBuffer(scip, ptr)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPreallocBufferArray(scip, ptr, num)
#define SCIPallocMemory(scip, ptr)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPduplicateBufferArray(scip, ptr, source, num)
#define SCIPfreeMemory(scip, ptr)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPallocBuffer(scip, ptr)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
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_Real SCIPgetAvgInferenceScore(SCIP *scip)
SCIP_Real SCIPgetAvgConflictlengthScore(SCIP *scip)
SCIP_Longint SCIPgetNNodes(SCIP *scip)
SCIP_Real SCIPgetAvgConflictScore(SCIP *scip)
SCIP_Real SCIPgetAvgPseudocostScore(SCIP *scip)
SCIP_Real SCIPgetCutoffbound(SCIP *scip)
SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
SCIP_Real SCIPgetAvgCutoffScore(SCIP *scip)
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
SCIP_Bool SCIPisUbBetter(SCIP *scip, SCIP_Real newub, SCIP_Real oldlb, SCIP_Real oldub)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisLbBetter(SCIP *scip, SCIP_Real newlb, SCIP_Real oldlb, SCIP_Real oldub)
SCIP_Real SCIPfeasCeil(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
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 SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfeastol(SCIP *scip)
SCIP_Bool SCIPisSumGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisSumGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
SCIP_Real SCIPgetVarPseudocostCountCurrentRun(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR dir)
SCIP_Real SCIPgetVarAvgInferenceScore(SCIP *scip, SCIP_VAR *var)
int SCIPvarGetNImpls(SCIP_VAR *var, SCIP_Bool varfixing)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
int SCIPvarGetNLocksDown(SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarUbNode(SCIP *scip, SCIP_NODE *node, SCIP_VAR *var, SCIP_Real newbound)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_Real SCIPgetVarConflictlengthScore(SCIP *scip, SCIP_VAR *var)
SCIP_Real SCIPgetVarSol(SCIP *scip, SCIP_VAR *var)
int SCIPvarGetNCliques(SCIP_VAR *var, SCIP_Bool varfixing)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_RETCODE SCIPupdateVarPseudocost(SCIP *scip, SCIP_VAR *var, SCIP_Real solvaldelta, SCIP_Real objdelta, SCIP_Real weight)
SCIP_Real SCIPgetVarConflictScore(SCIP *scip, SCIP_VAR *var)
SCIP_Real SCIPgetVarAvgCutoffScore(SCIP *scip, SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarLbNode(SCIP *scip, SCIP_NODE *node, SCIP_VAR *var, SCIP_Real newbound)
int SCIPvarGetNLocksUp(SCIP_VAR *var)
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
SCIP_Real SCIPgetVarPseudocostScore(SCIP *scip, SCIP_VAR *var, SCIP_Real solval)
#define NULL
GCG variable pricer.
#define SCIPdebugMessage
SCIP_RETCODE GCGrelaxNewProbingnodeMaster(GCG *gcg)
Definition: relax_gcg.c:4508
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
GCG relaxator.
SCIP_HASHMAP * varhashmap
SCIP_Real * lbchgs
SCIP_Real * ubchgs
SCIP_Bool * infroundings
Definition: struct_gcg.h:55
SCIP_Longint nlpiterations
SCIP_HASHMAP * varhashmap
SCIP_BRANCHDIR_DOWNWARDS
SCIP_BRANCHDIR_UPWARDS
SCIP_BOUNDTYPE_UPPER
SCIP_BOUNDTYPE_LOWER
enum SCIP_BoundType SCIP_BOUNDTYPE
SCIP_VERBLEVEL_HIGH
SCIP_DIDNOTRUN
SCIP_CUTOFF
SCIP_REDUCEDDOM
SCIP_CONSADDED
enum SCIP_Result SCIP_RESULT
SCIP_OKAY
enum SCIP_Retcode SCIP_RETCODE
SCIP_VARTYPE_INTEGER
SCIP_VARTYPE_BINARY