Scippy

SCIP

Solving Constraint Integer Programs

scip_branch.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-2018 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file scip_branch.c
17  * @brief public methods for branching rule plugins and branching
18  * @author Tobias Achterberg
19  * @author Timo Berthold
20  * @author Gerald Gamrath
21  * @author Robert Lion Gottwald
22  * @author Stefan Heinz
23  * @author Gregor Hendel
24  * @author Thorsten Koch
25  * @author Alexander Martin
26  * @author Marc Pfetsch
27  * @author Michael Winkler
28  * @author Kati Wolter
29  *
30  * @todo check all SCIP_STAGE_* switches, and include the new stages TRANSFORMED and INITSOLVE
31  */
32 
33 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34 
35 #include "scip/branch.h"
36 #include "scip/debug.h"
37 #include "scip/lp.h"
38 #include "scip/pub_message.h"
39 #include "scip/pub_var.h"
40 #include "scip/scip_branch.h"
41 #include "scip/scip_numerics.h"
42 #include "scip/set.h"
43 #include "scip/struct_mem.h"
44 #include "scip/struct_primal.h"
45 #include "scip/struct_scip.h"
46 #include "scip/struct_set.h"
47 #include "scip/struct_var.h"
48 #include "scip/tree.h"
49 
50 
51 /** creates a branching rule and includes it in SCIP
52  *
53  * @note method has all branching rule callbacks as arguments and is thus changed every time a new
54  * callback is added in future releases; consider using SCIPincludeBranchruleBasic() and setter functions
55  * if you seek for a method which is less likely to change in future releases
56  */
58  SCIP* scip, /**< SCIP data structure */
59  const char* name, /**< name of branching rule */
60  const char* desc, /**< description of branching rule */
61  int priority, /**< priority of the branching rule */
62  int maxdepth, /**< maximal depth level, up to which this branching rule should be used (or -1) */
63  SCIP_Real maxbounddist, /**< maximal relative distance from current node's dual bound to primal bound
64  * compared to best node's dual bound for applying branching rule
65  * (0.0: only on current best node, 1.0: on all nodes) */
66  SCIP_DECL_BRANCHCOPY ((*branchcopy)), /**< copy method of branching rule or NULL if you don't want to copy your plugin into sub-SCIPs */
67  SCIP_DECL_BRANCHFREE ((*branchfree)), /**< destructor of branching rule */
68  SCIP_DECL_BRANCHINIT ((*branchinit)), /**< initialize branching rule */
69  SCIP_DECL_BRANCHEXIT ((*branchexit)), /**< deinitialize branching rule */
70  SCIP_DECL_BRANCHINITSOL((*branchinitsol)),/**< solving process initialization method of branching rule */
71  SCIP_DECL_BRANCHEXITSOL((*branchexitsol)),/**< solving process deinitialization method of branching rule */
72  SCIP_DECL_BRANCHEXECLP((*branchexeclp)), /**< branching execution method for fractional LP solutions */
73  SCIP_DECL_BRANCHEXECEXT((*branchexecext)),/**< branching execution method for external candidates */
74  SCIP_DECL_BRANCHEXECPS((*branchexecps)), /**< branching execution method for not completely fixed pseudo solutions */
75  SCIP_BRANCHRULEDATA* branchruledata /**< branching rule data */
76  )
77 {
78  SCIP_BRANCHRULE* branchrule;
79 
80  SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeBranchrule", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
81 
82  /* check whether branching rule is already present */
83  if( SCIPfindBranchrule(scip, name) != NULL )
84  {
85  SCIPerrorMessage("branching rule <%s> already included.\n", name);
86  return SCIP_INVALIDDATA;
87  }
88 
89  SCIP_CALL( SCIPbranchruleCreate(&branchrule, scip->set, scip->messagehdlr, scip->mem->setmem,
90  name, desc, priority, maxdepth,
91  maxbounddist, branchcopy, branchfree, branchinit, branchexit, branchinitsol, branchexitsol,
92  branchexeclp, branchexecext, branchexecps, branchruledata) );
93  SCIP_CALL( SCIPsetIncludeBranchrule(scip->set, branchrule) );
94 
95  return SCIP_OKAY;
96 }
97 
98 /** creates a branching rule and includes it in SCIP. All non-fundamental (or optional) callbacks will be set to NULL.
99  * Optional callbacks can be set via specific setter functions, see SCIPsetBranchruleInit(), SCIPsetBranchruleExit(),
100  * SCIPsetBranchruleCopy(), SCIPsetBranchruleFree(), SCIPsetBranchruleInitsol(), SCIPsetBranchruleExitsol(),
101  * SCIPsetBranchruleExecLp(), SCIPsetBranchruleExecExt(), and SCIPsetBranchruleExecPs().
102  *
103  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeBranchrule() instead
104  */
106  SCIP* scip, /**< SCIP data structure */
107  SCIP_BRANCHRULE** branchruleptr, /**< pointer to branching rule, or NULL */
108  const char* name, /**< name of branching rule */
109  const char* desc, /**< description of branching rule */
110  int priority, /**< priority of the branching rule */
111  int maxdepth, /**< maximal depth level, up to which this branching rule should be used (or -1) */
112  SCIP_Real maxbounddist, /**< maximal relative distance from current node's dual bound to primal bound
113  * compared to best node's dual bound for applying branching rule
114  * (0.0: only on current best node, 1.0: on all nodes) */
115  SCIP_BRANCHRULEDATA* branchruledata /**< branching rule data */
116  )
117 {
118  SCIP_BRANCHRULE* branchrule;
119 
120  SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeBranchruleBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
121 
122  /* check whether branching rule is already present */
123  if( SCIPfindBranchrule(scip, name) != NULL )
124  {
125  SCIPerrorMessage("branching rule <%s> already included.\n", name);
126  return SCIP_INVALIDDATA;
127  }
128 
129  SCIP_CALL( SCIPbranchruleCreate(&branchrule, scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, priority, maxdepth,
130  maxbounddist, NULL, NULL, NULL, NULL, NULL, NULL,
131  NULL, NULL, NULL, branchruledata) );
132 
133  SCIP_CALL( SCIPsetIncludeBranchrule(scip->set, branchrule) );
134 
135  if( branchruleptr != NULL )
136  *branchruleptr = branchrule;
137 
138  return SCIP_OKAY;
139 }
140 
141 /** sets copy method of branching rule */
143  SCIP* scip, /**< SCIP data structure */
144  SCIP_BRANCHRULE* branchrule, /**< branching rule */
145  SCIP_DECL_BRANCHCOPY ((*branchcopy)) /**< copy method of branching rule or NULL if you don't want to copy your plugin into sub-SCIPs */
146  )
147 {
148  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBranchruleCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
149 
150  assert(branchrule != NULL);
151 
152  SCIPbranchruleSetCopy(branchrule, branchcopy);
153 
154  return SCIP_OKAY;
155 }
156 
157 /** sets destructor method of branching rule */
159  SCIP* scip, /**< SCIP data structure */
160  SCIP_BRANCHRULE* branchrule, /**< branching rule */
161  SCIP_DECL_BRANCHFREE ((*branchfree)) /**< destructor of branching rule */
162  )
163 {
164  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBranchruleFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
165 
166  assert(branchrule != NULL);
167 
168  SCIPbranchruleSetFree(branchrule, branchfree);
169 
170  return SCIP_OKAY;
171 }
172 
173 /** sets initialization method of branching rule */
175  SCIP* scip, /**< SCIP data structure */
176  SCIP_BRANCHRULE* branchrule, /**< branching rule */
177  SCIP_DECL_BRANCHINIT ((*branchinit)) /**< initialize branching rule */
178  )
179 {
180  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBranchruleInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
181 
182  assert(branchrule != NULL);
183 
184  SCIPbranchruleSetInit(branchrule, branchinit);
185 
186  return SCIP_OKAY;
187 }
188 
189 /** sets deinitialization method of branching rule */
191  SCIP* scip, /**< SCIP data structure */
192  SCIP_BRANCHRULE* branchrule, /**< branching rule */
193  SCIP_DECL_BRANCHEXIT ((*branchexit)) /**< deinitialize branching rule */
194  )
195 {
196  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBranchruleExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
197 
198  assert(branchrule != NULL);
199 
200  SCIPbranchruleSetExit(branchrule, branchexit);
201 
202  return SCIP_OKAY;
203 }
204 
205 /** sets solving process initialization method of branching rule */
207  SCIP* scip, /**< SCIP data structure */
208  SCIP_BRANCHRULE* branchrule, /**< branching rule */
209  SCIP_DECL_BRANCHINITSOL((*branchinitsol)) /**< solving process initialization method of branching rule */
210  )
211 {
212  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBranchruleInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
213 
214  assert(branchrule != NULL);
215 
216  SCIPbranchruleSetInitsol(branchrule, branchinitsol);
217 
218  return SCIP_OKAY;
219 }
220 
221 /** sets solving process deinitialization method of branching rule */
223  SCIP* scip, /**< SCIP data structure */
224  SCIP_BRANCHRULE* branchrule, /**< branching rule */
225  SCIP_DECL_BRANCHEXITSOL((*branchexitsol)) /**< solving process deinitialization method of branching rule */
226  )
227 {
228  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBranchruleExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
229 
230  assert(branchrule != NULL);
231 
232  SCIPbranchruleSetExitsol(branchrule, branchexitsol);
233 
234  return SCIP_OKAY;
235 }
236 
237 /** sets branching execution method for fractional LP solutions */
239  SCIP* scip, /**< SCIP data structure */
240  SCIP_BRANCHRULE* branchrule, /**< branching rule */
241  SCIP_DECL_BRANCHEXECLP((*branchexeclp)) /**< branching execution method for fractional LP solutions */
242  )
243 {
244  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBranchruleExecLp", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
245 
246  assert(branchrule != NULL);
247 
248  SCIPbranchruleSetExecLp(branchrule, branchexeclp);
249 
250  return SCIP_OKAY;
251 }
252 
253 /** sets branching execution method for external candidates */
255  SCIP* scip, /**< SCIP data structure */
256  SCIP_BRANCHRULE* branchrule, /**< branching rule */
257  SCIP_DECL_BRANCHEXECEXT((*branchexecext)) /**< branching execution method for external candidates */
258  )
259 {
260  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBranchruleExecExt", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
261 
262  assert(branchrule != NULL);
263 
264  SCIPbranchruleSetExecExt(branchrule, branchexecext);
265 
266  return SCIP_OKAY;
267 }
268 
269 /** sets branching execution method for not completely fixed pseudo solutions */
271  SCIP* scip, /**< SCIP data structure */
272  SCIP_BRANCHRULE* branchrule, /**< branching rule */
273  SCIP_DECL_BRANCHEXECPS((*branchexecps)) /**< branching execution method for not completely fixed pseudo solutions */
274  )
275 {
276  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBranchruleExecPs", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
277 
278  assert(branchrule != NULL);
279 
280  SCIPbranchruleSetExecPs(branchrule, branchexecps);
281 
282  return SCIP_OKAY;
283 }
284 
285 /** returns the branching rule of the given name, or NULL if not existing */
287  SCIP* scip, /**< SCIP data structure */
288  const char* name /**< name of branching rule */
289  )
290 {
291  assert(scip != NULL);
292  assert(scip->set != NULL);
293  assert(name != NULL);
294 
296 
297  return SCIPsetFindBranchrule(scip->set, name);
298 }
299 
300 /** returns the array of currently available branching rules */
302  SCIP* scip /**< SCIP data structure */
303  )
304 {
305  assert(scip != NULL);
306  assert(scip->set != NULL);
307 
308  return scip->set->branchrules;
309 }
310 
311 /** returns the number of currently available branching rules */
313  SCIP* scip /**< SCIP data structure */
314  )
315 {
316  assert(scip != NULL);
317  assert(scip->set != NULL);
318 
319  return scip->set->nbranchrules;
320 }
321 
322 /** sets the priority of a branching rule */
324  SCIP* scip, /**< SCIP data structure */
325  SCIP_BRANCHRULE* branchrule, /**< branching rule */
326  int priority /**< new priority of the branching rule */
327  )
328 {
329  assert(scip != NULL);
330  assert(scip->set != NULL);
331 
332  SCIPbranchruleSetPriority(branchrule, scip->set, priority);
333 
334  return SCIP_OKAY;
335 }
336 
337 /** sets maximal depth level, up to which this branching rule should be used (-1 for no limit) */
339  SCIP* scip, /**< SCIP data structure */
340  SCIP_BRANCHRULE* branchrule, /**< branching rule */
341  int maxdepth /**< new maxdepth of the branching rule */
342  )
343 {
344  assert(scip != NULL);
345  assert(scip->set != NULL);
346 
347  SCIPbranchruleSetMaxdepth(branchrule, maxdepth);
348 
349  return SCIP_OKAY;
350 }
351 
352 /** sets maximal relative distance from current node's dual bound to primal bound for applying branching rule */
354  SCIP* scip, /**< SCIP data structure */
355  SCIP_BRANCHRULE* branchrule, /**< branching rule */
356  SCIP_Real maxbounddist /**< new maxbounddist of the branching rule */
357  )
358 {
359  assert(scip != NULL);
360  assert(scip->set != NULL);
361 
362  SCIPbranchruleSetMaxbounddist(branchrule, maxbounddist);
363 
364  return SCIP_OKAY;
365 }
366 
367 /** gets branching candidates for LP solution branching (fractional variables) along with solution values,
368  * fractionalities, and number of branching candidates; The number of branching candidates does NOT
369  * account for fractional implicit integer variables which should not be used for branching decisions.
370  *
371  * Fractional implicit integer variables are stored at the positions *nlpcands to *nlpcands + *nfracimplvars - 1
372  *
373  * branching rules should always select the branching candidate among the first npriolpcands of the candidate
374  * list
375  *
376  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
377  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
378  *
379  * @pre This method can be called if @p scip is in one of the following stages:
380  * - \ref SCIP_STAGE_SOLVING
381  *
382  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
383  */
385  SCIP* scip, /**< SCIP data structure */
386  SCIP_VAR*** lpcands, /**< pointer to store the array of LP branching candidates, or NULL */
387  SCIP_Real** lpcandssol, /**< pointer to store the array of LP candidate solution values, or NULL */
388  SCIP_Real** lpcandsfrac, /**< pointer to store the array of LP candidate fractionalities, or NULL */
389  int* nlpcands, /**< pointer to store the number of LP branching candidates, or NULL */
390  int* npriolpcands, /**< pointer to store the number of candidates with maximal priority, or NULL */
391  int* nfracimplvars /**< pointer to store the number of fractional implicit integer variables, or NULL */
392  )
393 {
394  SCIP_CALL( SCIPcheckStage(scip, "SCIPgetLPBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
395 
397  {
398  SCIPerrorMessage("LP not solved to optimality - solstat=%d\n", SCIPlpGetSolstat(scip->lp));
399  return SCIP_INVALIDDATA;
400  }
401 
402  SCIP_CALL( SCIPbranchcandGetLPCands(scip->branchcand, scip->set, scip->stat, scip->lp,
403  lpcands, lpcandssol, lpcandsfrac, nlpcands, npriolpcands, nfracimplvars) );
404 
405  return SCIP_OKAY;
406 }
407 
408 /** gets number of branching candidates for LP solution branching (number of fractional variables)
409  *
410  * @return the number of branching candidates for LP solution branching (number of fractional variables).
411  *
412  * @pre This method can be called if @p scip is in one of the following stages:
413  * - \ref SCIP_STAGE_SOLVING
414  *
415  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
416  */
418  SCIP* scip /**< SCIP data structure */
419  )
420 {
421  SCIP_RETCODE retcode;
422  int nlpcands;
423 
424  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNLPBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
425 
427  {
428  SCIPerrorMessage("LP not solved to optimality\n");
429  SCIPABORT();
430  return 0; /*lint !e527*/
431  }
432 
433  retcode = SCIPbranchcandGetLPCands(scip->branchcand, scip->set, scip->stat, scip->lp,
434  NULL, NULL, NULL, &nlpcands, NULL, NULL);
435 
436  if( retcode != SCIP_OKAY )
437  {
438  SCIPerrorMessage("Error <%u> during computation of the number of LP branching candidates\n", retcode);
439  SCIPABORT();
440  return 0; /*lint !e527*/
441  }
442 
443  return nlpcands;
444 }
445 
446 /** gets number of branching candidates with maximal priority for LP solution branching
447  *
448  * @return the number of branching candidates with maximal priority for LP solution branching.
449  *
450  * @pre This method can be called if @p scip is in one of the following stages:
451  * - \ref SCIP_STAGE_SOLVING
452  *
453  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
454  */
456  SCIP* scip /**< SCIP data structure */
457  )
458 {
459  SCIP_RETCODE retcode;
460  int npriolpcands;
461 
462  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNPrioLPBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
463 
465  {
466  SCIPerrorMessage("LP not solved to optimality\n");
467  SCIPABORT();
468  return 0; /*lint !e527*/
469  }
470 
471  retcode = SCIPbranchcandGetLPCands(scip->branchcand, scip->set, scip->stat, scip->lp,
472  NULL, NULL, NULL, NULL, &npriolpcands, NULL);
473 
474  if( retcode != SCIP_OKAY )
475  {
476  SCIPerrorMessage("Error <%u> during computation of the number of LP branching candidates with maximal priority\n", retcode);
477  SCIPABORT();
478  return 0; /*lint !e527*/
479  }
480 
481  return npriolpcands;
482 }
483 
484 /** gets external branching candidates along with solution values, scores, and number of branching candidates;
485  * these branching candidates can be used by relaxations or nonlinear constraint handlers;
486  * branching rules should always select the branching candidate among the first nprioexterncands of the candidate
487  * list
488  *
489  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
490  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
491  *
492  * @pre This method can be called if @p scip is in one of the following stages:
493  * - \ref SCIP_STAGE_SOLVING
494  *
495  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
496  *
497  * @note Candidate variables with maximal priority are ordered: binaries first, then integers, implicit integers and
498  * continuous last.
499  */
501  SCIP* scip, /**< SCIP data structure */
502  SCIP_VAR*** externcands, /**< pointer to store the array of extern branching candidates, or NULL */
503  SCIP_Real** externcandssol, /**< pointer to store the array of extern candidate solution values, or NULL */
504  SCIP_Real** externcandsscore, /**< pointer to store the array of extern candidate scores, or NULL */
505  int* nexterncands, /**< pointer to store the number of extern branching candidates, or NULL */
506  int* nprioexterncands, /**< pointer to store the number of candidates with maximal priority, or NULL */
507  int* nprioexternbins, /**< pointer to store the number of binary candidates with maximal priority, or NULL */
508  int* nprioexternints, /**< pointer to store the number of integer candidates with maximal priority, or NULL */
509  int* nprioexternimpls /**< pointer to store the number of implicit integer candidates with maximal priority,
510  * or NULL */
511  )
512 {
513  assert(scip != NULL);
514 
515  SCIP_CALL( SCIPcheckStage(scip, "SCIPgetExternBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
516 
517  SCIP_CALL( SCIPbranchcandGetExternCands(scip->branchcand, externcands, externcandssol, externcandsscore, nexterncands,
518  nprioexterncands, nprioexternbins, nprioexternints, nprioexternimpls) );
519 
520  return SCIP_OKAY;
521 }
522 
523 /** gets number of external branching candidates
524  *
525  * @return the number of external branching candidates.
526  *
527  * @pre This method can be called if @p scip is in one of the following stages:
528  * - \ref SCIP_STAGE_SOLVING
529  *
530  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
531  */
533  SCIP* scip /**< SCIP data structure */
534  )
535 {
536  assert(scip != NULL);
537 
538  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNExternBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
539 
541 }
542 
543 /** gets number of external branching candidates with maximal branch priority
544  *
545  * @return the number of external branching candidates with maximal branch priority.
546  *
547  * @pre This method can be called if @p scip is in one of the following stages:
548  * - \ref SCIP_STAGE_SOLVING
549  *
550  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
551  */
553  SCIP* scip /**< SCIP data structure */
554  )
555 {
556  assert(scip != NULL);
557 
558  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNPrioExternBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
559 
561 }
562 
563 /** gets number of binary external branching candidates with maximal branch priority
564  *
565  * @return the number of binary external branching candidates with maximal branch priority.
566  *
567  * @pre This method can be called if @p scip is in one of the following stages:
568  * - \ref SCIP_STAGE_SOLVING
569  *
570  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
571  */
573  SCIP* scip /**< SCIP data structure */
574  )
575 {
576  assert(scip != NULL);
577 
578  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNPrioExternBranchBins", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
579 
581 }
582 
583 /** gets number of integer external branching candidates with maximal branch priority
584  *
585  * @return the number of integer external branching candidates with maximal branch priority.
586  *
587  * @pre This method can be called if @p scip is in one of the following stages:
588  * - \ref SCIP_STAGE_SOLVING
589  *
590  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
591  */
593  SCIP* scip /**< SCIP data structure */
594  )
595 {
596  assert(scip != NULL);
597 
598  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNPrioExternBranchInts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
599 
601 }
602 
603 /** gets number of implicit integer external branching candidates with maximal branch priority
604  *
605  * @return the number of implicit integer external branching candidates with maximal branch priority.
606  *
607  * @pre This method can be called if @p scip is in one of the following stages:
608  * - \ref SCIP_STAGE_SOLVING
609  *
610  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
611  */
613  SCIP* scip /**< SCIP data structure */
614  )
615 {
616  assert(scip != NULL);
617 
618  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNPrioExternBranchImpls", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
619 
621 }
622 
623 /** gets number of continuous external branching candidates with maximal branch priority
624  *
625  * @return the number of continuous external branching candidates with maximal branch priority.
626  *
627  * @pre This method can be called if @p scip is in one of the following stages:
628  * - \ref SCIP_STAGE_SOLVING
629  *
630  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
631  */
633  SCIP* scip /**< SCIP data structure */
634  )
635 {
636  assert(scip != NULL);
637 
638  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNPrioExternBranchConts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
639 
641 }
642 
643 /** insert variable, its score and its solution value into the external branching candidate storage
644  * the relative difference of the current lower and upper bounds of a continuous variable must be at least epsilon
645  *
646  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
647  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
648  *
649  * @pre This method can be called if @p scip is in one of the following stages:
650  * - \ref SCIP_STAGE_SOLVING
651  *
652  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
653  */
655  SCIP* scip, /**< SCIP data structure */
656  SCIP_VAR* var, /**< variable to insert */
657  SCIP_Real score, /**< score of external candidate, e.g. infeasibility */
658  SCIP_Real solval /**< value of the variable in the current solution */
659  )
660 {
661  assert(scip != NULL);
662  assert(var->scip == scip);
663 
664  SCIP_CALL( SCIPcheckStage(scip, "SCIPaddExternBranchCand", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
665 
666  SCIP_CALL( SCIPbranchcandAddExternCand(scip->branchcand, scip->set, var, score, solval) );
667 
668  return SCIP_OKAY;
669 }
670 
671 /** removes all external candidates from the storage for external branching
672  *
673  * @pre This method can be called if @p scip is in one of the following stages:
674  * - \ref SCIP_STAGE_SOLVING
675  *
676  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
677  */
679  SCIP* scip /**< SCIP data structure */
680  )
681 {
682  assert(scip != NULL);
683 
684  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPclearExternBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
685 
687 }
688 
689 /** checks whether the given variable is contained in the candidate storage for external branching
690  *
691  * @return whether the given variable is contained in the candidate storage for external branching.
692  *
693  * @pre This method can be called if @p scip is in one of the following stages:
694  * - \ref SCIP_STAGE_SOLVING
695  *
696  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
697  */
699  SCIP* scip, /**< SCIP data structure */
700  SCIP_VAR* var /**< variable to look for */
701  )
702 {
703  assert(scip != NULL);
704  assert(var->scip == scip);
705 
706  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPcontainsExternBranchCand", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
707 
708  return SCIPbranchcandContainsExternCand(scip->branchcand, var);
709 }
710 
711 /** gets branching candidates for pseudo solution branching (non-fixed variables) along with the number of candidates
712  *
713  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
714  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
715  *
716  * @pre This method can be called if @p scip is in one of the following stages:
717  * - \ref SCIP_STAGE_PRESOLVING
718  * - \ref SCIP_STAGE_SOLVING
719  *
720  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
721  */
723  SCIP* scip, /**< SCIP data structure */
724  SCIP_VAR*** pseudocands, /**< pointer to store the array of pseudo branching candidates, or NULL */
725  int* npseudocands, /**< pointer to store the number of pseudo branching candidates, or NULL */
726  int* npriopseudocands /**< pointer to store the number of candidates with maximal priority, or NULL */
727  )
728 {
729  SCIP_CALL( SCIPcheckStage(scip, "SCIPgetPseudoBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
730 
732  pseudocands, npseudocands, npriopseudocands) );
733 
734  return SCIP_OKAY;
735 }
736 
737 /** gets number of branching candidates for pseudo solution branching (non-fixed variables)
738  *
739  * @return the number branching candidates for pseudo solution branching (non-fixed variables).
740  *
741  * @pre This method can be called if @p scip is in one of the following stages:
742  * - \ref SCIP_STAGE_PRESOLVING
743  * - \ref SCIP_STAGE_SOLVING
744  *
745  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
746  */
748  SCIP* scip /**< SCIP data structure */
749  )
750 {
751  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNPseudoBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
752 
754 }
755 
756 /** gets number of branching candidates with maximal branch priority for pseudo solution branching
757  *
758  * @return the number of branching candidates with maximal branch priority for pseudo solution branching.
759  *
760  * @pre This method can be called if @p scip is in one of the following stages:
761  * - \ref SCIP_STAGE_PRESOLVING
762  * - \ref SCIP_STAGE_SOLVING
763  *
764  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
765  */
767  SCIP* scip /**< SCIP data structure */
768  )
769 {
770  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNPrioPseudoBranchCands", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
771 
773 }
774 
775 /** gets number of binary branching candidates with maximal branch priority for pseudo solution branching
776  *
777  * @return the number of binary branching candidates with maximal branch priority for pseudo solution branching.
778  *
779  * @pre This method can be called if @p scip is in one of the following stages:
780  * - \ref SCIP_STAGE_SOLVING
781  *
782  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
783  */
785  SCIP* scip /**< SCIP data structure */
786  )
787 {
788  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNPrioPseudoBranchBins", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
789 
791 }
792 
793 /** gets number of integer branching candidates with maximal branch priority for pseudo solution branching
794  *
795  * @return the number of integer branching candidates with maximal branch priority for pseudo solution branching.
796  *
797  * @pre This method can be called if @p scip is in one of the following stages:
798  * - \ref SCIP_STAGE_SOLVING
799  *
800  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
801  */
803  SCIP* scip /**< SCIP data structure */
804  )
805 {
806  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNPrioPseudoBranchInts", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
807 
809 }
810 
811 /** gets number of implicit integer branching candidates with maximal branch priority for pseudo solution branching
812  *
813  * @return the number of implicit integer branching candidates with maximal branch priority for pseudo solution branching.
814  *
815  * @pre This method can be called if @p scip is in one of the following stages:
816  * - \ref SCIP_STAGE_SOLVING
817  *
818  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
819  */
821  SCIP* scip /**< SCIP data structure */
822  )
823 {
824  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetNPrioPseudoBranchImpls", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
825 
827 }
828 
829 /** calculates the branching score out of the gain predictions for a binary branching
830  *
831  * @return the branching score out of the gain predictions for a binary branching.
832  *
833  * @pre This method can be called if @p scip is in one of the following stages:
834  * - \ref SCIP_STAGE_SOLVING
835  *
836  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
837  */
839  SCIP* scip, /**< SCIP data structure */
840  SCIP_VAR* var, /**< variable, of which the branching factor should be applied, or NULL */
841  SCIP_Real downgain, /**< prediction of objective gain for rounding downwards */
842  SCIP_Real upgain /**< prediction of objective gain for rounding upwards */
843  )
844 {
845  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetBranchScore", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
846 
847  assert( var == NULL || var->scip == scip );
848 
849  return SCIPbranchGetScore(scip->set, var, downgain, upgain);
850 }
851 
852 /** calculates the branching score out of the gain predictions for a branching with arbitrary many children
853  *
854  * @return the branching score out of the gain predictions for a branching with arbitrary many children.
855  *
856  * @pre This method can be called if @p scip is in one of the following stages:
857  * - \ref SCIP_STAGE_SOLVING
858  *
859  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
860  */
862  SCIP* scip, /**< SCIP data structure */
863  SCIP_VAR* var, /**< variable, of which the branching factor should be applied, or NULL */
864  int nchildren, /**< number of children that the branching will create */
865  SCIP_Real* gains /**< prediction of objective gain for each child */
866  )
867 {
868  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetBranchScoreMultiple", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
869 
870  assert( var->scip == scip );
871 
872  return SCIPbranchGetScoreMultiple(scip->set, var, nchildren, gains);
873 }
874 
875 /** computes a branching point for a continuous or discrete variable
876  *
877  * @see SCIPbranchGetBranchingPoint
878  *
879  * @return the branching point for a continuous or discrete variable.
880  *
881  * @pre This method can be called if @p scip is in one of the following stages:
882  * - \ref SCIP_STAGE_SOLVING
883  *
884  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
885  */
887  SCIP* scip, /**< SCIP data structure */
888  SCIP_VAR* var, /**< variable, of which the branching point should be computed */
889  SCIP_Real suggestion /**< suggestion for branching point, or SCIP_INVALID if no suggestion */
890  )
891 {
892  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetBranchingPoint", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
893 
894  assert( var->scip == scip );
895 
896  return SCIPbranchGetBranchingPoint(scip->set, scip->tree, var, suggestion);
897 }
898 
899 /** calculates the node selection priority for moving the given variable's LP value to the given target value;
900  * this node selection priority can be given to the SCIPcreateChild() call
901  *
902  * @return the node selection priority for moving the given variable's LP value to the given target value.
903  *
904  * @pre This method can be called if @p scip is in one of the following stages:
905  * - \ref SCIP_STAGE_SOLVING
906  *
907  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
908  */
910  SCIP* scip, /**< SCIP data structure */
911  SCIP_VAR* var, /**< variable on which the branching is applied */
912  SCIP_BRANCHDIR branchdir, /**< type of branching that was performed: upwards, downwards, or fixed;
913  * fixed should only be used, when both bounds changed
914  */
915  SCIP_Real targetvalue /**< new value of the variable in the child node */
916  )
917 {
918  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPcalcNodeselPriority", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
919 
920  assert( var->scip == scip );
921 
922  return SCIPtreeCalcNodeselPriority(scip->tree, scip->set, scip->stat, var, branchdir, targetvalue);
923 }
924 
925 /** calculates an estimate for the objective of the best feasible solution contained in the subtree after applying the given
926  * branching; this estimate can be given to the SCIPcreateChild() call
927  *
928  * @return the estimate for the objective of the best feasible solution contained in the subtree after applying the given
929  * branching.
930  *
931  * @pre This method can be called if @p scip is in one of the following stages:
932  * - \ref SCIP_STAGE_SOLVING
933  *
934  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
935  */
937  SCIP* scip, /**< SCIP data structure */
938  SCIP_VAR* var, /**< variable on which the branching is applied */
939  SCIP_Real targetvalue /**< new value of the variable in the child node */
940  )
941 {
942  SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPcalcChildEstimate", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
943 
944  assert( var->scip == scip );
945 
946  return SCIPtreeCalcChildEstimate(scip->tree, scip->set, scip->stat, var, targetvalue);
947 }
948 
949 /** creates a child node of the focus node
950  *
951  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
952  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
953  *
954  * @pre This method can be called if @p scip is in one of the following stages:
955  * - \ref SCIP_STAGE_SOLVING
956  *
957  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
958  */
960  SCIP* scip, /**< SCIP data structure */
961  SCIP_NODE** node, /**< pointer to node data structure */
962  SCIP_Real nodeselprio, /**< node selection priority of new node */
963  SCIP_Real estimate /**< estimate for(transformed) objective value of best feasible solution in subtree */
964  )
965 {
966  assert(node != NULL);
967 
968  SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateChild", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
969 
970  SCIP_CALL( SCIPnodeCreateChild(node, scip->mem->probmem, scip->set, scip->stat, scip->tree, nodeselprio, estimate) );
971 
972  return SCIP_OKAY;
973 }
974 
975 /** branches on a non-continuous variable v using the current LP or pseudo solution;
976  * if solution value x' is fractional, two child nodes will be created
977  * (x <= floor(x'), x >= ceil(x')),
978  * if solution value is integral, the x' is equal to lower or upper bound of the branching
979  * variable and the bounds of v are finite, then two child nodes will be created
980  * (x <= x'', x >= x''+1 with x'' = floor((lb + ub)/2)),
981  * otherwise (up to) three child nodes will be created
982  * (x <= x'-1, x == x', x >= x'+1)
983  *
984  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
985  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
986  *
987  * @pre This method can be called if @p scip is in one of the following stages:
988  * - \ref SCIP_STAGE_SOLVING
989  *
990  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
991  */
993  SCIP* scip, /**< SCIP data structure */
994  SCIP_VAR* var, /**< variable to branch on */
995  SCIP_NODE** downchild, /**< pointer to return the left child with variable rounded down, or NULL */
996  SCIP_NODE** eqchild, /**< pointer to return the middle child with variable fixed, or NULL */
997  SCIP_NODE** upchild /**< pointer to return the right child with variable rounded up, or NULL */
998  )
999 {
1000  SCIP_CALL( SCIPcheckStage(scip, "SCIPbranchVar", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1001 
1002  assert( var->scip == scip );
1003 
1005  {
1006  SCIPerrorMessage("cannot branch on continuous variable <%s>\n", SCIPvarGetName(var));
1007  return SCIP_INVALIDDATA;
1008  }
1009 
1010  if( SCIPsetIsEQ(scip->set, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) )
1011  {
1012  SCIPerrorMessage("cannot branch on variable <%s> with fixed domain [%.15g,%.15g]\n",
1014  return SCIP_INVALIDDATA;
1015  }
1016 
1017  SCIP_CALL( SCIPtreeBranchVar(scip->tree, scip->reopt, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
1018  scip->lp, scip->branchcand, scip->eventqueue, var, SCIP_INVALID, downchild, eqchild, upchild) );
1019 
1020  return SCIP_OKAY;
1021 }
1022 
1023 /** branches a variable x using a given domain hole; two child nodes (x <= left, x >= right) are created
1024  *
1025  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1026  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1027  *
1028  * @pre This method can be called if @p scip is in one of the following stages:
1029  * - \ref SCIP_STAGE_SOLVING
1030  *
1031  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1032  */
1034  SCIP* scip, /**< SCIP data structure */
1035  SCIP_VAR* var, /**< variable to branch on */
1036  SCIP_Real left, /**< left side of the domain hole */
1037  SCIP_Real right, /**< right side of the domain hole */
1038  SCIP_NODE** downchild, /**< pointer to return the left child (x <= left), or NULL */
1039  SCIP_NODE** upchild /**< pointer to return the right child (x >= right), or NULL */
1040  )
1041 {
1042  SCIP_CALL( SCIPcheckStage(scip, "SCIPbranchVarHole", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1043 
1044  assert( var->scip == scip );
1045 
1046  SCIP_CALL( SCIPtreeBranchVarHole(scip->tree, scip->reopt, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
1047  scip->origprob, scip->lp, scip->branchcand, scip->eventqueue, var, left, right, downchild, upchild) );
1048 
1049  return SCIP_OKAY;
1050 }
1051 
1052 /** branches on a variable x using a given value x';
1053  * for continuous variables with relative domain width larger epsilon, x' must not be one of the bounds;
1054  * two child nodes (x <= x', x >= x') are created;
1055  * for integer variables, if solution value x' is fractional, two child nodes are created
1056  * (x <= floor(x'), x >= ceil(x')),
1057  * if x' is integral, three child nodes are created
1058  * (x <= x'-1, x == x', x >= x'+1)
1059  *
1060  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1061  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1062  *
1063  * @pre This method can be called if @p scip is in one of the following stages:
1064  * - \ref SCIP_STAGE_SOLVING
1065  *
1066  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1067  */
1069  SCIP* scip, /**< SCIP data structure */
1070  SCIP_VAR* var, /**< variable to branch on */
1071  SCIP_Real val, /**< value to branch on */
1072  SCIP_NODE** downchild, /**< pointer to return the left child with variable rounded down, or NULL */
1073  SCIP_NODE** eqchild, /**< pointer to return the middle child with variable fixed, or NULL */
1074  SCIP_NODE** upchild /**< pointer to return the right child with variable rounded up, or NULL */
1075  )
1076 {
1077  SCIP_CALL( SCIPcheckStage(scip, "SCIPbranchVarVal", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1078 
1079  assert( var->scip == scip );
1080 
1081  /* A continuous variable will be fixed if SCIPisRelEQ(lb,ub) is true. Otherwise, the given branching value should be
1082  * such that its value is not equal to one of the bounds. We assert this by requiring that it is at least eps/2 away
1083  * from each bound. The 2.1 is there, because ub-lb may be in (eps, 2*eps], in which case there is no way to choose a
1084  * branching value that is at least eps away from both bounds. However, if the variable bounds are below/above
1085  * -/+infinity * 2.1, then SCIPisLT will give an assert, so we omit the check in this case.
1086  */
1087  assert(SCIPvarGetType(var) != SCIP_VARTYPE_CONTINUOUS ||
1088  SCIPisRelEQ(scip, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) ||
1089  SCIPisInfinity(scip, -2.1*SCIPvarGetLbLocal(var)) || SCIPisInfinity(scip, 2.1*SCIPvarGetUbLocal(var)) ||
1090  (SCIPisLT(scip, 2.1*SCIPvarGetLbLocal(var), 2.1*val) && SCIPisLT(scip, 2.1*val, 2.1*SCIPvarGetUbLocal(var)) ) );
1091 
1092  if( SCIPsetIsEQ(scip->set, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) )
1093  {
1094  SCIPerrorMessage("cannot branch on variable <%s> with fixed domain [%.15g,%.15g]\n",
1096  return SCIP_INVALIDDATA;
1097  }
1098 
1099  SCIP_CALL( SCIPtreeBranchVar(scip->tree, scip->reopt, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
1100  scip->lp, scip->branchcand, scip->eventqueue, var, val, downchild, eqchild, upchild) );
1101 
1102  return SCIP_OKAY;
1103 }
1104 
1105 /** n-ary branching on a variable x using a given value
1106  *
1107  * Branches on variable x such that up to n/2 children are created on each side of the usual branching value.
1108  * The branching value is selected as in SCIPbranchVarVal().
1109  * The parameters minwidth and widthfactor determine the domain width of the branching variable in the child nodes.
1110  * If n is odd, one child with domain width 'width' and having the branching value in the middle is created.
1111  * Otherwise, two children with domain width 'width' and being left and right of the branching value are created.
1112  * Next further nodes to the left and right are created, where width is multiplied by widthfactor with increasing distance
1113  * from the first nodes.
1114  * The initial width is calculated such that n/2 nodes are created to the left and to the right of the branching value.
1115  * If this value is below minwidth, the initial width is set to minwidth, which may result in creating less than n nodes.
1116  *
1117  * Giving a large value for widthfactor results in creating children with small domain when close to the branching value
1118  * and large domain when closer to the current variable bounds. That is, setting widthfactor to a very large value and n to 3
1119  * results in a ternary branching where the branching variable is mostly fixed in the middle child.
1120  * Setting widthfactor to 1.0 results in children where the branching variable always has the same domain width
1121  * (except for one child if the branching value is not in the middle).
1122  *
1123  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1124  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1125  *
1126  * @pre This method can be called if @p scip is in one of the following stages:
1127  * - \ref SCIP_STAGE_SOLVING
1128  *
1129  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1130  */
1132  SCIP* scip, /**< SCIP data structure */
1133  SCIP_VAR* var, /**< variable to branch on */
1134  SCIP_Real val, /**< value to branch on */
1135  int n, /**< attempted number of children to be created, must be >= 2 */
1136  SCIP_Real minwidth, /**< minimal domain width in children */
1137  SCIP_Real widthfactor, /**< multiplier for children domain width with increasing distance from val, must be >= 1.0 */
1138  int* nchildren /**< pointer to store number of created children, or NULL */
1139  )
1140 {
1141  SCIP_CALL( SCIPcheckStage(scip, "SCIPbranchVarValNary", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1142 
1143  assert( var->scip == scip );
1144 
1145  /* see comment in SCIPbranchVarVal */
1146  assert(SCIPvarGetType(var) != SCIP_VARTYPE_CONTINUOUS ||
1147  SCIPisRelEQ(scip, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) ||
1148  SCIPisInfinity(scip, -2.1*SCIPvarGetLbLocal(var)) || SCIPisInfinity(scip, 2.1*SCIPvarGetUbLocal(var)) ||
1149  (SCIPisLT(scip, 2.1*SCIPvarGetLbLocal(var), 2.1*val) && SCIPisLT(scip, 2.1*val, 2.1*SCIPvarGetUbLocal(var)) ) );
1150 
1151  if( SCIPsetIsEQ(scip->set, SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var)) )
1152  {
1153  SCIPerrorMessage("cannot branch on variable <%s> with fixed domain [%.15g,%.15g]\n",
1155  return SCIP_INVALIDDATA;
1156  }
1157 
1158  SCIP_CALL( SCIPtreeBranchVarNary(scip->tree, scip->reopt, scip->mem->probmem, scip->set, scip->stat, scip->transprob,
1159  scip->origprob, scip->lp, scip->branchcand, scip->eventqueue, var, val, n, minwidth, widthfactor, nchildren) );
1160 
1161  return SCIP_OKAY;
1162 }
1163 
1164 /** calls branching rules to branch on an LP solution; if no fractional variables exist, the result is SCIP_DIDNOTRUN;
1165  * if the branch priority of an unfixed variable is larger than the maximal branch priority of the fractional
1166  * variables, pseudo solution branching is applied on the unfixed variables with maximal branch priority
1167  *
1168  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1169  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1170  *
1171  * @pre This method can be called if @p scip is in one of the following stages:
1172  * - \ref SCIP_STAGE_SOLVING
1173  *
1174  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1175  */
1177  SCIP* scip, /**< SCIP data structure */
1178  SCIP_RESULT* result /**< pointer to store the result of the branching (s. branch.h) */
1179  )
1180 {
1181  SCIP_CALL( SCIPcheckStage(scip, "SCIPbranchLP", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1182 
1183  SCIP_CALL( SCIPbranchExecLP(scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
1184  scip->tree, scip->reopt, scip->lp, scip->sepastore, scip->branchcand, scip->eventqueue, scip->primal->cutoffbound,
1185  TRUE, result) );
1186 
1187  return SCIP_OKAY;
1188 }
1189 
1190 /** calls branching rules to branch on a external candidates; if no such candidates exist, the result is SCIP_DIDNOTRUN
1191  *
1192  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1193  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1194  *
1195  * @pre This method can be called if @p scip is in one of the following stages:
1196  * - \ref SCIP_STAGE_SOLVING
1197  *
1198  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1199  */
1201  SCIP* scip, /**< SCIP data structure */
1202  SCIP_RESULT* result /**< pointer to store the result of the branching (s. branch.h) */
1203  )
1204 {
1205  SCIP_CALL( SCIPcheckStage(scip, "SCIPbranchExtern", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1206 
1207  SCIP_CALL( SCIPbranchExecExtern(scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
1208  scip->tree, scip->reopt, scip->lp, scip->sepastore, scip->branchcand, scip->eventqueue, scip->primal->cutoffbound,
1209  TRUE, result) );
1210 
1211  return SCIP_OKAY;
1212 }
1213 
1214 /** calls branching rules to branch on a pseudo solution; if no unfixed variables exist, the result is SCIP_DIDNOTRUN
1215  *
1216  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1217  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1218  *
1219  * @pre This method can be called if @p scip is in one of the following stages:
1220  * - \ref SCIP_STAGE_SOLVING
1221  *
1222  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1223  */
1225  SCIP* scip, /**< SCIP data structure */
1226  SCIP_RESULT* result /**< pointer to store the result of the branching (s. branch.h) */
1227  )
1228 {
1229  SCIP_CALL( SCIPcheckStage(scip, "SCIPbranchPseudo", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1230 
1231  SCIP_CALL( SCIPbranchExecPseudo(scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->origprob,
1232  scip->tree, scip->reopt, scip->lp, scip->branchcand, scip->eventqueue, scip->primal->cutoffbound, TRUE, result) );
1233 
1234  return SCIP_OKAY;
1235 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
SCIP_Real cutoffbound
Definition: struct_primal.h:46
SCIP_RETCODE SCIPgetLPBranchCands(SCIP *scip, SCIP_VAR ***lpcands, SCIP_Real **lpcandssol, SCIP_Real **lpcandsfrac, int *nlpcands, int *npriolpcands, int *nfracimplvars)
Definition: scip_branch.c:384
SCIP_STAT * stat
Definition: struct_scip.h:69
int SCIPgetNPrioPseudoBranchBins(SCIP *scip)
Definition: scip_branch.c:784
int SCIPbranchcandGetNPrioExternBins(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:526
SCIP_RETCODE SCIPbranchruleCreate(SCIP_BRANCHRULE **branchrule, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int priority, int maxdepth, SCIP_Real maxbounddist, SCIP_DECL_BRANCHCOPY((*branchcopy)), SCIP_DECL_BRANCHFREE((*branchfree)), SCIP_DECL_BRANCHINIT((*branchinit)), SCIP_DECL_BRANCHEXIT((*branchexit)), SCIP_DECL_BRANCHINITSOL((*branchinitsol)), SCIP_DECL_BRANCHEXITSOL((*branchexitsol)), SCIP_DECL_BRANCHEXECLP((*branchexeclp)), SCIP_DECL_BRANCHEXECEXT((*branchexecext)), SCIP_DECL_BRANCHEXECPS((*branchexecps)), SCIP_BRANCHRULEDATA *branchruledata)
Definition: branch.c:1348
SCIP_RETCODE SCIPincludeBranchrule(SCIP *scip, const char *name, const char *desc, int priority, int maxdepth, SCIP_Real maxbounddist, SCIP_DECL_BRANCHCOPY((*branchcopy)), SCIP_DECL_BRANCHFREE((*branchfree)), SCIP_DECL_BRANCHINIT((*branchinit)), SCIP_DECL_BRANCHEXIT((*branchexit)), SCIP_DECL_BRANCHINITSOL((*branchinitsol)), SCIP_DECL_BRANCHEXITSOL((*branchexitsol)), SCIP_DECL_BRANCHEXECLP((*branchexeclp)), SCIP_DECL_BRANCHEXECEXT((*branchexecext)), SCIP_DECL_BRANCHEXECPS((*branchexecps)), SCIP_BRANCHRULEDATA *branchruledata)
Definition: scip_branch.c:57
#define NULL
Definition: def.h:239
SCIP_RETCODE SCIPnodeCreateChild(SCIP_NODE **node, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_Real nodeselprio, SCIP_Real estimate)
Definition: tree.c:980
SCIP_RETCODE SCIPtreeBranchVar(SCIP_TREE *tree, SCIP_REOPT *reopt, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_VAR *var, SCIP_Real val, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
Definition: tree.c:5346
void SCIPbranchruleSetCopy(SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHCOPY((*branchcopy)))
Definition: branch.c:1869
SCIP_RETCODE SCIPsetBranchruleExecPs(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECPS((*branchexecps)))
Definition: scip_branch.c:270
internal methods for branch and bound tree
SCIP_Real SCIPtreeCalcChildEstimate(SCIP_TREE *tree, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var, SCIP_Real targetvalue)
Definition: tree.c:5287
SCIP_RETCODE SCIPtreeBranchVarHole(SCIP_TREE *tree, SCIP_REOPT *reopt, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_VAR *var, SCIP_Real left, SCIP_Real right, SCIP_NODE **downchild, SCIP_NODE **upchild)
Definition: tree.c:5677
SCIP_Bool SCIPisRelEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPbranchVarHole(SCIP *scip, SCIP_VAR *var, SCIP_Real left, SCIP_Real right, SCIP_NODE **downchild, SCIP_NODE **upchild)
Definition: scip_branch.c:1033
#define SCIP_DECL_BRANCHEXECPS(x)
Definition: type_branch.h:161
int SCIPgetNPrioPseudoBranchImpls(SCIP *scip)
Definition: scip_branch.c:820
int SCIPbranchcandGetNPseudoCands(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:851
void SCIPbranchruleSetFree(SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHFREE((*branchfree)))
Definition: branch.c:1880
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:17399
int SCIPgetNPseudoBranchCands(SCIP *scip)
Definition: scip_branch.c:747
SCIP_EVENTQUEUE * eventqueue
Definition: struct_scip.h:78
struct SCIP_BranchruleData SCIP_BRANCHRULEDATA
Definition: type_branch.h:43
SCIP_PRIMAL * primal
Definition: struct_scip.h:83
SCIP_RETCODE SCIPsetBranchruleInitsol(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHINITSOL((*branchinitsol)))
Definition: scip_branch.c:206
SCIP_Real SCIPgetBranchingPoint(SCIP *scip, SCIP_VAR *var, SCIP_Real suggestion)
Definition: scip_branch.c:886
SCIP_RETCODE SCIPsetBranchruleExit(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXIT((*branchexit)))
Definition: scip_branch.c:190
int SCIPbranchcandGetNPrioExternCands(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:516
SCIP_Real SCIPbranchGetScore(SCIP_SET *set, SCIP_VAR *var, SCIP_Real downgain, SCIP_Real upgain)
Definition: branch.c:2189
SCIP_RETCODE SCIPsetBranchruleFree(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHFREE((*branchfree)))
Definition: scip_branch.c:158
#define SCIP_DECL_BRANCHFREE(x)
Definition: type_branch.h:60
SCIP_BRANCHCAND * branchcand
Definition: struct_scip.h:79
#define FALSE
Definition: def.h:65
SCIP_RETCODE SCIPbranchVarValNary(SCIP *scip, SCIP_VAR *var, SCIP_Real val, int n, SCIP_Real minwidth, SCIP_Real widthfactor, int *nchildren)
Definition: scip_branch.c:1131
SCIP_RETCODE SCIPbranchExecPseudo(BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_Real cutoffbound, SCIP_Bool allowaddcons, SCIP_RESULT *result)
Definition: branch.c:2716
int SCIPbranchcandGetNPrioPseudoImpls(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:891
void SCIPclearExternBranchCands(SCIP *scip)
Definition: scip_branch.c:678
#define TRUE
Definition: def.h:64
SCIP_RETCODE SCIPsetBranchruleCopy(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHCOPY((*branchcopy)))
Definition: scip_branch.c:142
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_Real SCIPgetBranchScoreMultiple(SCIP *scip, SCIP_VAR *var, int nchildren, SCIP_Real *gains)
Definition: scip_branch.c:861
SCIP_BRANCHRULE * SCIPfindBranchrule(SCIP *scip, const char *name)
Definition: scip_branch.c:286
int SCIPgetNPrioPseudoBranchInts(SCIP *scip)
Definition: scip_branch.c:802
internal methods for branching rules and branching candidate storage
void SCIPbranchcandClearExternCands(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:696
public methods for problem variables
#define SCIP_DECL_BRANCHEXECEXT(x)
Definition: type_branch.h:140
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:105
SCIP_PROB * transprob
Definition: struct_scip.h:87
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:500
#define SCIP_DECL_BRANCHEXITSOL(x)
Definition: type_branch.h:98
int SCIPgetNLPBranchCands(SCIP *scip)
Definition: scip_branch.c:417
int SCIPbranchcandGetNPrioExternInts(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:536
int SCIPgetNPrioExternBranchImpls(SCIP *scip)
Definition: scip_branch.c:612
SCIP_LPSOLSTAT SCIPlpGetSolstat(SCIP_LP *lp)
Definition: lp.c:12891
internal methods for LP management
int SCIPbranchcandGetNPrioPseudoCands(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:861
int nbranchrules
Definition: struct_set.h:122
SCIP_PROB * origprob
Definition: struct_scip.h:70
public methods for numerical tolerances
SCIP_RETCODE SCIPsetBranchruleExecLp(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECLP((*branchexeclp)))
Definition: scip_branch.c:238
SCIP_RETCODE SCIPbranchExecLP(BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_SEPASTORE *sepastore, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_Real cutoffbound, SCIP_Bool allowaddcons, SCIP_RESULT *result)
Definition: branch.c:2483
SCIP_Real SCIPgetBranchScore(SCIP *scip, SCIP_VAR *var, SCIP_Real downgain, SCIP_Real upgain)
Definition: scip_branch.c:838
enum SCIP_BranchDir SCIP_BRANCHDIR
Definition: type_history.h:39
int SCIPbranchcandGetNExternCands(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:506
int SCIPgetNPrioLPBranchCands(SCIP *scip)
Definition: scip_branch.c:455
SCIP_RETCODE SCIPbranchcandAddExternCand(SCIP_BRANCHCAND *branchcand, SCIP_SET *set, SCIP_VAR *var, SCIP_Real score, SCIP_Real solval)
Definition: branch.c:568
SCIP_Real SCIPtreeCalcNodeselPriority(SCIP_TREE *tree, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var, SCIP_BRANCHDIR branchdir, SCIP_Real targetvalue)
Definition: tree.c:5137
#define SCIP_DECL_BRANCHINIT(x)
Definition: type_branch.h:68
SCIP_MEM * mem
Definition: struct_scip.h:61
#define SCIP_DECL_BRANCHCOPY(x)
Definition: type_branch.h:52
SCIP_RETCODE SCIPbranchcandGetExternCands(SCIP_BRANCHCAND *branchcand, SCIP_VAR ***externcands, SCIP_Real **externcandssol, SCIP_Real **externcandsscore, int *nexterncands, int *nprioexterncands, int *nprioexternbins, int *nprioexternints, int *nprioexternimpls)
Definition: branch.c:439
SCIP_RETCODE SCIPbranchVar(SCIP *scip, SCIP_VAR *var, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
Definition: scip_branch.c:992
#define SCIPerrorMessage
Definition: pub_message.h:45
SCIP_Real SCIPbranchGetBranchingPoint(SCIP_SET *set, SCIP_TREE *tree, SCIP_VAR *var, SCIP_Real suggestion)
Definition: branch.c:2287
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPcheckStage(SCIP *scip, const char *method, SCIP_Bool init, SCIP_Bool problem, SCIP_Bool transforming, SCIP_Bool transformed, SCIP_Bool initpresolve, SCIP_Bool presolving, SCIP_Bool exitpresolve, SCIP_Bool presolved, SCIP_Bool initsolve, SCIP_Bool solving, SCIP_Bool solved, SCIP_Bool exitsolve, SCIP_Bool freetrans, SCIP_Bool freescip)
Definition: debug.c:1933
#define SCIP_DECL_BRANCHINITSOL(x)
Definition: type_branch.h:87
#define SCIP_DECL_BRANCHEXECLP(x)
Definition: type_branch.h:119
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:16729
SCIP_RETCODE SCIPbranchcandGetPseudoCands(SCIP_BRANCHCAND *branchcand, SCIP_SET *set, SCIP_PROB *prob, SCIP_VAR ***pseudocands, int *npseudocands, int *npriopseudocands)
Definition: branch.c:787
SCIP_REOPT * reopt
Definition: struct_scip.h:74
void SCIPbranchruleSetInit(SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHINIT((*branchinit)))
Definition: branch.c:1891
SCIP_RETCODE SCIPsetBranchruleMaxbounddist(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_Real maxbounddist)
Definition: scip_branch.c:353
SCIP_RETCODE SCIPbranchcandGetLPCands(SCIP_BRANCHCAND *branchcand, SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp, SCIP_VAR ***lpcands, SCIP_Real **lpcandssol, SCIP_Real **lpcandsfrac, int *nlpcands, int *npriolpcands, int *nfracimplvars)
Definition: branch.c:404
int SCIPgetNPrioExternBranchCands(SCIP *scip)
Definition: scip_branch.c:552
SCIP_RETCODE SCIPsetBranchrulePriority(SCIP *scip, SCIP_BRANCHRULE *branchrule, int priority)
Definition: scip_branch.c:323
SCIP_RETCODE SCIPcreateChild(SCIP *scip, SCIP_NODE **node, SCIP_Real nodeselprio, SCIP_Real estimate)
Definition: scip_branch.c:959
internal methods for global SCIP settings
#define SCIP_CALL(x)
Definition: def.h:351
SCIP main data structure.
BMS_BLKMEM * setmem
Definition: struct_mem.h:39
SCIP_RETCODE SCIPbranchVarVal(SCIP *scip, SCIP_VAR *var, SCIP_Real val, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
Definition: scip_branch.c:1068
SCIP_Bool SCIPsetIsEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5975
SCIP_Bool SCIPbranchcandContainsExternCand(SCIP_BRANCHCAND *branchcand, SCIP_VAR *var)
Definition: branch.c:711
SCIP_RETCODE SCIPgetPseudoBranchCands(SCIP *scip, SCIP_VAR ***pseudocands, int *npseudocands, int *npriopseudocands)
Definition: scip_branch.c:722
int SCIPgetNPrioExternBranchBins(SCIP *scip)
Definition: scip_branch.c:572
int SCIPgetNPrioExternBranchInts(SCIP *scip)
Definition: scip_branch.c:592
SCIP_BRANCHRULE ** branchrules
Definition: struct_set.h:85
void SCIPbranchruleSetMaxdepth(SCIP_BRANCHRULE *branchrule, int maxdepth)
Definition: branch.c:2024
void SCIPbranchruleSetExecLp(SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECLP((*branchexeclp)))
Definition: branch.c:1937
void SCIPbranchruleSetPriority(SCIP_BRANCHRULE *branchrule, SCIP_SET *set, int priority)
Definition: branch.c:2000
SCIP_SEPASTORE * sepastore
Definition: struct_scip.h:91
int SCIPgetNPrioExternBranchConts(SCIP *scip)
Definition: scip_branch.c:632
#define SCIP_Bool
Definition: def.h:62
int SCIPbranchcandGetNPrioExternConts(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:556
int SCIPgetNPrioPseudoBranchCands(SCIP *scip)
Definition: scip_branch.c:766
methods for debugging
datastructures for block memory pools and memory buffers
SCIP_RETCODE SCIPsetBranchruleExitsol(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXITSOL((*branchexitsol)))
Definition: scip_branch.c:222
SCIP_RETCODE SCIPsetBranchruleExecExt(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECEXT((*branchexecext)))
Definition: scip_branch.c:254
SCIP_Real SCIPcalcNodeselPriority(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR branchdir, SCIP_Real targetvalue)
Definition: scip_branch.c:909
SCIP_RETCODE SCIPsetBranchruleMaxdepth(SCIP *scip, SCIP_BRANCHRULE *branchrule, int maxdepth)
Definition: scip_branch.c:338
SCIP_RETCODE SCIPaddExternBranchCand(SCIP *scip, SCIP_VAR *var, SCIP_Real score, SCIP_Real solval)
Definition: scip_branch.c:654
SCIP_Real SCIPbranchGetScoreMultiple(SCIP_SET *set, SCIP_VAR *var, int nchildren, SCIP_Real *gains)
Definition: branch.c:2249
void SCIPbranchruleSetExecPs(SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECPS((*branchexecps)))
Definition: branch.c:1959
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPcalcChildEstimate(SCIP *scip, SCIP_VAR *var, SCIP_Real targetvalue)
Definition: scip_branch.c:936
SCIP * scip
Definition: struct_var.h:201
void SCIPbranchruleSetInitsol(SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHINITSOL((*branchinitsol)))
Definition: branch.c:1913
public methods for branching rule plugins and branching
void SCIPbranchruleSetExecExt(SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECEXT((*branchexecext)))
Definition: branch.c:1948
void SCIPsetSortBranchrules(SCIP_SET *set)
Definition: set.c:4742
SCIP_RETCODE SCIPtreeBranchVarNary(SCIP_TREE *tree, SCIP_REOPT *reopt, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_VAR *var, SCIP_Real val, int n, SCIP_Real minwidth, SCIP_Real widthfactor, int *nchildren)
Definition: tree.c:5819
SCIP_RETCODE SCIPbranchPseudo(SCIP *scip, SCIP_RESULT *result)
Definition: scip_branch.c:1224
BMS_BLKMEM * probmem
Definition: struct_mem.h:40
int SCIPgetNBranchrules(SCIP *scip)
Definition: scip_branch.c:312
void SCIPbranchruleSetExitsol(SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXITSOL((*branchexitsol)))
Definition: branch.c:1924
SCIP_RETCODE SCIPsetIncludeBranchrule(SCIP_SET *set, SCIP_BRANCHRULE *branchrule)
Definition: set.c:4698
SCIP_BRANCHRULE ** SCIPgetBranchrules(SCIP *scip)
Definition: scip_branch.c:301
int SCIPbranchcandGetNPrioPseudoBins(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:871
SCIP_SET * set
Definition: struct_scip.h:62
public methods for message output
datastructures for problem variables
SCIP_MESSAGEHDLR * messagehdlr
Definition: struct_scip.h:65
#define SCIP_Real
Definition: def.h:150
SCIP_BRANCHRULE * SCIPsetFindBranchrule(SCIP_SET *set, const char *name)
Definition: set.c:4722
SCIP_RETCODE SCIPsetBranchruleInit(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHINIT((*branchinit)))
Definition: scip_branch.c:174
datastructures for collecting primal CIP solutions and primal informations
#define SCIP_INVALID
Definition: def.h:170
void SCIPbranchruleSetMaxbounddist(SCIP_BRANCHRULE *branchrule, SCIP_Real maxbounddist)
Definition: branch.c:2046
void SCIPbranchruleSetExit(SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXIT((*branchexit)))
Definition: branch.c:1902
SCIP_RETCODE SCIPbranchLP(SCIP *scip, SCIP_RESULT *result)
Definition: scip_branch.c:1176
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:16894
SCIP_TREE * tree
Definition: struct_scip.h:84
SCIP_RETCODE SCIPbranchExtern(SCIP *scip, SCIP_RESULT *result)
Definition: scip_branch.c:1200
int SCIPbranchcandGetNPrioPseudoInts(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:881
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:17409
int SCIPgetNExternBranchCands(SCIP *scip)
Definition: scip_branch.c:532
#define SCIP_CALL_ABORT(x)
Definition: def.h:330
SCIP_LP * lp
Definition: struct_scip.h:80
SCIP_RETCODE SCIPbranchExecExtern(BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_SEPASTORE *sepastore, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_Real cutoffbound, SCIP_Bool allowaddcons, SCIP_RESULT *result)
Definition: branch.c:2585
#define SCIPABORT()
Definition: def.h:323
datastructures for global SCIP settings
#define SCIP_DECL_BRANCHEXIT(x)
Definition: type_branch.h:76
SCIP_Bool SCIPcontainsExternBranchCand(SCIP *scip, SCIP_VAR *var)
Definition: scip_branch.c:698
int SCIPbranchcandGetNPrioExternImpls(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:546