1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                           */
3 /*                  This file is part of the program and library             */
4 /*         SCIP --- Solving Constraint Integer Programs                      */
5 /*                                                                           */
6 /*    Copyright (C) 2002-2021 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 scipopt.org.         */
13 /*                                                                           */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file   type_branch.h
17  * @ingroup TYPEDEFINITIONS
18  * @brief  type definitions for branching rules
19  * @author Tobias Achterberg
20  *
21  *  This file defines the interface for branching rules implemented in C.
22  *
23  *  - \ref BRANCH "Instructions for implementing a branching rule"
24  *  - \ref PRIMALHEURISTICS "List of available branching rule"
25  *  - \ref scip::ObjBranchrule "C++ wrapper class"
26  */
27 
28 /** @defgroup DEFPLUGINS_BRANCH Default branching rules
29  *  @ingroup DEFPLUGINS
30  *  @brief implementation files (.c files) of the default branching rules of SCIP
31  */
32 
33 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34 
35 #ifndef __SCIP_TYPE_BRANCH_H__
36 #define __SCIP_TYPE_BRANCH_H__
37 
38 #include "scip/def.h"
39 #include "scip/type_result.h"
40 #include "scip/type_scip.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 typedef struct SCIP_BranchCand SCIP_BRANCHCAND;   /**< branching candidate storage */
47 typedef struct SCIP_Branchrule SCIP_BRANCHRULE;   /**< branching method data structure */
48 typedef struct SCIP_BranchruleData SCIP_BRANCHRULEDATA; /**< branching method specific data */
49 typedef struct SCIP_Treemodel SCIP_TREEMODEL;     /**< parameter storage for the Treemodel branching rules */
50 
51 
52 /** copy method for branchrule plugins (called when SCIP copies plugins)
53  *
54  *  input:
55  *  - scip            : SCIP main data structure
56  *  - branchrule      : the branching rule itself
57  */
58 #define SCIP_DECL_BRANCHCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_BRANCHRULE* branchrule)
59 
60 /** destructor of branching method to free user data (called when SCIP is exiting)
61  *
62  *  input:
63  *  - scip            : SCIP main data structure
64  *  - branchrule      : the branching rule itself
65  */
66 #define SCIP_DECL_BRANCHFREE(x) SCIP_RETCODE x (SCIP* scip, SCIP_BRANCHRULE* branchrule)
67 
68 /** initialization method of branching rule (called after problem was transformed)
69  *
70  *  input:
71  *  - scip            : SCIP main data structure
72  *  - branchrule      : the branching rule itself
73  */
74 #define SCIP_DECL_BRANCHINIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_BRANCHRULE* branchrule)
75 
76 /** deinitialization method of branching rule (called before transformed problem is freed)
77  *
78  *  input:
79  *  - scip            : SCIP main data structure
80  *  - branchrule      : the branching rule itself
81  */
82 #define SCIP_DECL_BRANCHEXIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_BRANCHRULE* branchrule)
83 
84 /** solving process initialization method of branching rule (called when branch and bound process is about to begin)
85  *
86  *  This method is called when the presolving was finished and the branch and bound process is about to begin.
87  *  The branching rule may use this call to initialize its branch and bound specific data.
88  *
89  *  input:
90  *  - scip            : SCIP main data structure
91  *  - branchrule      : the branching rule itself
92  */
93 #define SCIP_DECL_BRANCHINITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_BRANCHRULE* branchrule)
94 
95 /** solving process deinitialization method of branching rule (called before branch and bound process data is freed)
96  *
97  *  This method is called before the branch and bound process is freed.
98  *  The branching rule should use this call to clean up its branch and bound data.
99  *
100  *  input:
101  *  - scip            : SCIP main data structure
102  *  - branchrule      : the branching rule itself
103  */
104 #define SCIP_DECL_BRANCHEXITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_BRANCHRULE* branchrule)
105 
106 /** branching execution method for fractional LP solutions
107  *
108  *  input:
109  *  - scip            : SCIP main data structure
110  *  - branchrule      : the branching rule itself
111  *  - allowaddcons    : is the branching rule allowed to add constraints to the current node in order to cut off the
112  *                      current solution instead of creating a branching?
113  *  - result          : pointer to store the result of the branching call
114  *
115  *  possible return values for *result (if more than one applies, the first in the list should be used):
116  *  - SCIP_CUTOFF     : the current node was detected to be infeasible
117  *  - SCIP_CONSADDED  : an additional constraint (e.g. a conflict constraint) was generated; this result code must not be
118  *                      returned, if allowaddcons is FALSE
119  *  - SCIP_REDUCEDDOM : a domain was reduced that rendered the current LP solution infeasible
120  *  - SCIP_SEPARATED  : a cutting plane was generated
121  *  - SCIP_BRANCHED   : branching was applied
122  *  - SCIP_DIDNOTFIND : the branching rule searched, but did not find a branching
123  *  - SCIP_DIDNOTRUN  : the branching rule was skipped
124  */
125 #define SCIP_DECL_BRANCHEXECLP(x) SCIP_RETCODE x (SCIP* scip, SCIP_BRANCHRULE* branchrule, SCIP_Bool allowaddcons, SCIP_RESULT* result)
126 
127 
128 /** branching execution method for external candidates
129  *
130  *  input:
131  *  - scip            : SCIP main data structure
132  *  - branchrule      : the branching rule itself
133  *  - allowaddcons    : is the branching rule allowed to add constraints to the current node in order to cut off the
134  *                      current solution instead of creating a branching?
135  *  - result          : pointer to store the result of the branching call
136  *
137  *  possible return values for *result (if more than one applies, the first in the list should be used):
138  *  - SCIP_CUTOFF     : the current node was detected to be infeasible
139  *  - SCIP_CONSADDED  : an additional constraint (e.g. a conflict constraint) was generated; this result code must not be
140  *                      returned, if allowaddcons is FALSE
141  *  - SCIP_REDUCEDDOM : a domain was reduced that rendered the current pseudo solution infeasible
142  *  - SCIP_BRANCHED   : branching was applied
143  *  - SCIP_DIDNOTFIND : the branching rule searched, but did not find a branching
144  *  - SCIP_DIDNOTRUN  : the branching rule was skipped
145  */
146 #define SCIP_DECL_BRANCHEXECEXT(x) SCIP_RETCODE x (SCIP* scip, SCIP_BRANCHRULE* branchrule, SCIP_Bool allowaddcons, SCIP_RESULT* result)
147 
148 
149 /** branching execution method for not completely fixed pseudo solutions
150  *
151  *  input:
152  *  - scip            : SCIP main data structure
153  *  - branchrule      : the branching rule itself
154  *  - allowaddcons    : is the branching rule allowed to add constraints to the current node in order to cut off the
155  *                      current solution instead of creating a branching?
156  *  - result          : pointer to store the result of the branching call
157  *
158  *  possible return values for *result (if more than one applies, the first in the list should be used):
159  *  - SCIP_CUTOFF     : the current node was detected to be infeasible
160  *  - SCIP_CONSADDED  : an additional constraint (e.g. a conflict constraint) was generated; this result code must not be
161  *                      returned, if allowaddcons is FALSE
162  *  - SCIP_REDUCEDDOM : a domain was reduced that rendered the current pseudo solution infeasible
163  *  - SCIP_BRANCHED   : branching was applied
164  *  - SCIP_DIDNOTFIND : the branching rule searched, but did not find a branching
165  *  - SCIP_DIDNOTRUN  : the branching rule was skipped
166  */
167 #define SCIP_DECL_BRANCHEXECPS(x) SCIP_RETCODE x (SCIP* scip, SCIP_BRANCHRULE* branchrule, SCIP_Bool allowaddcons, SCIP_RESULT* result)
168 
169 #ifdef __cplusplus
170 }
171 #endif
172 
173 #endif
174