Scippy

GCG

Branch-and-Price & Column Generation for Everyone

cons_masterbranch.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program */
4 /* GCG --- Generic Column Generation */
5 /* a Dantzig-Wolfe decomposition based extension */
6 /* of the branch-cut-and-price framework */
7 /* SCIP --- Solving Constraint Integer Programs */
8 /* */
9 /* Copyright (C) 2010-2021 Operations Research, RWTH Aachen University */
10 /* Zuse Institute Berlin (ZIB) */
11 /* */
12 /* This program is free software; you can redistribute it and/or */
13 /* modify it under the terms of the GNU Lesser General Public License */
14 /* as published by the Free Software Foundation; either version 3 */
15 /* of the License, or (at your option) any later version. */
16 /* */
17 /* This program is distributed in the hope that it will be useful, */
18 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
19 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
20 /* GNU Lesser General Public License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with this program; if not, write to the Free Software */
24 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
25 /* */
26 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27 
28 /**@file cons_masterbranch.h
29  * @brief constraint handler for storing the branching decisions at each node of the tree
30  * @author Gerald Gamrath
31  * @author Martin Bergner
32  * @author Christian Puchert
33  * @author Marcel Schmickerath
34  */
35 
36 #ifndef GCG_CONS_MASTERBRANCH_H__
37 #define GCG_CONS_MASTERBRANCH_H__
38 
39 #include "scip/scip.h"
40 #include "type_branchgcg.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 
47 /** creates the handler for masterbranch constraints and includes it in SCIP */
48 extern
50  SCIP* scip /**< SCIP data structure */
51  );
52 
53 /** creates and captures a masterbranch constraint */
54 extern
55 SCIP_RETCODE GCGcreateConsMasterbranch(
56  SCIP* scip, /**< SCIP data structure */
57  SCIP_CONS** cons, /**< pointer to hold the created constraint */
58  const char* name, /**< name of the constraint */
59  SCIP_NODE* node, /**< node at which the constraint should be created */
60  SCIP_CONS* parentcons, /**< parent constraint */
61  SCIP_BRANCHRULE* branchrule, /**< pointer to the branching rule */
62  GCG_BRANCHDATA* branchdata, /**< branching data */
63  SCIP_CONS** origbranchconss, /**< original constraints enforcing the branching decision */
64  int norigbranchconss, /**< number of original constraints */
65  int maxorigbranchconss /**< capacity origbranchconss */
66  );
67 
68 /** returns the name of the constraint */
69 extern
71  SCIP_CONS* cons /**< masterbranch constraint for which the data is requested */
72  );
73 
74 /** returns the node in the B&B tree at which the given masterbranch constraint is sticking */
75 extern
77  SCIP_CONS* cons /**< constraint pointer */
78  );
79 
80 /** returns the masterbranch constraint of the B&B father of the node at which the
81  * given masterbranch constraint is sticking
82  */
83 extern
85  SCIP_CONS* cons /**< constraint pointer */
86  );
87 
88 /** returns the number of masterbranch constraints of the children of the node at which the
89  * given masterbranch constraint is sticking
90  */
91 extern
93  SCIP_CONS* cons /**< constraint pointer */
94  );
95 
96 /** returns a masterbranch constraint of a child of the node at which the
97  * given masterbranch constraint is sticking
98  */
99 extern
101  SCIP_CONS* cons, /**< constraint pointer */
102  int childnr /**< index of the child node */
103  );
104 
105 /** returns the origbranch constraint of the node in the original program corresponding to the node
106  * which the given masterbranch constraint is sticking
107  */
108 extern
110  SCIP_CONS* cons /**< constraint pointer */
111  );
112 
113 /** sets the origbranch constraint of the node in the master program corresponding to the node
114  * at which the given masterbranchbranch constraint is sticking
115  */
116 extern
118  SCIP_CONS* cons, /**< constraint pointer */
119  SCIP_CONS* origcons /**< original branching constraint */
120  );
121 
122 /** returns the branching data for a given masterbranch constraint */
123 extern
125  SCIP_CONS* cons /**< constraint pointer */
126  );
127 
128 /** returns the branching rule of the constraint */
129 extern
130 SCIP_BRANCHRULE* GCGconsMasterbranchGetBranchrule(
131  SCIP_CONS* cons /**< masterbranch constraint for which the data is requested */
132  );
133 
134 /** adds a bound change on an original variable that was directly copied to the master problem */
135 extern
137  SCIP* scip, /**< SCIP data structure */
138  SCIP_CONS* cons, /**< masterbranch constraint to which the bound change is added */
139  SCIP_VAR* var, /**< variable on which the bound change was performed */
140  GCG_BOUNDTYPE boundtype, /**< bound type of the bound change */
141  SCIP_Real newbound /**< new bound of the variable after the bound change */
142  );
143 
144 /** returns the constraints in the original problem that enforce the branching decision */
145 extern
147  SCIP_CONS* cons /**< masterbranch constraint for which the data is requested */
148  );
149 
150 /** returns the number of constraints in the original problem that enforce the branching decision */
151 extern
153  SCIP_CONS* cons /**< masterbranch constraint for which the data is requested */
154  );
155 
156 /** releases the constraints in the original problem that enforce the branching decision
157  * and frees the array holding the constraints
158  */
159 extern
161  SCIP* masterscip, /**< master problem SCIP instance */
162  SCIP* origscip, /**< original SCIP instance */
163  SCIP_CONS* cons /**< masterbranch constraint for which the data is freed */
164  );
165 
166 /** returns the masterbranch constraint of the current node */
167 extern
169  SCIP* scip /**< SCIP data structure */
170  );
171 
172 /** returns the stack and the number of elements on it */
173 extern
175  SCIP* scip, /**< SCIP data structure */
176  SCIP_CONS*** stack, /**< return value: pointer to the stack */
177  int* nstackelements /**< return value: pointer to int, for number of elements on the stack */
178  );
179 
180 /** returns the number of elements on the stack */
181 extern
183  SCIP* scip /**< SCIP data structure */
184  );
185 
186 /** adds initial constraint to root node */
187 extern
188 SCIP_RETCODE GCGconsMasterbranchAddRootCons(
189  SCIP* scip /**< SCIP data structure */
190  );
191 
192 /** check whether the node was generated by generic branching */
193 extern
194 SCIP_Bool GCGcurrentNodeIsGeneric(
195  SCIP* scip /**< SCIP data structure */
196  );
197 
198 /** checks the consistency of the masterbranch constraints in the problem */
199 extern
201  SCIP* scip /**< SCIP data structure */
202  );
203 
204 #ifdef __cplusplus
205 }
206 #endif
207 
208 #endif
type definitions for branching rules in GCG projects
SCIP_CONS * GCGconsMasterbranchGetParentcons(SCIP_CONS *cons)
void GCGconsMasterbranchSetOrigcons(SCIP_CONS *cons, SCIP_CONS *origcons)
char * GCGconsMasterbranchGetName(SCIP_CONS *cons)
SCIP_CONS ** GCGconsMasterbranchGetOrigbranchConss(SCIP_CONS *cons)
int GCGconsMasterbranchGetNStackelements(SCIP *scip)
SCIP_RETCODE GCGconsMasterbranchReleaseOrigbranchConss(SCIP *masterscip, SCIP *origscip, SCIP_CONS *cons)
SCIP_NODE * GCGconsMasterbranchGetNode(SCIP_CONS *cons)
void GCGconsMasterbranchCheckConsistency(SCIP *scip)
int GCGconsMasterbranchGetNOrigbranchConss(SCIP_CONS *cons)
int GCGconsMasterbranchGetNChildconss(SCIP_CONS *cons)
GCG_BRANCHDATA * GCGconsMasterbranchGetBranchdata(SCIP_CONS *cons)
SCIP_RETCODE SCIPincludeConshdlrMasterbranch(SCIP *scip)
SCIP_BRANCHRULE * GCGconsMasterbranchGetBranchrule(SCIP_CONS *cons)
SCIP_RETCODE GCGcreateConsMasterbranch(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_NODE *node, SCIP_CONS *parentcons, SCIP_BRANCHRULE *branchrule, GCG_BRANCHDATA *branchdata, SCIP_CONS **origbranchconss, int norigbranchconss, int maxorigbranchconss)
SCIP_CONS * GCGconsMasterbranchGetOrigcons(SCIP_CONS *cons)
SCIP_RETCODE GCGconsMasterbranchAddCopiedVarBndchg(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, GCG_BOUNDTYPE boundtype, SCIP_Real newbound)
void GCGconsMasterbranchGetStack(SCIP *scip, SCIP_CONS ***stack, int *nstackelements)
enum GCG_BoundType GCG_BOUNDTYPE
SCIP_CONS * GCGconsMasterbranchGetActiveCons(SCIP *scip)
SCIP_Bool GCGcurrentNodeIsGeneric(SCIP *scip)
SCIP_CONS * GCGconsMasterbranchGetChildcons(SCIP_CONS *cons, int childnr)
SCIP_RETCODE GCGconsMasterbranchAddRootCons(SCIP *scip)