Scippy

SCIP

Solving Constraint Integer Programs

pub_benders.h
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-2019 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file pub_benders.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public methods for Benders' decomposition
19  * @author Stephen J. Maher
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_PUB_BENDERS_H__
25 #define __SCIP_PUB_BENDERS_H__
26 
27 #include "scip/def.h"
28 #include "scip/type_benders.h"
29 #include "scip/type_benderscut.h"
30 #include "scip/type_misc.h"
31 #include "scip/type_retcode.h"
32 #include "scip/type_scip.h"
33 #include "scip/type_var.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 /**@addtogroup PublicBendersMethods
40  *
41  * @{
42  */
43 
44 /** compares two benderss w. r. to their priority */
45 extern
46 SCIP_DECL_SORTPTRCOMP(SCIPbendersComp);
47 
48 /** comparison method for sorting benderss w.r.t. to their name */
49 extern
50 SCIP_DECL_SORTPTRCOMP(SCIPbendersCompName);
51 
52 /** gets user data of Benders' decomposition */
53 extern
55  SCIP_BENDERS* benders /**< Benders' decomposition */
56  );
57 
58 /** sets user data of Benders' decomposition; user has to free old data in advance! */
59 extern
61  SCIP_BENDERS* benders, /**< Benders' decomposition */
62  SCIP_BENDERSDATA* bendersdata /**< new Benders' decomposition user data */
63  );
64 
65 /** gets name of Benders' decomposition */
66 extern
67 const char* SCIPbendersGetName(
68  SCIP_BENDERS* benders /**< Benders' decomposition */
69  );
70 
71 /** gets description of Benders' decomposition */
72 extern
73 const char* SCIPbendersGetDesc(
74  SCIP_BENDERS* benders /**< Benders' decomposition */
75  );
76 
77 /** gets priority of Benders' decomposition */
78 extern
80  SCIP_BENDERS* benders /**< Benders' decomposition */
81  );
82 
83 /** gets the number of subproblems for the Benders' decomposition */
84 extern
86  SCIP_BENDERS* benders /**< the Benders' decomposition data structure */
87  );
88 
89 /** returns the SCIP instance for a given subproblem */
90 extern
92  SCIP_BENDERS* benders, /**< the Benders' decomposition data structure */
93  int probnumber /**< the subproblem number */
94  );
95 
96 /** gets the number of times, the Bender' decomposition was called and tried to find a violated second stage constraint */
97 extern
99  SCIP_BENDERS* benders /**< Benders' decomposition */
100  );
101 
102 /** gets the number of optimality cuts found by the collection of Benders' decomposition subproblems */
103 extern
105  SCIP_BENDERS* benders /**< Benders' decomposition */
106  );
107 
108 /** gets time in seconds used in this Benders' decomposition for setting up for next stages */
109 extern
111  SCIP_BENDERS* benders /**< Benders' decomposition */
112  );
113 
114 /** gets execution time in seconds used in this Benders' decomposition */
115 extern
117  SCIP_BENDERS* benders /**< Benders' decomposition */
118  );
119 
120 /** Is Benders' decomposition initialized? */
121 extern
123  SCIP_BENDERS* benders /**< Benders' decomposition */
124  );
125 
126 /** returns whether the given Benders' decomposition is in use in the current problem */
128  SCIP_BENDERS* benders /**< the Benders' decomposition structure */
129  );
130 
131 /** Returns whether only the convex relaxations will be checked in this solve loop
132  * when Benders' is used in the LNS heuristics, only the convex relaxations of the master/subproblems are checked,
133  * i.e. no integer cuts are generated. In this case, then Benders' decomposition is performed under the assumption
134  * that all subproblems are convex relaxations.
135  */
137  SCIP_BENDERS* benders /**< Benders' decomposition */
138  );
139 
140 /** Are Benders' cuts generated from the LP solutions? */
141 extern
143  SCIP_BENDERS* benders /**< Benders' decomposition */
144  );
145 
146 /** Are Benders' cuts generated from the pseudo solutions? */
147 extern
149  SCIP_BENDERS* benders /**< Benders' decomposition */
150  );
151 
152 /** Are Benders' cuts generated from the relaxation solutions? */
153 extern
155  SCIP_BENDERS* benders /**< Benders' decomposition */
156  );
157 
158 /** Should this Benders' use the auxiliary variables from the highest priority Benders'? */
159 extern
161  SCIP_BENDERS* benders /**< Benders' decomposition */
162  );
163 
164 /** returns the auxiliary variable for the given subproblem */
165 extern
167  SCIP_BENDERS* benders, /**< Benders' decomposition */
168  int probnumber /**< the subproblem number */
169  );
170 
171 /** returns all auxiliary variables */
172 extern
174  SCIP_BENDERS* benders /**< Benders' decomposition */
175  );
176 
177 /** stores the objective function value of the subproblem for use in cut generation */
178 extern
180  SCIP_BENDERS* benders, /**< Benders' decomposition */
181  int probnumber, /**< the subproblem number */
182  SCIP_Real objval /**< the objective function value for the subproblem */
183  );
184 
185 /** returns the objective function value of the subproblem for use in cut generation */
186 extern
188  SCIP_BENDERS* benders, /**< Benders' decomposition */
189  int probnumber /**< the subproblem number */
190  );
191 
192 /*
193  * Public functions associated with Benders' cuts
194  */
195 
196 /** returns the Benders' cut of the given name, or NULL if not existing */
197 extern
199  SCIP_BENDERS* benders, /**< Benders' decomposition */
200  const char* name /**< name of Benderscut' decomposition */
201  );
202 
203 
204 /** returns the array of currently available Benders' cuts; active Benders' decomposition are in the first slots of
205  * the array
206  */
207 extern
209  SCIP_BENDERS* benders /**< Benders' decomposition */
210  );
211 
212 
213 /** returns the number of currently available Benders' cuts */
214 extern
216  SCIP_BENDERS* benders /**< Benders' decomposition */
217  );
218 
219 /** sets the priority of a Benders' decomposition */
220 extern
222  SCIP_BENDERS* benders, /**< Benders' decomposition */
223  SCIP_BENDERSCUT* benderscut, /**< Benders' cut */
224  int priority /**< new priority of the Benders' decomposition */
225  );
226 
227 /** sets the flag indicating whether a subproblem is convex
228  *
229  * It is possible that this can change during the solving process. One example is when the three-phase method is
230  * employed, where the first phase solves the convex relaxation of both the master and subproblems, the second phase
231  * reintroduces the integrality constraints to the master problem and the third phase then reintroduces integrality
232  * constraints to the subproblems.
233  */
234 extern
236  SCIP_BENDERS* benders, /**< Benders' decomposition */
237  int probnumber, /**< the subproblem number */
238  SCIP_Bool isconvex /**< flag to indicate whether the subproblem is convex */
239  );
240 
241 /** returns whether the subproblem is convex
242  *
243  * This means that the dual solution can be used to generate cuts.
244  */
245 extern
247  SCIP_BENDERS* benders, /**< Benders' decomposition */
248  int probnumber /**< the subproblem number */
249  );
250 
251 /** returns the number of subproblems that are convex */
252 extern
254  SCIP_BENDERS* benders /**< Benders' decomposition */
255  );
256 
257 /** solves the LP of the Benders' decomposition subproblem
258  *
259  * This requires that the subproblem is in probing mode.
260  */
261 extern
263  SCIP* scip, /**< the SCIP data structure */
264  SCIP_BENDERS* benders, /**< the Benders' decomposition data structure */
265  int probnumber, /**< the subproblem number */
266  SCIP_Bool* infeasible /**< a flag to indicate whether all subproblems are feasible */
267  );
268 
269 /** solves the Benders' decomposition subproblem */
270 extern
272  SCIP* scip, /**< the SCIP data structure */
273  SCIP_BENDERS* benders, /**< the Benders' decomposition data structure */
274  int probnumber, /**< the subproblem number */
275  SCIP_Bool* infeasible, /**< returns whether the current subproblem is infeasible */
276  SCIP_BENDERSENFOTYPE type, /**< the enforcement type calling this function */
277  SCIP_Bool solvecip /**< directly solve the CIP subproblem */
278  );
279 
280 /** returns the number of cuts that have been transferred from sub SCIPs to the master SCIP */
281 extern
283  SCIP_BENDERS* benders /**< the Benders' decomposition data structure */
284  );
285 
286 /** updates the lower bound for the subproblem. If the lower bound is not greater than the previously stored lowerbound,
287  * then no update occurs.
288  */
289 extern
291  SCIP_BENDERS* benders, /**< Benders' decomposition */
292  int probnumber, /**< the subproblem number */
293  SCIP_Real lowerbound /**< the lower bound */
294  );
295 
296 /** returns the stored lower bound for the given subproblem */
297 extern
299  SCIP_BENDERS* benders, /**< Benders' decomposition */
300  int probnumber /**< the subproblem number */
301  );
302 
303 /** sets the independent subproblem flag */
304 extern
306  SCIP_BENDERS* benders, /**< Benders' decomposition */
307  int probnumber, /**< the subproblem number */
308  SCIP_Bool isindep /**< flag to indicate whether the subproblem is independent */
309  );
310 
311 /** returns whether the subproblem is independent */
312 extern
314  SCIP_BENDERS* benders, /**< Benders' decomposition */
315  int probnumber /**< the subproblem number */
316  );
317 
318 /** returns whether the subproblem is enabled, i.e. the subproblem is still solved in the solving loop. */
319 extern
321  SCIP_BENDERS* benders, /**< Benders' decomposition */
322  int probnumber /**< the subproblem number */
323  );
324 
325 /* @} */
326 
327 #ifdef __cplusplus
328 }
329 #endif
330 
331 #endif
int SCIPbendersGetNBenderscuts(SCIP_BENDERS *benders)
Definition: benders.c:4835
SCIP_Real SCIPbendersGetSubproblemObjval(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4428
SCIP_RETCODE SCIPbendersSolveSubproblemLP(SCIP *scip, SCIP_BENDERS *benders, int probnumber, SCIP_Bool *infeasible)
Definition: benders.c:3442
type definitions for miscellaneous datastructures
const char * SCIPbendersGetName(SCIP_BENDERS *benders)
Definition: benders.c:4191
SCIP_RETCODE SCIPbendersSolveSubproblemCIP(SCIP *scip, SCIP_BENDERS *benders, int probnumber, SCIP_Bool *infeasible, SCIP_BENDERSENFOTYPE type, SCIP_Bool solvecip)
Definition: benders.c:3501
SCIP_Bool SCIPbendersIsInitialized(SCIP_BENDERS *benders)
Definition: benders.c:4309
void SCIPbendersSetData(SCIP_BENDERS *benders, SCIP_BENDERSDATA *bendersdata)
Definition: benders.c:4037
SCIP_VAR ** SCIPbendersGetAuxiliaryVars(SCIP_BENDERS *benders)
Definition: benders.c:4401
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
enum SCIP_BendersEnfoType SCIP_BENDERSENFOTYPE
Definition: type_benders.h:42
type definitions for return codes for SCIP methods
const char * SCIPbendersGetDesc(SCIP_BENDERS *benders)
Definition: benders.c:4201
int SCIPbendersGetNCalls(SCIP_BENDERS *benders)
Definition: benders.c:4257
int SCIPbendersGetNTransferredCuts(SCIP_BENDERS *benders)
Definition: benders.c:4717
type definitions for SCIP&#39;s main datastructure
SCIP_BENDERSDATA * SCIPbendersGetData(SCIP_BENDERS *benders)
Definition: benders.c:4027
SCIP_BENDERSCUT * SCIPfindBenderscut(SCIP_BENDERS *benders, const char *name)
Definition: benders.c:4796
struct SCIP_BendersData SCIP_BENDERSDATA
Definition: type_benders.h:63
type definitions for problem variables
void SCIPbendersSetSubproblemObjval(SCIP_BENDERS *benders, int probnumber, SCIP_Real objval)
Definition: benders.c:4411
SCIP_Bool SCIPbendersIsActive(SCIP_BENDERS *benders)
Definition: benders.c:1927
#define SCIP_Bool
Definition: def.h:69
void SCIPbendersSetSubproblemIsIndependent(SCIP_BENDERS *benders, int probnumber, SCIP_Bool isindep)
Definition: benders.c:4586
SCIP_DECL_SORTPTRCOMP(SCIPbendersComp)
Definition: benders.c:709
SCIP_Bool SCIPbendersCutLP(SCIP_BENDERS *benders)
Definition: benders.c:4319
int SCIPbendersGetNCutsFound(SCIP_BENDERS *benders)
Definition: benders.c:4267
int SCIPbendersGetNConvexSubproblems(SCIP_BENDERS *benders)
Definition: benders.c:4481
SCIP * SCIPbendersSubproblem(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4245
SCIP_Bool SCIPbendersOnlyCheckConvexRelax(SCIP_BENDERS *benders)
Definition: benders.c:1996
SCIP_Bool SCIPbendersSubproblemIsIndependent(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4626
type definitions for Benders&#39; decomposition methods
int SCIPbendersGetPriority(SCIP_BENDERS *benders)
Definition: benders.c:4211
SCIP_Bool SCIPbendersSubproblemIsEnabled(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4666
int SCIPbendersGetNSubproblems(SCIP_BENDERS *benders)
Definition: benders.c:4235
type definitions for Benders&#39; decomposition cut
void SCIPbendersSetSubproblemIsConvex(SCIP_BENDERS *benders, int probnumber, SCIP_Bool isconvex)
Definition: benders.c:4446
SCIP_BENDERSCUT ** SCIPbendersGetBenderscuts(SCIP_BENDERS *benders)
Definition: benders.c:4818
SCIP_Real SCIPbendersGetSubproblemLowerbound(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4748
void SCIPbendersUpdateSubproblemLowerbound(SCIP_BENDERS *benders, int probnumber, SCIP_Real lowerbound)
Definition: benders.c:4729
SCIP_Bool SCIPbendersCutPseudo(SCIP_BENDERS *benders)
Definition: benders.c:4329
SCIP_Bool SCIPbendersShareAuxVars(SCIP_BENDERS *benders)
Definition: benders.c:4349
#define SCIP_Real
Definition: def.h:157
SCIP_Bool SCIPbendersCutRelaxation(SCIP_BENDERS *benders)
Definition: benders.c:4339
SCIP_Real SCIPbendersGetSetupTime(SCIP_BENDERS *benders)
Definition: benders.c:4277
SCIP_Real SCIPbendersGetTime(SCIP_BENDERS *benders)
Definition: benders.c:4287
SCIP_Bool SCIPbendersSubproblemIsConvex(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4469
common defines and data types used in all packages of SCIP
SCIP_VAR * SCIPbendersGetAuxiliaryVar(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4389
SCIP_RETCODE SCIPbendersSetBenderscutPriority(SCIP_BENDERS *benders, SCIP_BENDERSCUT *benderscut, int priority)
Definition: benders.c:4845