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