Scippy

SCIP

Solving Constraint Integer Programs

branch_inference.c
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file branch_inference.c
26 * @ingroup DEFPLUGINS_BRANCH
27 * @brief inference history branching rule
28 * @author Tobias Achterberg
29 * @author Timo Berthold
30 * @author Stefan Heinz
31 */
32
33/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34
36#include "scip/pub_branch.h"
37#include "scip/pub_history.h"
38#include "scip/pub_message.h"
39#include "scip/pub_var.h"
40#include "scip/scip_branch.h"
41#include "scip/scip_message.h"
42#include "scip/scip_mem.h"
43#include "scip/scip_numerics.h"
44#include "scip/scip_param.h"
45#include "scip/scip_var.h"
46#include <string.h>
47
48
49/**@name Branching rule properties
50 *
51 * @{
52 */
53
54#define BRANCHRULE_NAME "inference"
55#define BRANCHRULE_DESC "inference history branching"
56#define BRANCHRULE_PRIORITY 1000
57#define BRANCHRULE_MAXDEPTH -1
58#define BRANCHRULE_MAXBOUNDDIST 1.0
59
60/**@} */
61
62/**@name Default parameter values
63 *
64 * @{
65 */
66
67#define DEFAULT_CONFLICTWEIGHT 1000.0 /**< weight in score calculations for conflict score */
68#define DEFAULT_CUTOFFWEIGHT 1.0 /**< weight in score calculations for cutoff score */
69#define DEFAULT_INFERENCEWEIGHT 1.0 /**< weight in score calculations for inference score */
70#define DEFAULT_RELIABLESCORE 0.001 /**< score which is seen to be reliable for a branching decision */
71#define DEFAULT_FRACTIONALS TRUE /**< should branching on LP solution be restricted to the fractional variables? */
72#define DEFAULT_USEWEIGHTEDSUM TRUE /**< should a weighted sum of inference, conflict and cutoff weights be used? */
73
74#define DEFAULT_CONFLICTPRIO 1 /**< priority value for using conflict weights in lex. order */
75#define DEFAULT_CUTOFFPRIO 1 /**< priority value for using cutoff weights in lex. order */
76
77/**@} */
78
79/** branching rule data */
80struct SCIP_BranchruleData
81{
82 SCIP_Real conflictweight; /**< weight in score calculations for conflict score */
83 SCIP_Real cutoffweight; /**< weight in score calculations for cutoff score */
84 SCIP_Real inferenceweight; /**< weight in score calculations for inference score */
85 SCIP_Real reliablescore; /**< score which is seen to be reliable for a branching decision */
86 SCIP_Bool fractionals; /**< should branching on LP solution be restricted to the fractional variables? */
87 SCIP_Bool useweightedsum; /**< should a weighted sum of inference, conflict and cutoff weights be used? */
88 int conflictprio; /**< priority value for using conflict weights in lexicographic order */
89 int cutoffprio; /**< priority value for using cutoff weights in lexicographic order */
90};
91
92/** evaluate the given candidate with the given score against the currently best know candidate, tiebreaking included */
93static
95 SCIP_VAR* cand, /**< candidate to be checked */
96 SCIP_Real score, /**< score of the candidate */
97 SCIP_Real branchpoint, /**< potential branching point */
98 SCIP_BRANCHDIR branchdir, /**< potential branching direction */
99 SCIP_VAR** bestcand, /**< pointer to the currently best candidate */
100 SCIP_Real* bestscore, /**< pointer to the score of the currently best candidate */
101 SCIP_Real* bestbranchpoint, /**< pointer to store the (best) branching point */
102 SCIP_BRANCHDIR* bestbranchdir /**< pointer to store the branching direction relative to the branching point */
103 )
104{
105 /* evaluate the candidate against the currently best candidate */
106 if( *bestscore < score )
107 {
108 /* the score of the candidate is better than the currently best know candidate */
109 *bestscore = score;
110 *bestcand = cand;
111 *bestbranchpoint = branchpoint;
112 *bestbranchdir = branchdir;
113 }
114 else if( (*bestscore) == score ) /*lint !e777*/
115 {
116 SCIP_Real bestobj;
117 SCIP_Real candobj;
118
119 bestobj = REALABS(SCIPvarGetObj(*bestcand));
120 candobj = REALABS(SCIPvarGetObj(cand));
121
122 /* the candidate has the same score as the best known candidate; therefore we use a second and third
123 * criteria to detect a unique best candidate;
124 *
125 * - the second criteria prefers the candidate with a larger absolute value of its objective coefficient
126 * since branching on that variable might trigger further propagation w.r.t. objective function
127 * - if the absolute values of the objective coefficient are equal the variable index is used to define a
128 * unique best candidate
129 *
130 * @note It is very important to select a unique best candidate. Otherwise the solver might vary w.r.t. the
131 * performance to much since the candidate array which is used here (SCIPgetPseudoBranchCands() or
132 * SCIPgetLPBranchCands()) gets dynamically changed during the solution process. In particular,
133 * starting a probing mode might already change the order of these arrays. To be independent of that
134 * the selection should be unique. Otherwise, to selection process can get influenced by starting a
135 * probing or not.
136 */
137 if( bestobj < candobj || (bestobj == candobj && SCIPvarGetIndex(*bestcand) < SCIPvarGetIndex(cand)) ) /*lint !e777*/
138 {
139 *bestcand = cand;
140 *bestbranchpoint = branchpoint;
141 *bestbranchdir = branchdir;
142 }
143 }
144}
145
146/** evaluate the given candidate with the given score against the currently best know candidate */
147static
149 SCIP* scip, /**< SCIP data structure */
150 SCIP_VAR* cand, /**< candidate to be checked */
151 SCIP_Real score, /**< score of the candidate */
152 SCIP_Real val, /**< solution value of the candidate */
153 SCIP_VAR** bestcand, /**< pointer to the currently best candidate */
154 SCIP_Real* bestscore, /**< pointer to the score of the currently best candidate */
155 SCIP_Real* bestval, /**< pointer to the solution value of the currently best candidate */
156 SCIP_VAR** bestcands, /**< buffer array to return selected candidates */
157 int* nbestcands /**< pointer to return number of selected candidates */
158 )
159{
160 /* evaluate the candidate against the currently best candidate */
161 /* TODO: consider a weaker comparison of some kind */
162 if( *bestscore < score )
163 {
164 /* the score of the candidate is better than the currently best know candidate, so it should be the first candidate in bestcands and nbestcands should be set to 1*/
165 *bestscore = score;
166 *bestcand = cand;
167 *bestval = val;
168 *nbestcands = 1;
169 bestcands[0] = cand;
170 }
171 /* TODO: consider a weaker comparison of some kind */
172 else if( SCIPisEQ(scip, *bestscore, score) )
173 {
174 /* the score of the candidate is comparable to the currently known best, so we add it to bestcands and increase nbestcands by 1*/
175 bestcands[*nbestcands] = cand;
176 (*nbestcands)++;
177 }
178}
179
180/** choose a singular best candidate from bestcands and move it to the beginning of the candidate array */
181static
183 SCIP_VAR** bestcands, /**< buffer array to return selected candidates */
184 int nbestcands /**< number of selected candidates */
185 )
186{
187 int c;
188
189 for( c = 0; c < nbestcands; ++c )
190 {
191 SCIP_Real bestobj;
192 SCIP_Real candobj;
193
194 bestobj = REALABS(SCIPvarGetObj(bestcands[0]));
195 candobj = REALABS(SCIPvarGetObj(bestcands[c]));
196
197 /* the candidate has the same score as the best known candidate; therefore we use a second and third
198 * criteria to detect a unique best candidate;
199 *
200 * - the second criteria prefers the candidate with a larger absolute value of its objective coefficient
201 * since branching on that variable might trigger further propagation w.r.t. objective function
202 * - if the absolute values of the objective coefficient are equal the variable index is used to define a
203 * unique best candidate
204 *
205 * @note It is very important to select a unique best candidate. Otherwise the solver might vary w.r.t. the
206 * performance too much since the candidate array which is used here (SCIPgetPseudoBranchCands() or
207 * SCIPgetLPBranchCands()) gets dynamically changed during the solution process. In particular,
208 * starting a probing mode might already change the order of these arrays. To be independent of that
209 * the selection should be unique. Otherwise, to selection process can get influenced by starting a
210 * probing or not.
211 */
212 if( bestobj < candobj || (bestobj == candobj && SCIPvarGetIndex(bestcands[0]) < SCIPvarGetIndex(bestcands[c])) ) /*lint !e777*/
213 {
214 bestcands[0] = bestcands[c];
215 }
216 }
217}
218
219/** check if the score for the given domain value and variable domain value is better than the current best know one */
220static
222 SCIP_Real value, /**< domain value */
223 SCIP_HISTORY* history, /**< variable history for given donain value */
224 SCIP_BRANCHDIR dir, /**< branching direction */
225 SCIP_Real conflictweight, /**< weight in score calculations for conflict score */
226 SCIP_Real cutoffweight, /**< weight in score calculations for cutoff score */
227 SCIP_Real reliablescore, /**< score which is seen to be reliable for a branching decision */
228 SCIP_Real* bestscore, /**< pointer to store the best score */
229 SCIP_Real* branchpoint, /**< pointer to store the (best) branching point */
230 SCIP_BRANCHDIR* branchdir /**< pointer to store the branching direction relative to the branching point */
231 )
232{
233 SCIP_Real conflictscore;
234 SCIP_Real cutoffscore;
235 SCIP_Real score;
236
237 conflictscore = SCIPhistoryGetVSIDS(history, dir);
238 cutoffscore = SCIPhistoryGetCutoffSum(history, dir);
239
240 /* in case the conflict score is below the reliable score we set it to zero since it is seen to be
241 * unreliable
242 */
243 if( conflictscore < reliablescore )
244 conflictscore = 0.0;
245
246 /* in case the cutoff score is below the reliable score we set it to zero since it is seen to be unreliable */
247 if( cutoffscore < reliablescore )
248 cutoffscore = 0.0;
249
250 /* compute weight score */
251 score = conflictweight * conflictscore + cutoffweight * cutoffscore;
252
253 if( score > *bestscore )
254 {
255 (*bestscore) = score;
256 (*branchpoint) = value;
257 (*branchdir) = dir;
258 }
259}
260
261/** return an aggregated score for the given variable using the conflict score and cutoff score */
262static
264 SCIP* scip, /**< SCIP data structure */
265 SCIP_VAR* var, /**< problem variable */
266 SCIP_Real conflictweight, /**< weight in score calculations for conflict score */
267 SCIP_Real inferenceweight, /**< weight in score calculations for inference score */
268 SCIP_Real cutoffweight, /**< weight in score calculations for cutoff score */
269 SCIP_Real reliablescore /**< score which is seen to be reliable for a branching decision */
270 )
271{
272 SCIP_Real conflictscore;
273 SCIP_Real cutoffscore;
274
275 conflictscore = SCIPgetVarConflictScore(scip, var);
276 cutoffscore = SCIPgetVarAvgInferenceCutoffScore(scip, var, cutoffweight);
277
278 /* in case the conflict score is below the reliable score we set it to zero since it is seen to be
279 * unreliable
280 */
281 if( conflictscore < reliablescore )
282 conflictscore = 0.0;
283
284 /* in case the cutoff score is below the reliable score we set it to zero since it is seen to be unreliable */
285 if( cutoffscore < reliablescore )
286 cutoffscore = 0.0;
287
288 /* compute weighted score for the candidate */
289 return (conflictweight * conflictscore + inferenceweight * cutoffscore);
290}
291
292/** return an aggregated score for the given variable using the conflict score and cutoff score */
293static
295 SCIP_VAR* var, /**< problem variable */
296 SCIP_Real conflictweight, /**< weight in score calculations for conflict score */
297 SCIP_Real cutoffweight, /**< weight in score calculations for cutoff score */
298 SCIP_Real reliablescore, /**< score which is seen to be reliable for a branching decision */
299 SCIP_Real* branchpoint, /**< pointer to store the branching point */
300 SCIP_BRANCHDIR* branchdir /**< pointer to store the branching direction relative to the branching point */
301 )
302{
303 SCIP_VALUEHISTORY* valuehistory;
304 SCIP_Real bestscore;
305
306 (*branchpoint) = SCIP_UNKNOWN;
307 (*branchdir) = SCIP_BRANCHDIR_UPWARDS;
308
309 valuehistory = SCIPvarGetValuehistory(var);
310 bestscore = 0.0;
311
312 if( valuehistory != NULL )
313 {
314 SCIP_HISTORY** histories;
315 SCIP_Real* values;
316 int nvalues;
317 int v;
318
319 histories = SCIPvaluehistoryGetHistories(valuehistory);
320 values = SCIPvaluehistoryGetValues(valuehistory);
321 nvalues = SCIPvaluehistoryGetNValues(valuehistory);
322
323 for( v = 0; v < nvalues; ++v )
324 {
325 SCIP_Real value;
326
327 value = values[v];
328
329 /* skip all domain values which are smaller or equal to the lower bound */
330 if( value <= SCIPvarGetLbLocal(var) )
331 continue;
332
333 /* skip all domain values which are larger or equal to the upper bound */
334 if( value >= SCIPvarGetUbLocal(var) )
335 break;
336
337 /* check var <= value */
338 checkValueScore(value, histories[v], SCIP_BRANCHDIR_DOWNWARDS, conflictweight, cutoffweight, reliablescore, &bestscore, branchpoint, branchdir);
339
340 /* check var >= value */
341 checkValueScore(value, histories[v], SCIP_BRANCHDIR_UPWARDS, conflictweight, cutoffweight, reliablescore, &bestscore, branchpoint, branchdir);
342 }
343 }
344
345 return bestscore;
346}
347
348static
350 SCIP* scip, /**< SCIP data structure */
351 SCIP_VAR** cands, /**< candidate array */
352 SCIP_Real* candsols, /**< array of candidate solution values, or NULL */
353 int ncands, /**< number of candidates */
354 SCIP_Real conflictweight, /**< weight in score calculations for conflict score */
355 SCIP_Real inferenceweight, /**< weight in score calculations for inference score */
356 SCIP_Real cutoffweight, /**< weight in score calculations for cutoff score */
357 SCIP_Real reliablescore, /**< score which is seen to be reliable for a branching decision */
358 SCIP_VAR** bestcands, /**< buffer array to return selected candidates */
359 int* nbestcands /**< pointer to return number of selected candidates */
360 )
361{
362 SCIP_VAR* bestaggrcand;
363 SCIP_Real bestval;
364 SCIP_Real bestaggrscore;
365 int c;
366
367 bestaggrcand = cands[0];
368 assert(cands[0] != NULL);
369
370 bestval = candsols[0];
371 bestcands[0] = cands[0];
372 *nbestcands = 1;
373
374 /* get aggregated score for the first candidate */
375 bestaggrscore = getAggrScore(scip, cands[0], conflictweight, inferenceweight, cutoffweight, reliablescore);
376
377 for( c = 1; c < ncands; ++c )
378 {
379 SCIP_VAR* cand;
380 SCIP_Real val;
381 SCIP_Real aggrscore;
382
383 cand = cands[c];
384 assert(cand != NULL);
385
386 val = candsols[c];
387
388 /* get score for the candidate */
389 aggrscore = getAggrScore(scip, cand, conflictweight, inferenceweight, cutoffweight, reliablescore);
390
391 /*lint -e777*/
392 SCIPdebugMsg(scip, " -> cand <%s>: prio=%d, solval=%g, score=%g\n", SCIPvarGetName(cand), SCIPvarGetBranchPriority(cand),
393 val == SCIP_UNKNOWN ? SCIPgetVarSol(scip, cand) : val, aggrscore);
394
395 /* evaluate the candidate against the currently best candidate w.r.t. aggregated score */
396 evaluateAggrCand(scip, cand, aggrscore, val, &bestaggrcand, &bestaggrscore, &bestval, bestcands, nbestcands);
397 }
398} /*lint --e{438}*/
399
400
401/** selects a variable out of the given candidate array and performs the branching */
402static
404 SCIP* scip, /**< SCIP data structure */
405 SCIP_VAR** cands, /**< candidate array */
406 SCIP_Real* candsols, /**< array of candidate solution values, or NULL */
407 int ncands, /**< number of candidates */
408 SCIP_Real conflictweight, /**< weight in score calculations for conflict score */
409 SCIP_Real inferenceweight, /**< weight in score calculations for inference score */
410 SCIP_Real cutoffweight, /**< weight in score calculations for cutoff score */
411 SCIP_Real reliablescore, /**< score which is seen to be reliable for a branching decision */
412 SCIP_Bool useweightedsum, /**< should a weighted sum of inference, conflict and cutoff weights be used? */
413 SCIP_RESULT* result, /**< buffer to store result (branched, reduced domain, ...) */
414 int conflictprio, /**< priority value for using conflict weights in lex. order */
415 int cutoffprio /**< priority value for using conflict weights in lex. order */
416 )
417{
418 SCIP_VAR* bestaggrcand;
419 SCIP_Real bestval;
420 SCIP_NODE* downchild;
421 SCIP_NODE* eqchild;
422 SCIP_NODE* upchild;
423 SCIP_VAR** bestcands;
424 int nbestcands;
425 int c;
426
427 assert(ncands > 0);
428 assert(result != NULL);
429
430 *result = SCIP_DIDNOTFIND;
431
432 /* check if conflict score, inferences, and cutoff score should be used in combination; otherwise just use
433 * inference */
434 if( useweightedsum == FALSE )
435 {
436 conflictprio = 0;
437 cutoffprio = 0;
438 conflictweight = 0.0;
439 inferenceweight = 1.0;
440 cutoffweight = 0.0;
441 }
442
443 /* allocate temporary memory */
444 SCIP_CALL( SCIPallocClearBufferArray(scip, &bestcands, ncands) );
445 nbestcands = 0;
446
447 if( conflictprio > cutoffprio )
448 {
449 /* select the best candidates w.r.t. the first criterion */
450 selectBestCands(scip, cands, candsols, ncands, conflictweight, 0.0, 0.0, reliablescore,
451 bestcands, &nbestcands);
452
453 /* select the best candidates w.r.t. the second criterion; we use bestcands and nbestcands as input and
454 * output, so the method must make sure to overwrite the last argument only at the very end */
455 if( nbestcands > 1 )
456 {
457 selectBestCands(scip, bestcands, candsols, nbestcands, 0.0, inferenceweight, cutoffweight, reliablescore,
458 bestcands, &nbestcands);
459 }
460 }
461 else if( conflictprio == cutoffprio )
462 {
463 /* select the best candidates w.r.t. weighted sum of both criteria */
464 selectBestCands(scip, cands, candsols, ncands, conflictweight, inferenceweight, cutoffweight, reliablescore,
465 bestcands, &nbestcands);
466 }
467 else
468 {
469 assert(conflictprio < cutoffprio);
470
471 /* select the best candidates w.r.t. the first criterion */
472 selectBestCands(scip, cands, candsols, ncands, 0.0, inferenceweight, cutoffweight, reliablescore,
473 bestcands, &nbestcands);
474
475 /* select the best candidates w.r.t. the second criterion; we use bestcands and nbestcands as input and
476 * output, so the method must make sure to overwrite the last argument only at the very end */
477 if( nbestcands > 1 )
478 {
479 /* select the best candidates w.r.t. the first criterion */
480 selectBestCands(scip, bestcands, candsols, nbestcands, conflictweight, 0.0, 0.0, reliablescore,
481 bestcands, &nbestcands);
482 }
483 }
484
485 assert(nbestcands == 0 || bestcands[0] != NULL);
486
487 /* final tie breaking */
488 if( nbestcands > 1 )
489 {
490 tiebreakAggrCand(bestcands, nbestcands);
491 nbestcands = 1;
492 }
493
494 assert(nbestcands == 1);
495
496 bestaggrcand = bestcands[0];
497 bestval = -SCIP_INVALID;
498
499 /* loop over cands, find bestcands[0], and store corresponding candsols value in bestval */
500 for( c = 0; c < ncands; ++c )
501 {
502 if( bestaggrcand == cands[c] )
503 {
504 bestval = candsols[c];
505 break;
506 }
507 }
508
509 assert(bestval != -SCIP_INVALID);
510
511 /* free temporary memory */
512 SCIPfreeBufferArray(scip, &bestcands);
513
514 assert(bestaggrcand != NULL);
515
516 SCIPdebugMsg(scip, " -> %d candidates, selected variable <%s>[%g,%g] (prio=%d, solval=%.12f, conflict=%g cutoff=%g, inference=%g)\n",
517 ncands, SCIPvarGetName(bestaggrcand), SCIPvarGetLbLocal (bestaggrcand), SCIPvarGetUbLocal(bestaggrcand), SCIPvarGetBranchPriority(bestaggrcand),
518 bestval == SCIP_UNKNOWN ? SCIPgetVarSol(scip, bestaggrcand) : bestval, /*lint !e777*/
519 SCIPgetVarConflictScore(scip, bestaggrcand), SCIPgetVarAvgInferenceCutoffScore(scip, bestaggrcand, cutoffweight),
520 SCIPgetVarAvgInferenceScore(scip, bestaggrcand));
521
522 assert(candsols != NULL);
523 /* perform the branching */
524 SCIP_CALL( SCIPbranchVarVal(scip, bestaggrcand, SCIPgetBranchingPoint(scip, bestaggrcand, bestval), &downchild, &eqchild, &upchild) );
525
526 if( downchild != NULL || eqchild != NULL || upchild != NULL )
527 {
528 *result = SCIP_BRANCHED;
529 }
530 else
531 {
532 /* if there are no children, then variable should have been fixed by SCIPbranchVar(Val) */
533 assert(SCIPisEQ(scip, SCIPvarGetLbLocal(bestaggrcand), SCIPvarGetUbLocal(bestaggrcand)));
534 *result = SCIP_REDUCEDDOM;
535 }
536
537 return SCIP_OKAY;
538}
539
540
541/** selects a variable out of the given candidate array and performs the branching */
542static
544 SCIP* scip, /**< SCIP data structure */
545 SCIP_VAR** cands, /**< candidate array */
546 int ncands, /**< number of candidates */
547 SCIP_Real conflictweight, /**< weight in score calculations for conflict score */
548 SCIP_Real inferenceweight, /**< weight in score calculations for inference score */
549 SCIP_Real cutoffweight, /**< weight in score calculations for cutoff score */
550 SCIP_Real reliablescore, /**< score which is seen to be reliable for a branching decision */
551 SCIP_Bool useweightedsum, /**< should a weighted sum of inference, conflict and cutoff weights be used? */
552 SCIP_RESULT* result /**< buffer to store result (branched, reduced domain, ...) */
553 )
554{
555 SCIP_VAR* bestaggrcand;
556 SCIP_VAR* bestvaluecand;
557 SCIP_Real bestval;
558 SCIP_Real bestaggrscore;
559 SCIP_Real bestvaluescore;
560 SCIP_Real bestbranchpoint;
561 SCIP_BRANCHDIR bestbranchdir;
562 SCIP_NODE* downchild;
563 SCIP_NODE* eqchild;
564 SCIP_NODE* upchild;
565 SCIP_VAR** bestcands;
566 int nbestcands;
567
568 bestbranchpoint = SCIP_UNKNOWN;
569 bestbranchdir = SCIP_BRANCHDIR_DOWNWARDS;
570 bestvaluecand = NULL;
571
572 assert(ncands > 0);
573 assert(result != NULL);
574
575 *result = SCIP_DIDNOTFIND;
576
577 /* allocate temporary memory */
578 SCIP_CALL( SCIPallocBufferArray(scip, &bestcands, ncands) );
579 nbestcands = 0;
580
581 /* check if the weighted sum between the average inferences and conflict score should be used */
582 if( useweightedsum )
583 {
584 int c;
585
586 bestaggrcand = cands[0];
587 bestvaluecand = cands[0];
588 assert(cands[0] != NULL);
589
590 bestval = SCIP_UNKNOWN;
591
592 /* get domain value score for the first candidate */
593 bestvaluescore = getValueScore(cands[0], conflictweight, cutoffweight, reliablescore, &bestbranchpoint, &bestbranchdir);
594 SCIPdebugMsg(scip, "current best value candidate <%s>[%g,%g] %s <%g> (value %g)\n",
595 SCIPvarGetName(bestvaluecand), SCIPvarGetLbLocal(bestvaluecand), SCIPvarGetUbLocal(bestvaluecand),
596 bestbranchdir == SCIP_BRANCHDIR_DOWNWARDS ? "<=" : ">=", bestbranchpoint, bestvaluescore);
597
598 /* get aggregated score for the first candidate */
599 bestaggrscore = getAggrScore(scip, cands[0], conflictweight, inferenceweight, cutoffweight, reliablescore);
600
601 for( c = 1; c < ncands; ++c )
602 {
603 SCIP_VAR* cand;
604 SCIP_Real val;
605 SCIP_Real aggrscore;
606 SCIP_Real branchpoint;
607 SCIP_BRANCHDIR branchdir;
608 SCIP_Real valuescore;
609
610 cand = cands[c];
611 assert(cand != NULL);
612
613 val = SCIP_UNKNOWN;
614
615 /* get domain value score for the candidate */
616 valuescore = getValueScore(cand, conflictweight, cutoffweight, reliablescore, &branchpoint, &branchdir);
617
618 /* evaluate the candidate against the currently best candidate w.r.t. domain value score */
619 evaluateValueCand(cand, valuescore, branchpoint, branchdir, &bestvaluecand, &bestvaluescore, &bestbranchpoint, &bestbranchdir);
620
621 SCIPdebugMsg(scip, "current best value candidate <%s>[%g,%g] %s <%g> (value %g)\n",
622 SCIPvarGetName(bestvaluecand), SCIPvarGetLbLocal(bestvaluecand), SCIPvarGetUbLocal(bestvaluecand),
623 bestbranchdir == SCIP_BRANCHDIR_DOWNWARDS ? "<=" : ">=", bestbranchpoint, bestvaluescore);
624
625 /* get aggregated score for the candidate */
626 aggrscore = getAggrScore(scip, cand, conflictweight, inferenceweight, cutoffweight, reliablescore);
627
628 /*lint -e777*/
629 SCIPdebugMsg(scip, " -> cand <%s>: prio=%d, solval=%g, score=%g\n", SCIPvarGetName(cand), SCIPvarGetBranchPriority(cand),
630 val == SCIP_UNKNOWN ? SCIPgetVarSol(scip, cand) : val, aggrscore);
631
632 /* evaluate the candidate against the currently best candidate w.r.t. aggregated score */
633 evaluateAggrCand(scip, cand, aggrscore, val, &bestaggrcand, &bestaggrscore, &bestval, bestcands, &nbestcands);
634 }
635 }
636 else
637 {
638 int c;
639
640 bestaggrcand = cands[0];
641 assert(cands[0] != NULL);
642
643 bestval = SCIP_UNKNOWN;
644
645 bestaggrscore = SCIPgetVarAvgInferenceScore(scip, cands[0]);
646
647 /* search for variable with best score w.r.t. average inferences per branching */
648 for( c = 1; c < ncands; ++c )
649 {
650 SCIP_VAR* cand;
651 SCIP_Real val;
652 SCIP_Real aggrscore;
653
654 cand = cands[c];
655 assert(cand != NULL);
656
657 val = SCIP_UNKNOWN;
658
659 aggrscore = SCIPgetVarAvgInferenceScore(scip, cand);
660
661 /* in case the average inferences score is below the reliable score we set it to zero since it is seen to be
662 * unreliable
663 */
664 if( aggrscore < reliablescore )
665 aggrscore = 0.0;
666
667 SCIPdebugMsg(scip, " -> cand <%s>: prio=%d, solval=%g, score=%g\n", SCIPvarGetName(cand), SCIPvarGetBranchPriority(cand),
668 val == SCIP_UNKNOWN ? SCIPgetVarSol(scip, cand) : val, aggrscore); /*lint !e777*/
669
670 /* evaluate the candidate against the currently best candidate */
671 evaluateAggrCand(scip, cand, aggrscore, val, &bestaggrcand, &bestaggrscore, &bestval, bestcands, &nbestcands);
672 }
673 }
674
675 /* free temporary memory */
676 SCIPfreeBufferArray(scip, &bestcands);
677
678 assert(bestaggrcand != NULL);
679
680 SCIPdebugMsg(scip, " -> %d candidates, selected variable <%s>[%g,%g] (prio=%d, solval=%.12f, score=%g, conflict=%g cutoff=%g, inference=%g)\n",
681 ncands, SCIPvarGetName(bestaggrcand), SCIPvarGetLbLocal (bestaggrcand), SCIPvarGetUbLocal(bestaggrcand), SCIPvarGetBranchPriority(bestaggrcand),
682 bestval == SCIP_UNKNOWN ? SCIPgetVarSol(scip, bestaggrcand) : bestval, bestaggrscore, /*lint !e777*/
683 SCIPgetVarConflictScore(scip, bestaggrcand), SCIPgetVarAvgInferenceCutoffScore(scip, bestaggrcand, cutoffweight),
684 SCIPgetVarAvgInferenceScore(scip, bestaggrcand));
685
686 if( bestbranchpoint == SCIP_UNKNOWN ) /*lint !e777*/
687 {
688 SCIP_CALL( SCIPbranchVar(scip, bestaggrcand, &downchild, &eqchild, &upchild) );
689 }
690 else
691 {
692 /* perform the branching */
693 SCIP_Real estimate;
694 SCIP_Real downprio;
695 SCIP_Real upprio;
696 SCIP_Real downub;
697 SCIP_Real uplb;
698
699 assert(bestvaluecand != NULL);
700
701 downprio = 0.0;
702 upprio = 0.0;
703
704 if( bestbranchdir == SCIP_BRANCHDIR_DOWNWARDS )
705 {
706 downprio = 1.0;
707 downub = bestbranchpoint;
708 uplb = bestbranchpoint + 1.0;
709 }
710 else
711 {
712 upprio = 1.0;
713 downub = bestbranchpoint - 1.0;
714 uplb = bestbranchpoint;
715 }
716
717 /* calculate the child estimate */
718 estimate = SCIPcalcChildEstimate(scip, bestvaluecand, downub);
719
720 /* create down child */
721 SCIP_CALL( SCIPcreateChild(scip, &downchild, downprio, estimate) );
722
723 /* change upper bound in down child */
724 SCIP_CALL( SCIPchgVarUbNode(scip, downchild, bestvaluecand, downub) );
725
726 /* calculate the child estimate */
727 estimate = SCIPcalcChildEstimate(scip, bestvaluecand, uplb);
728
729 /* create up child */
730 SCIP_CALL( SCIPcreateChild(scip, &upchild, upprio, estimate) );
731
732 /* change lower bound in up child */
733 SCIP_CALL( SCIPchgVarLbNode(scip, upchild, bestvaluecand, uplb) );
734
735 SCIPdebugMsg(scip, "branch on variable <%s> and value <%g>\n", SCIPvarGetName(bestvaluecand), bestbranchpoint);
736
737 eqchild = NULL;
738 }
739 if( downchild != NULL || eqchild != NULL || upchild != NULL )
740 {
741 *result = SCIP_BRANCHED;
742 }
743 else
744 {
745 /* if there are no children, then variable should have been fixed by SCIPbranchVar(Val) */
746 assert(SCIPisEQ(scip, SCIPvarGetLbLocal(bestaggrcand), SCIPvarGetUbLocal(bestaggrcand)));
747 *result = SCIP_REDUCEDDOM;
748 }
749
750 return SCIP_OKAY;
751}
752
753/*
754 * Callback methods
755 */
756
757/** copy method for branchrule plugins (called when SCIP copies plugins) */
758static
759SCIP_DECL_BRANCHCOPY(branchCopyInference)
760{ /*lint --e{715}*/
761 assert(scip != NULL);
762 assert(branchrule != NULL);
763 assert(strcmp(SCIPbranchruleGetName(branchrule), BRANCHRULE_NAME) == 0);
764
765 /* call inclusion method of branchrule */
767
768 return SCIP_OKAY;
769}
770
771/** destructor of branching rule to free user data (called when SCIP is exiting) */
772static
773SCIP_DECL_BRANCHFREE(branchFreeInference)
774{ /*lint --e{715}*/
775 SCIP_BRANCHRULEDATA* branchruledata;
776
777 /* free branching rule data */
778 branchruledata = SCIPbranchruleGetData(branchrule);
779 SCIPfreeBlockMemory(scip, &branchruledata);
780 SCIPbranchruleSetData(branchrule, NULL);
781
782 return SCIP_OKAY;
783}
784
785/** branching execution method for fractional LP solutions */
786static
787SCIP_DECL_BRANCHEXECLP(branchExeclpInference)
788{ /*lint --e{715}*/
789 SCIP_BRANCHRULEDATA* branchruledata;
790 SCIP_VAR** cands;
791 int ncands;
792
793 SCIPdebugMsg(scip, "Execlp method of inference branching\n");
794
795 /* get branching rule data */
796 branchruledata = SCIPbranchruleGetData(branchrule);
797 assert(branchruledata != NULL);
798
799 if( branchruledata->fractionals )
800 {
801 /* get LP candidates (fractional integer variables) */
802 SCIP_CALL( SCIPgetLPBranchCands(scip, &cands, NULL, NULL, NULL, &ncands, NULL) );
803 }
804 else
805 {
806 /* get pseudo candidates (non-fixed integer variables) */
807 SCIP_CALL( SCIPgetPseudoBranchCands(scip, &cands, NULL, &ncands) );
808 }
809
810 /* perform the branching */
811 SCIP_CALL( performBranchingNoSol(scip, cands, ncands, branchruledata->conflictweight,
812 branchruledata->inferenceweight, branchruledata->cutoffweight, branchruledata->reliablescore,
813 branchruledata->useweightedsum, result) );
814
815 return SCIP_OKAY;
816}
817
818
819/** branching execution method for external candidates */
820static
821SCIP_DECL_BRANCHEXECEXT(branchExecextInference)
822{ /*lint --e{715}*/
823 SCIP_BRANCHRULEDATA* branchruledata;
824 SCIP_VAR** cands;
825 SCIP_Real* candsols;
826 int ncands;
827
828 SCIPdebugMsg(scip, "Execext method of inference branching\n");
829
830 /* get branching rule data */
831 branchruledata = SCIPbranchruleGetData(branchrule);
832 assert(branchruledata != NULL);
833
834 /* get branching candidates */
835 SCIP_CALL( SCIPgetExternBranchCands(scip, &cands, &candsols, NULL, &ncands, NULL, NULL, NULL, NULL) );
836 assert(ncands > 0);
837
838 /* perform the branching */
839 SCIP_CALL( performBranchingSol(scip, cands, candsols, ncands, branchruledata->conflictweight,
840 branchruledata->inferenceweight, branchruledata->cutoffweight, branchruledata->reliablescore,
841 branchruledata->useweightedsum, result, branchruledata->conflictprio, branchruledata->cutoffprio) );
842
843 return SCIP_OKAY;
844}
845
846/** branching execution method for not completely fixed pseudo solutions */
847static
848SCIP_DECL_BRANCHEXECPS(branchExecpsInference)
849{ /*lint --e{715}*/
850 SCIP_BRANCHRULEDATA* branchruledata;
851 SCIP_VAR** cands;
852 int ncands;
853
854 SCIPdebugMsg(scip, "Execps method of inference branching\n");
855
856 /* get branching rule data */
857 branchruledata = SCIPbranchruleGetData(branchrule);
858 assert(branchruledata != NULL);
859
860 /* get pseudo candidates (non-fixed integer variables) */
861 SCIP_CALL( SCIPgetPseudoBranchCands(scip, &cands, NULL, &ncands) );
862
863 /* perform the branching */
864 SCIP_CALL( performBranchingNoSol(scip, cands, ncands, branchruledata->conflictweight,
865 branchruledata->inferenceweight, branchruledata->cutoffweight, branchruledata->reliablescore,
866 branchruledata->useweightedsum, result) );
867
868 return SCIP_OKAY;
869}
870
871
872/*
873 * branching specific interface methods
874 */
875
876/** creates the inference history branching rule and includes it in SCIP */
878 SCIP* scip /**< SCIP data structure */
879 )
880{
881 SCIP_BRANCHRULEDATA* branchruledata;
882 SCIP_BRANCHRULE* branchrule;
883
884 /* create inference branching rule data */
885 SCIP_CALL( SCIPallocBlockMemory(scip, &branchruledata) );
886
887 /* include branching rule */
890
891 assert(branchrule != NULL);
892
893 /* set non-fundamental callbacks via specific setter functions*/
894 SCIP_CALL( SCIPsetBranchruleCopy(scip, branchrule, branchCopyInference) );
895 SCIP_CALL( SCIPsetBranchruleFree(scip, branchrule, branchFreeInference) );
896 SCIP_CALL( SCIPsetBranchruleExecLp(scip, branchrule, branchExeclpInference) );
897 SCIP_CALL( SCIPsetBranchruleExecExt(scip, branchrule, branchExecextInference) );
898 SCIP_CALL( SCIPsetBranchruleExecPs(scip, branchrule, branchExecpsInference) );
899
900 /* inference branching rule parameters */
902 "branching/inference/conflictweight",
903 "weight in score calculations for conflict score",
904 &branchruledata->conflictweight, TRUE, DEFAULT_CONFLICTWEIGHT, 0.0, SCIP_REAL_MAX, NULL, NULL) );
906 "branching/inference/inferenceweight",
907 "weight in score calculations for inference score",
908 &branchruledata->inferenceweight, TRUE, DEFAULT_INFERENCEWEIGHT, SCIP_REAL_MIN, SCIP_REAL_MAX, NULL, NULL) );
910 "branching/inference/cutoffweight",
911 "weight in score calculations for cutoff score",
912 &branchruledata->cutoffweight, TRUE, DEFAULT_CUTOFFWEIGHT, 0.0, SCIP_REAL_MAX, NULL, NULL) );
914 "branching/inference/fractionals",
915 "should branching on LP solution be restricted to the fractional variables?",
916 &branchruledata->fractionals, TRUE, DEFAULT_FRACTIONALS, NULL, NULL) );
918 "branching/inference/useweightedsum",
919 "should a weighted sum of inference, conflict and cutoff weights be used?",
920 &branchruledata->useweightedsum, FALSE, DEFAULT_USEWEIGHTEDSUM, NULL, NULL) );
921 /* inference branching rule parameters */
923 "branching/inference/reliablescore",
924 "weight in score calculations for conflict score",
925 &branchruledata->reliablescore, TRUE, DEFAULT_RELIABLESCORE, 0.0, SCIP_REAL_MAX, NULL, NULL) );
926 /* parameters for lexicographical ordering */
928 "branching/inference/conflictprio",
929 "priority value for using conflict weights in lex. order",
930 &branchruledata->conflictprio, FALSE, DEFAULT_CONFLICTPRIO, 0, INT_MAX, NULL, NULL) );
932 "branching/inference/cutoffprio",
933 "priority value for using cutoff weights in lex. order",
934 &branchruledata->cutoffprio, FALSE, DEFAULT_CUTOFFPRIO, 0, INT_MAX, NULL, NULL) );
935
936 return SCIP_OKAY;
937}
#define BRANCHRULE_DESC
static void evaluateAggrCand(SCIP *scip, SCIP_VAR *cand, SCIP_Real score, SCIP_Real val, SCIP_VAR **bestcand, SCIP_Real *bestscore, SCIP_Real *bestval, SCIP_VAR **bestcands, int *nbestcands)
static SCIP_DECL_BRANCHCOPY(branchCopyInference)
static SCIP_DECL_BRANCHEXECPS(branchExecpsInference)
static void tiebreakAggrCand(SCIP_VAR **bestcands, int nbestcands)
static SCIP_RETCODE performBranchingSol(SCIP *scip, SCIP_VAR **cands, SCIP_Real *candsols, int ncands, SCIP_Real conflictweight, SCIP_Real inferenceweight, SCIP_Real cutoffweight, SCIP_Real reliablescore, SCIP_Bool useweightedsum, SCIP_RESULT *result, int conflictprio, int cutoffprio)
#define BRANCHRULE_PRIORITY
static void evaluateValueCand(SCIP_VAR *cand, SCIP_Real score, SCIP_Real branchpoint, SCIP_BRANCHDIR branchdir, SCIP_VAR **bestcand, SCIP_Real *bestscore, SCIP_Real *bestbranchpoint, SCIP_BRANCHDIR *bestbranchdir)
#define DEFAULT_CONFLICTPRIO
static void selectBestCands(SCIP *scip, SCIP_VAR **cands, SCIP_Real *candsols, int ncands, SCIP_Real conflictweight, SCIP_Real inferenceweight, SCIP_Real cutoffweight, SCIP_Real reliablescore, SCIP_VAR **bestcands, int *nbestcands)
#define DEFAULT_INFERENCEWEIGHT
#define BRANCHRULE_NAME
static SCIP_Real getAggrScore(SCIP *scip, SCIP_VAR *var, SCIP_Real conflictweight, SCIP_Real inferenceweight, SCIP_Real cutoffweight, SCIP_Real reliablescore)
#define DEFAULT_USEWEIGHTEDSUM
#define DEFAULT_CONFLICTWEIGHT
static void checkValueScore(SCIP_Real value, SCIP_HISTORY *history, SCIP_BRANCHDIR dir, SCIP_Real conflictweight, SCIP_Real cutoffweight, SCIP_Real reliablescore, SCIP_Real *bestscore, SCIP_Real *branchpoint, SCIP_BRANCHDIR *branchdir)
#define DEFAULT_FRACTIONALS
#define DEFAULT_CUTOFFWEIGHT
static SCIP_Real getValueScore(SCIP_VAR *var, SCIP_Real conflictweight, SCIP_Real cutoffweight, SCIP_Real reliablescore, SCIP_Real *branchpoint, SCIP_BRANCHDIR *branchdir)
static SCIP_DECL_BRANCHEXECLP(branchExeclpInference)
#define DEFAULT_RELIABLESCORE
static SCIP_DECL_BRANCHFREE(branchFreeInference)
static SCIP_RETCODE performBranchingNoSol(SCIP *scip, SCIP_VAR **cands, int ncands, SCIP_Real conflictweight, SCIP_Real inferenceweight, SCIP_Real cutoffweight, SCIP_Real reliablescore, SCIP_Bool useweightedsum, SCIP_RESULT *result)
static SCIP_DECL_BRANCHEXECEXT(branchExecextInference)
#define DEFAULT_CUTOFFPRIO
#define BRANCHRULE_MAXDEPTH
#define BRANCHRULE_MAXBOUNDDIST
inference history branching rule
#define NULL
Definition: def.h:262
#define SCIP_REAL_MAX
Definition: def.h:173
#define SCIP_INVALID
Definition: def.h:192
#define SCIP_Bool
Definition: def.h:91
#define SCIP_Real
Definition: def.h:172
#define SCIP_UNKNOWN
Definition: def.h:193
#define TRUE
Definition: def.h:93
#define FALSE
Definition: def.h:94
#define SCIP_REAL_MIN
Definition: def.h:174
#define REALABS(x)
Definition: def.h:196
#define SCIP_CALL(x)
Definition: def.h:369
SCIP_RETCODE SCIPincludeBranchruleInference(SCIP *scip)
#define SCIPdebugMsg
Definition: scip_message.h:78
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)
Definition: scip_param.c:83
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)
Definition: scip_param.c:139
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)
Definition: scip_param.c:57
SCIP_RETCODE SCIPsetBranchruleExecExt(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECEXT((*branchexecext)))
Definition: scip_branch.c:272
SCIP_RETCODE SCIPsetBranchruleExecLp(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECLP((*branchexeclp)))
Definition: scip_branch.c:256
SCIP_RETCODE SCIPsetBranchruleCopy(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHCOPY((*branchcopy)))
Definition: scip_branch.c:160
SCIP_RETCODE SCIPincludeBranchruleBasic(SCIP *scip, SCIP_BRANCHRULE **branchruleptr, const char *name, const char *desc, int priority, int maxdepth, SCIP_Real maxbounddist, SCIP_BRANCHRULEDATA *branchruledata)
Definition: scip_branch.c:123
SCIP_RETCODE SCIPsetBranchruleExecPs(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECPS((*branchexecps)))
Definition: scip_branch.c:288
const char * SCIPbranchruleGetName(SCIP_BRANCHRULE *branchrule)
Definition: branch.c:1971
SCIP_BRANCHRULEDATA * SCIPbranchruleGetData(SCIP_BRANCHRULE *branchrule)
Definition: branch.c:1849
SCIP_RETCODE SCIPsetBranchruleFree(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHFREE((*branchfree)))
Definition: scip_branch.c:176
void SCIPbranchruleSetData(SCIP_BRANCHRULE *branchrule, SCIP_BRANCHRULEDATA *branchruledata)
Definition: branch.c:1859
SCIP_RETCODE SCIPgetExternBranchCands(SCIP *scip, SCIP_VAR ***externcands, SCIP_Real **externcandssol, SCIP_Real **externcandsscore, int *nexterncands, int *nprioexterncands, int *nprioexternbins, int *nprioexternints, int *nprioexternimpls)
Definition: scip_branch.c:518
SCIP_Real SCIPgetBranchingPoint(SCIP *scip, SCIP_VAR *var, SCIP_Real suggestion)
Definition: scip_branch.c:904
SCIP_Real SCIPcalcChildEstimate(SCIP *scip, SCIP_VAR *var, SCIP_Real targetvalue)
Definition: scip_branch.c:954
SCIP_RETCODE SCIPbranchVarVal(SCIP *scip, SCIP_VAR *var, SCIP_Real val, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
Definition: scip_branch.c:1133
SCIP_RETCODE SCIPgetLPBranchCands(SCIP *scip, SCIP_VAR ***lpcands, SCIP_Real **lpcandssol, SCIP_Real **lpcandsfrac, int *nlpcands, int *npriolpcands, int *nfracimplvars)
Definition: scip_branch.c:402
SCIP_RETCODE SCIPbranchVar(SCIP *scip, SCIP_VAR *var, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
Definition: scip_branch.c:1057
SCIP_RETCODE SCIPgetPseudoBranchCands(SCIP *scip, SCIP_VAR ***pseudocands, int *npseudocands, int *npriopseudocands)
Definition: scip_branch.c:740
SCIP_RETCODE SCIPcreateChild(SCIP *scip, SCIP_NODE **node, SCIP_Real nodeselprio, SCIP_Real estimate)
Definition: scip_branch.c:1024
#define SCIPallocClearBufferArray(scip, ptr, num)
Definition: scip_mem.h:126
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:124
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:136
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:108
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip_mem.h:89
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPgetVarAvgInferenceScore(SCIP *scip, SCIP_VAR *var)
Definition: scip_var.c:9566
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:18162
SCIP_RETCODE SCIPchgVarUbNode(SCIP *scip, SCIP_NODE *node, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip_var.c:5013
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:17944
int SCIPvarGetIndex(SCIP_VAR *var)
Definition: var.c:17776
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:17437
SCIP_Real SCIPgetVarSol(SCIP *scip, SCIP_VAR *var)
Definition: scip_var.c:2307
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:18152
int SCIPvarGetBranchPriority(SCIP_VAR *var)
Definition: var.c:18268
SCIP_Real SCIPgetVarConflictScore(SCIP *scip, SCIP_VAR *var)
Definition: scip_var.c:9334
SCIP_RETCODE SCIPchgVarLbNode(SCIP *scip, SCIP_NODE *node, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip_var.c:4969
SCIP_Real SCIPgetVarAvgInferenceCutoffScore(SCIP *scip, SCIP_VAR *var, SCIP_Real cutoffweight)
Definition: scip_var.c:9883
SCIP_VALUEHISTORY * SCIPvarGetValuehistory(SCIP_VAR *var)
Definition: var.c:18538
int SCIPvaluehistoryGetNValues(SCIP_VALUEHISTORY *valuehistory)
Definition: history.c:363
SCIP_HISTORY ** SCIPvaluehistoryGetHistories(SCIP_VALUEHISTORY *valuehistory)
Definition: history.c:373
SCIP_Real * SCIPvaluehistoryGetValues(SCIP_VALUEHISTORY *valuehistory)
Definition: history.c:383
SCIP_Real SCIPhistoryGetCutoffSum(SCIP_HISTORY *history, SCIP_BRANCHDIR dir)
Definition: history.c:678
SCIP_Real SCIPhistoryGetVSIDS(SCIP_HISTORY *history, SCIP_BRANCHDIR dir)
Definition: history.c:536
public methods for branching rules
public methods for branching and inference history structure
public methods for message output
public methods for problem variables
public methods for branching rule plugins and branching
public methods for memory management
public methods for message handling
public methods for numerical tolerances
public methods for SCIP parameter handling
public methods for SCIP variables
struct SCIP_BranchruleData SCIP_BRANCHRULEDATA
Definition: type_branch.h:57
@ SCIP_BRANCHDIR_DOWNWARDS
Definition: type_history.h:43
@ SCIP_BRANCHDIR_UPWARDS
Definition: type_history.h:44
enum SCIP_BranchDir SCIP_BRANCHDIR
Definition: type_history.h:48
@ SCIP_REDUCEDDOM
Definition: type_result.h:51
@ SCIP_DIDNOTFIND
Definition: type_result.h:44
@ SCIP_BRANCHED
Definition: type_result.h:54
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:61
@ SCIP_OKAY
Definition: type_retcode.h:42
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63