scip_branch.h
Go to the documentation of this file.
38 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
64 * @note method has all branching rule callbacks as arguments and is thus changed every time a new
65 * callback is added in future releases; consider using SCIPincludeBranchruleBasic() and setter functions
74 int maxdepth, /**< maximal depth level, up to which this branching rule should be used (or -1) */
75 SCIP_Real maxbounddist, /**< maximal relative distance from current node's dual bound to primal bound
78 SCIP_DECL_BRANCHCOPY ((*branchcopy)), /**< copy method of branching rule or NULL if you don't want to copy your plugin into sub-SCIPs */
82 SCIP_DECL_BRANCHINITSOL((*branchinitsol)),/**< solving process initialization method of branching rule */
83 SCIP_DECL_BRANCHEXITSOL((*branchexitsol)),/**< solving process deinitialization method of branching rule */
84 SCIP_DECL_BRANCHEXECLP((*branchexeclp)), /**< branching execution method for fractional LP solutions */
85 SCIP_DECL_BRANCHEXECEXT((*branchexecext)),/**< branching execution method for external candidates */
86 SCIP_DECL_BRANCHEXECPS((*branchexecps)), /**< branching execution method for not completely fixed pseudo solutions */
90 /** creates a branching rule and includes it in SCIP. All non-fundamental (or optional) callbacks will be set to NULL.
91 * Optional callbacks can be set via specific setter functions, see SCIPsetBranchruleInit(), SCIPsetBranchruleExit(),
92 * SCIPsetBranchruleCopy(), SCIPsetBranchruleFree(), SCIPsetBranchruleInitsol(), SCIPsetBranchruleExitsol(),
95 * @note if you want to set all callbacks with a single method call, consider using SCIPincludeBranchrule() instead
104 int maxdepth, /**< maximal depth level, up to which this branching rule should be used (or -1) */
105 SCIP_Real maxbounddist, /**< maximal relative distance from current node's dual bound to primal bound
116 SCIP_DECL_BRANCHCOPY ((*branchcopy)) /**< copy method of branching rule or NULL if you don't want to copy your plugin into sub-SCIPs */
148 SCIP_DECL_BRANCHINITSOL((*branchinitsol)) /**< solving process initialization method of branching rule */
156 SCIP_DECL_BRANCHEXITSOL((*branchexitsol)) /**< solving process deinitialization method of branching rule */
164 SCIP_DECL_BRANCHEXECLP((*branchexeclp)) /**< branching execution method for fractional LP solutions */
172 SCIP_DECL_BRANCHEXECEXT((*branchexecext)) /**< branching execution method for external candidates */
180 SCIP_DECL_BRANCHEXECPS((*branchexecps)) /**< branching execution method for not completely fixed pseudo solutions */
210 /** sets maximal depth level, up to which this branching rule should be used (-1 for no limit) */
218 /** sets maximal relative distance from current node's dual bound to primal bound for applying branching rule */
233 /** gets branching candidates for LP solution branching (fractional variables) along with solution values,
234 * fractionalities, and number of branching candidates; The number of branching candidates does NOT
235 * account for fractional implicit integer variables which should not be used for branching decisions.
237 * Fractional implicit integer variables are stored at the positions *nlpcands to *nlpcands + *nfracimplvars - 1
239 * branching rules should always select the branching candidate among the first npriolpcands of the candidate
242 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
254 SCIP_Real** lpcandssol, /**< pointer to store the array of LP candidate solution values, or NULL */
255 SCIP_Real** lpcandsfrac, /**< pointer to store the array of LP candidate fractionalities, or NULL */
257 int* npriolpcands, /**< pointer to store the number of candidates with maximal priority, or NULL */
258 int* nfracimplvars /**< pointer to store the number of fractional implicit integer variables, or NULL */
261 /** gets number of branching candidates for LP solution branching (number of fractional variables)
263 * @return the number of branching candidates for LP solution branching (number of fractional variables).
289 /** gets external branching candidates along with solution values, scores, and number of branching candidates;
291 * branching rules should always select the branching candidate among the first nprioexterncands of the candidate
294 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
302 * @note Candidate variables with maximal priority are ordered: binaries first, then integers, implicit integers and
308 SCIP_VAR*** externcands, /**< pointer to store the array of extern branching candidates, or NULL */
309 SCIP_Real** externcandssol, /**< pointer to store the array of extern candidate solution values, or NULL */
310 SCIP_Real** externcandsscore, /**< pointer to store the array of extern candidate scores, or NULL */
312 int* nprioexterncands, /**< pointer to store the number of candidates with maximal priority, or NULL */
313 int* nprioexternbins, /**< pointer to store the number of binary candidates with maximal priority, or NULL */
314 int* nprioexternints, /**< pointer to store the number of integer candidates with maximal priority, or NULL */
315 int* nprioexternimpls /**< pointer to store the number of implicit integer candidates with maximal priority,
377 * @return the number of implicit integer external branching candidates with maximal branch priority.
403 /** insert variable, its score and its solution value into the external branching candidate storage
404 * the relative difference of the current lower and upper bounds of a continuous variable must be at least epsilon
406 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
434 /** checks whether the given variable is contained in the candidate storage for external branching
436 * @return whether the given variable is contained in the candidate storage for external branching.
449 /** gets branching candidates for pseudo solution branching (non-fixed variables) along with the number of candidates
451 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
463 SCIP_VAR*** pseudocands, /**< pointer to store the array of pseudo branching candidates, or NULL */
465 int* npriopseudocands /**< pointer to store the number of candidates with maximal priority, or NULL */
483 /** gets number of branching candidates with maximal branch priority for pseudo solution branching
485 * @return the number of branching candidates with maximal branch priority for pseudo solution branching.
498 /** gets number of binary branching candidates with maximal branch priority for pseudo solution branching
500 * @return the number of binary branching candidates with maximal branch priority for pseudo solution branching.
512 /** gets number of integer branching candidates with maximal branch priority for pseudo solution branching
514 * @return the number of integer branching candidates with maximal branch priority for pseudo solution branching.
526 /** gets number of implicit integer branching candidates with maximal branch priority for pseudo solution branching
528 * @return the number of implicit integer branching candidates with maximal branch priority for pseudo solution branching.
557 /** calculates the branching score out of the gain predictions for a branching with arbitrary many children
559 * @return the branching score out of the gain predictions for a branching with arbitrary many children.
592 /** calculates the node selection priority for moving the given variable's LP value to the given target value;
595 * @return the node selection priority for moving the given variable's LP value to the given target value.
606 SCIP_BRANCHDIR branchdir, /**< type of branching that was performed: upwards, downwards, or fixed;
612 /** calculates an estimate for the objective of the best feasible solution contained in the subtree after applying the given
615 * @return the estimate for the objective of the best feasible solution contained in the subtree after applying the given
630 /** calculates the increase of the estimate for the objective of the best feasible solution contained in the subtree
633 * @return the increase of the estimate for the objective of the best feasible solution contained in the subtree after
651 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
664 SCIP_Real estimate /**< estimate for (transformed) objective value of best feasible solution in subtree */
676 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
688 SCIP_NODE** downchild, /**< pointer to return the left child with variable rounded down, or NULL */
693 /** branches a variable x using a given domain hole; two child nodes (x <= left, x >= right) are created
695 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
714 * for continuous variables with relative domain width larger epsilon, x' must not be one of the bounds;
721 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
734 SCIP_NODE** downchild, /**< pointer to return the left child with variable rounded down, or NULL */
741 * Branches on variable x such that up to n/2 children are created on each side of the usual branching value.
743 * The parameters minwidth and widthfactor determine the domain width of the branching variable in the child nodes.
744 * If n is odd, one child with domain width 'width' and having the branching value in the middle is created.
745 * Otherwise, two children with domain width 'width' and being left and right of the branching value are created.
746 * Next further nodes to the left and right are created, where width is multiplied by widthfactor with increasing distance
748 * The initial width is calculated such that n/2 nodes are created to the left and to the right of the branching value.
749 * If this value is below minwidth, the initial width is set to minwidth, which may result in creating less than n nodes.
751 * Giving a large value for widthfactor results in creating children with small domain when close to the branching value
752 * and large domain when closer to the current variable bounds. That is, setting widthfactor to a very large value and n to 3
753 * results in a ternary branching where the branching variable is mostly fixed in the middle child.
754 * Setting widthfactor to 1.0 results in children where the branching variable always has the same domain width
757 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
772 SCIP_Real widthfactor, /**< multiplier for children domain width with increasing distance from val, must be >= 1.0 */
776 /** calls branching rules to branch on an LP solution; if no fractional variables exist, the result is SCIP_DIDNOTRUN;
777 * if the branch priority of an unfixed variable is larger than the maximal branch priority of the fractional
778 * variables, pseudo solution branching is applied on the unfixed variables with maximal branch priority
780 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
794 /** calls branching rules to branch on a external candidates; if no such candidates exist, the result is SCIP_DIDNOTRUN
796 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
810 /** calls branching rules to branch on a pseudo solution; if no unfixed variables exist, the result is SCIP_DIDNOTRUN
812 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
SCIP_RETCODE SCIPgetLPBranchCands(SCIP *scip, SCIP_VAR ***lpcands, SCIP_Real **lpcandssol, SCIP_Real **lpcandsfrac, int *nlpcands, int *npriolpcands, int *nfracimplvars)
Definition: scip_branch.c:395
int SCIPgetNPrioPseudoBranchBins(SCIP *scip)
Definition: scip_branch.c:795
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:68
SCIP_RETCODE SCIPsetBranchruleExecPs(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECPS((*branchexecps)))
Definition: scip_branch.c:281
Definition: struct_scip.h:69
SCIP_RETCODE SCIPbranchVarHole(SCIP *scip, SCIP_VAR *var, SCIP_Real left, SCIP_Real right, SCIP_NODE **downchild, SCIP_NODE **upchild)
Definition: scip_branch.c:1091
int SCIPgetNPrioPseudoBranchImpls(SCIP *scip)
Definition: scip_branch.c:831
Definition: struct_var.h:207
SCIP_RETCODE SCIPsetBranchruleInitsol(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHINITSOL((*branchinitsol)))
Definition: scip_branch.c:217
SCIP_Real SCIPgetBranchingPoint(SCIP *scip, SCIP_VAR *var, SCIP_Real suggestion)
Definition: scip_branch.c:897
SCIP_RETCODE SCIPsetBranchruleExit(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXIT((*branchexit)))
Definition: scip_branch.c:201
SCIP_RETCODE SCIPsetBranchruleFree(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHFREE((*branchfree)))
Definition: scip_branch.c:169
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:1189
SCIP_RETCODE SCIPsetBranchruleCopy(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHCOPY((*branchcopy)))
Definition: scip_branch.c:153
SCIP_Real SCIPgetBranchScoreMultiple(SCIP *scip, SCIP_VAR *var, int nchildren, SCIP_Real *gains)
Definition: scip_branch.c:872
SCIP_BRANCHRULE * SCIPfindBranchrule(SCIP *scip, const char *name)
Definition: scip_branch.c:297
int SCIPgetNPrioPseudoBranchInts(SCIP *scip)
Definition: scip_branch.c:813
type definitions for return codes for SCIP methods
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:116
SCIP_Real SCIPcalcChildEstimateIncrease(SCIP *scip, SCIP_VAR *var, SCIP_Real varsol, SCIP_Real targetvalue)
Definition: scip_branch.c:971
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:511
int SCIPgetNPrioExternBranchImpls(SCIP *scip)
Definition: scip_branch.c:623
type definitions for branching rules
Definition: struct_tree.h:141
SCIP_RETCODE SCIPsetBranchruleExecLp(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECLP((*branchexeclp)))
Definition: scip_branch.c:249
SCIP_Real SCIPgetBranchScore(SCIP *scip, SCIP_VAR *var, SCIP_Real downgain, SCIP_Real upgain)
Definition: scip_branch.c:849
SCIP_RETCODE SCIPbranchVar(SCIP *scip, SCIP_VAR *var, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
Definition: scip_branch.c:1050
type definitions for SCIP's main datastructure
SCIP_RETCODE SCIPsetBranchruleMaxbounddist(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_Real maxbounddist)
Definition: scip_branch.c:364
int SCIPgetNPrioExternBranchCands(SCIP *scip)
Definition: scip_branch.c:563
SCIP_RETCODE SCIPsetBranchrulePriority(SCIP *scip, SCIP_BRANCHRULE *branchrule, int priority)
Definition: scip_branch.c:334
SCIP_RETCODE SCIPcreateChild(SCIP *scip, SCIP_NODE **node, SCIP_Real nodeselprio, SCIP_Real estimate)
Definition: scip_branch.c:1017
SCIP_RETCODE SCIPbranchVarVal(SCIP *scip, SCIP_VAR *var, SCIP_Real val, SCIP_NODE **downchild, SCIP_NODE **eqchild, SCIP_NODE **upchild)
Definition: scip_branch.c:1126
type definitions for problem variables
SCIP_RETCODE SCIPgetPseudoBranchCands(SCIP *scip, SCIP_VAR ***pseudocands, int *npseudocands, int *npriopseudocands)
Definition: scip_branch.c:733
int SCIPgetNPrioExternBranchBins(SCIP *scip)
Definition: scip_branch.c:583
int SCIPgetNPrioExternBranchInts(SCIP *scip)
Definition: scip_branch.c:603
Definition: struct_branch.h:78
int SCIPgetNPrioExternBranchConts(SCIP *scip)
Definition: scip_branch.c:643
int SCIPgetNPrioPseudoBranchCands(SCIP *scip)
Definition: scip_branch.c:777
SCIP_RETCODE SCIPsetBranchruleExitsol(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXITSOL((*branchexitsol)))
Definition: scip_branch.c:233
SCIP_RETCODE SCIPsetBranchruleExecExt(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHEXECEXT((*branchexecext)))
Definition: scip_branch.c:265
SCIP_Real SCIPcalcNodeselPriority(SCIP *scip, SCIP_VAR *var, SCIP_BRANCHDIR branchdir, SCIP_Real targetvalue)
Definition: scip_branch.c:920
SCIP_RETCODE SCIPsetBranchruleMaxdepth(SCIP *scip, SCIP_BRANCHRULE *branchrule, int maxdepth)
Definition: scip_branch.c:349
SCIP_RETCODE SCIPaddExternBranchCand(SCIP *scip, SCIP_VAR *var, SCIP_Real score, SCIP_Real solval)
Definition: scip_branch.c:665
type definitions for branch and bound tree
SCIP_Real SCIPcalcChildEstimate(SCIP *scip, SCIP_VAR *var, SCIP_Real targetvalue)
Definition: scip_branch.c:947
SCIP_RETCODE SCIPbranchPseudo(SCIP *scip, SCIP_RESULT *result)
Definition: scip_branch.c:1282
result codes for SCIP callback methods
type definitions for branching and inference history
SCIP_RETCODE SCIPsetBranchruleInit(SCIP *scip, SCIP_BRANCHRULE *branchrule, SCIP_DECL_BRANCHINIT((*branchinit)))
Definition: scip_branch.c:185
SCIP_RETCODE SCIPbranchLP(SCIP *scip, SCIP_RESULT *result)
Definition: scip_branch.c:1234
SCIP_RETCODE SCIPbranchExtern(SCIP *scip, SCIP_RESULT *result)
Definition: scip_branch.c:1258
common defines and data types used in all packages of SCIP
Definition: objbenders.h:43
SCIP_Bool SCIPcontainsExternBranchCand(SCIP *scip, SCIP_VAR *var)
Definition: scip_branch.c:709