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 */
46 SCIP_DECL_SORTPTRCOMP(SCIPbendersComp);
47 
48 /** comparison method for sorting benderss w.r.t. to their name */
50 SCIP_DECL_SORTPTRCOMP(SCIPbendersCompName);
51 
52 /** gets user data of Benders' decomposition */
55  SCIP_BENDERS* benders /**< Benders' decomposition */
56  );
57 
58 /** sets user data of Benders' decomposition; user has to free old data in advance! */
61  SCIP_BENDERS* benders, /**< Benders' decomposition */
62  SCIP_BENDERSDATA* bendersdata /**< new Benders' decomposition user data */
63  );
64 
65 /** gets name of Benders' decomposition */
67 const char* SCIPbendersGetName(
68  SCIP_BENDERS* benders /**< Benders' decomposition */
69  );
70 
71 /** gets description of Benders' decomposition */
73 const char* SCIPbendersGetDesc(
74  SCIP_BENDERS* benders /**< Benders' decomposition */
75  );
76 
77 /** gets priority of Benders' decomposition */
80  SCIP_BENDERS* benders /**< Benders' decomposition */
81  );
82 
83 /** gets the number of subproblems for the Benders' decomposition */
86  SCIP_BENDERS* benders /**< the Benders' decomposition data structure */
87  );
88 
89 /** returns the SCIP instance for a given subproblem */
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 */
99  SCIP_BENDERS* benders /**< Benders' decomposition */
100  );
101 
102 /** gets the number of optimality cuts found by the collection of Benders' decomposition subproblems */
105  SCIP_BENDERS* benders /**< Benders' decomposition */
106  );
107 
108 /** gets time in seconds used in this Benders' decomposition for setting up for next stages */
111  SCIP_BENDERS* benders /**< Benders' decomposition */
112  );
113 
114 /** gets execution time in seconds used in this Benders' decomposition */
117  SCIP_BENDERS* benders /**< Benders' decomposition */
118  );
119 
120 /** Is Benders' decomposition initialized? */
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? */
143  SCIP_BENDERS* benders /**< Benders' decomposition */
144  );
145 
146 /** Are Benders' cuts generated from the pseudo solutions? */
149  SCIP_BENDERS* benders /**< Benders' decomposition */
150  );
151 
152 /** Are Benders' cuts generated from the relaxation solutions? */
155  SCIP_BENDERS* benders /**< Benders' decomposition */
156  );
157 
158 /** Should this Benders' use the auxiliary variables from the highest priority Benders'? */
161  SCIP_BENDERS* benders /**< Benders' decomposition */
162  );
163 
164 /** returns the auxiliary variable for the given subproblem */
167  SCIP_BENDERS* benders, /**< Benders' decomposition */
168  int probnumber /**< the subproblem number */
169  );
170 
171 /** returns all auxiliary variables */
174  SCIP_BENDERS* benders /**< Benders' decomposition */
175  );
176 
177 /** stores the objective function value of the subproblem for use in cut generation */
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 */
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 */
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  */
209  SCIP_BENDERS* benders /**< Benders' decomposition */
210  );
211 
212 
213 /** returns the number of currently available Benders' cuts */
216  SCIP_BENDERS* benders /**< Benders' decomposition */
217  );
218 
219 /** sets the priority of a Benders' decomposition */
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  */
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  */
247  SCIP_BENDERS* benders, /**< Benders' decomposition */
248  int probnumber /**< the subproblem number */
249  );
250 
251 /** returns the number of subproblems that are convex */
253  SCIP_BENDERS* benders /**< Benders' decomposition */
254  );
255 
256 /** solves the LP of the Benders' decomposition subproblem
257  *
258  * This requires that the subproblem is in probing mode.
259  */
262  SCIP* scip, /**< the SCIP data structure */
263  SCIP_BENDERS* benders, /**< the Benders' decomposition data structure */
264  int probnumber, /**< the subproblem number */
265  SCIP_Bool* infeasible /**< a flag to indicate whether all subproblems are feasible */
266  );
267 
268 /** solves the Benders' decomposition subproblem */
271  SCIP* scip, /**< the SCIP data structure */
272  SCIP_BENDERS* benders, /**< the Benders' decomposition data structure */
273  int probnumber, /**< the subproblem number */
274  SCIP_Bool* infeasible, /**< returns whether the current subproblem is infeasible */
275  SCIP_BENDERSENFOTYPE type, /**< the enforcement type calling this function */
276  SCIP_Bool solvecip /**< directly solve the CIP subproblem */
277  );
278 
279 /** returns the number of cuts that have been transferred from sub SCIPs to the master SCIP */
282  SCIP_BENDERS* benders /**< the Benders' decomposition data structure */
283  );
284 
285 /** updates the lower bound for the subproblem. If the lower bound is not greater than the previously stored lowerbound,
286  * then no update occurs.
287  */
290  SCIP_BENDERS* benders, /**< Benders' decomposition */
291  int probnumber, /**< the subproblem number */
292  SCIP_Real lowerbound /**< the lower bound */
293  );
294 
295 /** returns the stored lower bound for the given subproblem */
298  SCIP_BENDERS* benders, /**< Benders' decomposition */
299  int probnumber /**< the subproblem number */
300  );
301 
302 /** sets the independent subproblem flag */
305  SCIP_BENDERS* benders, /**< Benders' decomposition */
306  int probnumber, /**< the subproblem number */
307  SCIP_Bool isindep /**< flag to indicate whether the subproblem is independent */
308  );
309 
310 /** returns whether the subproblem is independent */
313  SCIP_BENDERS* benders, /**< Benders' decomposition */
314  int probnumber /**< the subproblem number */
315  );
316 
317 /** returns whether the subproblem is enabled, i.e. the subproblem is still solved in the solving loop. */
320  SCIP_BENDERS* benders, /**< Benders' decomposition */
321  int probnumber /**< the subproblem number */
322  );
323 
324 /* @} */
325 
326 #ifdef __cplusplus
327 }
328 #endif
329 
330 #endif
SCIP_EXPORT void SCIPbendersSetData(SCIP_BENDERS *benders, SCIP_BENDERSDATA *bendersdata)
Definition: benders.c:4057
SCIP_EXPORT SCIP_VAR * SCIPbendersGetAuxiliaryVar(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4409
SCIP_EXPORT SCIP_Bool SCIPbendersShareAuxVars(SCIP_BENDERS *benders)
Definition: benders.c:4369
type definitions for miscellaneous datastructures
SCIP_EXPORT SCIP_Bool SCIPbendersSubproblemIsIndependent(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4646
SCIP_EXPORT void SCIPbendersUpdateSubproblemLowerbound(SCIP_BENDERS *benders, int probnumber, SCIP_Real lowerbound)
Definition: benders.c:4749
SCIP_EXPORT SCIP_Bool SCIPbendersCutPseudo(SCIP_BENDERS *benders)
Definition: benders.c:4349
#define SCIP_EXPORT
Definition: def.h:98
SCIP_EXPORT SCIP_Bool SCIPbendersSubproblemIsEnabled(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4686
SCIP_EXPORT SCIP_DECL_SORTPTRCOMP(SCIPbendersComp)
Definition: benders.c:709
SCIP_EXPORT int SCIPbendersGetNSubproblems(SCIP_BENDERS *benders)
Definition: benders.c:4255
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
enum SCIP_BendersEnfoType SCIP_BENDERSENFOTYPE
Definition: type_benders.h:42
SCIP_EXPORT SCIP_Real SCIPbendersGetSubproblemObjval(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4448
type definitions for return codes for SCIP methods
SCIP_EXPORT SCIP_Real SCIPbendersGetSubproblemLowerbound(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4768
SCIP_EXPORT SCIP_Bool SCIPbendersCutRelaxation(SCIP_BENDERS *benders)
Definition: benders.c:4359
SCIP_EXPORT SCIP_Real SCIPbendersGetTime(SCIP_BENDERS *benders)
Definition: benders.c:4307
SCIP_EXPORT SCIP * SCIPbendersSubproblem(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4265
SCIP_EXPORT SCIP_BENDERSDATA * SCIPbendersGetData(SCIP_BENDERS *benders)
Definition: benders.c:4047
SCIP_EXPORT SCIP_Bool SCIPbendersCutLP(SCIP_BENDERS *benders)
Definition: benders.c:4339
SCIP_EXPORT int SCIPbendersGetNTransferredCuts(SCIP_BENDERS *benders)
Definition: benders.c:4737
type definitions for SCIP&#39;s main datastructure
SCIP_EXPORT int SCIPbendersGetNCutsFound(SCIP_BENDERS *benders)
Definition: benders.c:4287
struct SCIP_BendersData SCIP_BENDERSDATA
Definition: type_benders.h:63
SCIP_EXPORT SCIP_BENDERSCUT * SCIPfindBenderscut(SCIP_BENDERS *benders, const char *name)
Definition: benders.c:4816
type definitions for problem variables
SCIP_EXPORT void SCIPbendersSetSubproblemIsConvex(SCIP_BENDERS *benders, int probnumber, SCIP_Bool isconvex)
Definition: benders.c:4466
SCIP_EXPORT SCIP_Real SCIPbendersGetSetupTime(SCIP_BENDERS *benders)
Definition: benders.c:4297
SCIP_EXPORT void SCIPbendersSetSubproblemIsIndependent(SCIP_BENDERS *benders, int probnumber, SCIP_Bool isindep)
Definition: benders.c:4606
SCIP_Bool SCIPbendersIsActive(SCIP_BENDERS *benders)
Definition: benders.c:1931
#define SCIP_Bool
Definition: def.h:70
int SCIPbendersGetNConvexSubproblems(SCIP_BENDERS *benders)
Definition: benders.c:4501
SCIP_Bool SCIPbendersOnlyCheckConvexRelax(SCIP_BENDERS *benders)
Definition: benders.c:2000
type definitions for Benders&#39; decomposition methods
type definitions for Benders&#39; decomposition cut
SCIP_EXPORT int SCIPbendersGetNBenderscuts(SCIP_BENDERS *benders)
Definition: benders.c:4855
SCIP_EXPORT const char * SCIPbendersGetDesc(SCIP_BENDERS *benders)
Definition: benders.c:4221
#define SCIP_Real
Definition: def.h:164
SCIP_EXPORT SCIP_VAR ** SCIPbendersGetAuxiliaryVars(SCIP_BENDERS *benders)
Definition: benders.c:4421
SCIP_EXPORT SCIP_Bool SCIPbendersIsInitialized(SCIP_BENDERS *benders)
Definition: benders.c:4329
SCIP_EXPORT const char * SCIPbendersGetName(SCIP_BENDERS *benders)
Definition: benders.c:4211
common defines and data types used in all packages of SCIP
SCIP_EXPORT SCIP_RETCODE SCIPbendersSetBenderscutPriority(SCIP_BENDERS *benders, SCIP_BENDERSCUT *benderscut, int priority)
Definition: benders.c:4865
SCIP_EXPORT SCIP_RETCODE SCIPbendersSolveSubproblemCIP(SCIP *scip, SCIP_BENDERS *benders, int probnumber, SCIP_Bool *infeasible, SCIP_BENDERSENFOTYPE type, SCIP_Bool solvecip)
Definition: benders.c:3505
SCIP_EXPORT SCIP_BENDERSCUT ** SCIPbendersGetBenderscuts(SCIP_BENDERS *benders)
Definition: benders.c:4838
SCIP_EXPORT int SCIPbendersGetNCalls(SCIP_BENDERS *benders)
Definition: benders.c:4277
SCIP_EXPORT int SCIPbendersGetPriority(SCIP_BENDERS *benders)
Definition: benders.c:4231
SCIP_EXPORT void SCIPbendersSetSubproblemObjval(SCIP_BENDERS *benders, int probnumber, SCIP_Real objval)
Definition: benders.c:4431
SCIP_EXPORT SCIP_Bool SCIPbendersSubproblemIsConvex(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4489
SCIP_EXPORT SCIP_RETCODE SCIPbendersSolveSubproblemLP(SCIP *scip, SCIP_BENDERS *benders, int probnumber, SCIP_Bool *infeasible)
Definition: benders.c:3446