Scippy

SCIP

Solving Constraint Integer Programs

scip_benders.c
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-2018 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 scip_benders.c
17  * @brief public methods for Benders decomposition
18  * @author Tobias Achterberg
19  * @author Timo Berthold
20  * @author Gerald Gamrath
21  * @author Robert Lion Gottwald
22  * @author Stefan Heinz
23  * @author Gregor Hendel
24  * @author Thorsten Koch
25  * @author Alexander Martin
26  * @author Marc Pfetsch
27  * @author Michael Winkler
28  * @author Kati Wolter
29  *
30  * @todo check all SCIP_STAGE_* switches, and include the new stages TRANSFORMED and INITSOLVE
31  */
32 
33 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34 
35 #include <ctype.h>
36 #include <stdarg.h>
37 #include <assert.h>
38 #include <string.h>
39 #if defined(_WIN32) || defined(_WIN64)
40 #else
41 #include <strings.h> /*lint --e{766}*/
42 #endif
43 
44 
45 #include "lpi/lpi.h"
46 #include "nlpi/exprinterpret.h"
47 #include "nlpi/nlpi.h"
48 #include "scip/benders.h"
49 #include "scip/benderscut.h"
50 #include "scip/branch.h"
51 #include "scip/branch_nodereopt.h"
52 #include "scip/clock.h"
53 #include "scip/compr.h"
54 #include "scip/concsolver.h"
55 #include "scip/concurrent.h"
56 #include "scip/conflict.h"
57 #include "scip/conflictstore.h"
58 #include "scip/cons.h"
59 #include "scip/cons_linear.h"
60 #include "scip/cutpool.h"
61 #include "scip/cuts.h"
62 #include "scip/debug.h"
63 #include "scip/def.h"
64 #include "scip/dialog.h"
65 #include "scip/dialog_default.h"
66 #include "scip/disp.h"
67 #include "scip/event.h"
68 #include "scip/heur.h"
69 #include "scip/heur_ofins.h"
70 #include "scip/heur_reoptsols.h"
72 #include "scip/heuristics.h"
73 #include "scip/history.h"
74 #include "scip/implics.h"
75 #include "scip/interrupt.h"
76 #include "scip/lp.h"
77 #include "scip/mem.h"
78 #include "scip/message_default.h"
79 #include "scip/misc.h"
80 #include "scip/nlp.h"
81 #include "scip/nodesel.h"
82 #include "scip/paramset.h"
83 #include "scip/presol.h"
84 #include "scip/presolve.h"
85 #include "scip/pricer.h"
86 #include "scip/pricestore.h"
87 #include "scip/primal.h"
88 #include "scip/prob.h"
89 #include "scip/prop.h"
90 #include "scip/reader.h"
91 #include "scip/relax.h"
92 #include "scip/reopt.h"
93 #include "scip/retcode.h"
94 #include "scip/scipbuildflags.h"
95 #include "scip/scipcoreplugins.h"
96 #include "scip/scipgithash.h"
97 #include "scip/sepa.h"
98 #include "scip/sepastore.h"
99 #include "scip/set.h"
100 #include "scip/sol.h"
101 #include "scip/solve.h"
102 #include "scip/stat.h"
103 #include "scip/syncstore.h"
104 #include "scip/table.h"
105 #include "scip/tree.h"
106 #include "scip/var.h"
107 #include "scip/visual.h"
108 #include "xml/xml.h"
109 
110 #include "scip/scip_benders.h"
111 #include "scip/scip_cons.h"
112 #include "scip/scip_lp.h"
113 
114 #include "scip/pub_benders.h"
115 #include "scip/pub_message.h"
116 
117 
118 /* In debug mode, we include the SCIP's structure in scip.c, such that no one can access
119  * this structure except the interface methods in scip.c.
120  * In optimized mode, the structure is included in scip.h, because some of the methods
121  * are implemented as defines for performance reasons (e.g. the numerical comparisons)
122  */
123 #ifndef NDEBUG
124 #include "scip/struct_scip.h"
125 #endif
126 
127 /** creates a Benders' decomposition and includes it in SCIP
128  *
129  * To use the Benders' decomposition for solving a problem, it first has to be activated with a call to SCIPactivateBenders().
130  * This should be done during the problem creation stage.
131  *
132  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
133  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
134  *
135  * @pre This method can be called if SCIP is in one of the following stages:
136  * - \ref SCIP_STAGE_INIT
137  * - \ref SCIP_STAGE_PROBLEM
138  *
139  * @note method has all Benders' decomposition callbacks as arguments and is thus changed every time a new callback is
140  * added in future releases; consider using SCIPincludeBendersBasic() and setter functions
141  * if you seek for a method which is less likely to change in future releases
142  */
144  SCIP* scip, /**< SCIP data structure */
145  const char* name, /**< name of Benders' decomposition */
146  const char* desc, /**< description of Benders' decomposition */
147  int priority, /**< priority of the Benders' decomposition */
148  SCIP_Bool cutlp, /**< should Benders' cuts be generated for LP solutions */
149  SCIP_Bool cutpseudo, /**< should Benders' cuts be generated for pseudo solutions */
150  SCIP_Bool cutrelax, /**< should Benders' cuts be generated for relaxation solutions */
151  SCIP_Bool shareauxvars, /**< should this Benders' use the highest priority Benders aux vars */
152  SCIP_DECL_BENDERSCOPY ((*benderscopy)), /**< copy method of Benders' decomposition or NULL if you don't want to copy your plugin into sub-SCIPs */
153  SCIP_DECL_BENDERSFREE ((*bendersfree)), /**< destructor of Benders' decomposition */
154  SCIP_DECL_BENDERSINIT ((*bendersinit)), /**< initialize Benders' decomposition */
155  SCIP_DECL_BENDERSEXIT ((*bendersexit)), /**< deinitialize Benders' decomposition */
156  SCIP_DECL_BENDERSINITPRE((*bendersinitpre)),/**< presolving initialization method for Benders' decomposition */
157  SCIP_DECL_BENDERSEXITPRE((*bendersexitpre)),/**< presolving deinitialization method for Benders' decomposition */
158  SCIP_DECL_BENDERSINITSOL((*bendersinitsol)),/**< solving process initialization method of Benders' decomposition */
159  SCIP_DECL_BENDERSEXITSOL((*bendersexitsol)),/**< solving process deinitialization method of Benders' decomposition */
160  SCIP_DECL_BENDERSGETVAR((*bendersgetvar)),/**< returns the master variable for a given subproblem variable */
161  SCIP_DECL_BENDERSCREATESUB((*benderscreatesub)),/**< creates a Benders' decomposition subproblem */
162  SCIP_DECL_BENDERSPRESUBSOLVE((*benderspresubsolve)),/**< the execution method of the Benders' decomposition algorithm */
163  SCIP_DECL_BENDERSSOLVESUBCONVEX((*benderssolvesubconvex)),/**< the solving method for convex Benders' decomposition subproblems */
164  SCIP_DECL_BENDERSSOLVESUB((*benderssolvesub)),/**< the solving method for the Benders' decomposition subproblems */
165  SCIP_DECL_BENDERSPOSTSOLVE((*benderspostsolve)),/**< called after the subproblems are solved. */
166  SCIP_DECL_BENDERSFREESUB((*bendersfreesub)),/**< the freeing method for the Benders' decomposition subproblems */
167  SCIP_BENDERSDATA* bendersdata /**< Benders' decomposition data */
168  )
169 {
170  SCIP_BENDERS* benders;
171 
172  SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeBenders", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
173 
174  /* check whether pricer is already present */
175  if( SCIPfindBenders(scip, name) != NULL )
176  {
177  SCIPerrorMessage("benders <%s> already included.\n", name);
178  return SCIP_INVALIDDATA;
179  }
180 
181  /* Checking whether the benderssolvesub and the bendersfreesub are both implemented or both are not implemented */
182  if( (benderssolvesubconvex == NULL && benderssolvesub == NULL && bendersfreesub != NULL)
183  || ((benderssolvesubconvex != NULL || benderssolvesub != NULL) && bendersfreesub == NULL) )
184  {
185  SCIPerrorMessage("Benders' decomposition <%s> requires that if bendersFreesub%s is "
186  "implemented at least one of bendersSolvesubconvex%s or bendersSolvesub%s are implemented, "
187  "or if bendersFreesub%s is not implemented, then none are implented.\n", name, name, name, name, name);
188  return SCIP_INVALIDCALL;
189  }
190 
191  SCIP_CALL( SCIPbendersCreate(&benders, scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, priority,
192  cutlp, cutpseudo, cutrelax, shareauxvars, benderscopy, bendersfree, bendersinit, bendersexit, bendersinitpre,
193  bendersexitpre, bendersinitsol, bendersexitsol, bendersgetvar, benderscreatesub, benderspresubsolve,
194  benderssolvesubconvex, benderssolvesub, benderspostsolve, bendersfreesub, bendersdata) );
195  SCIP_CALL( SCIPsetIncludeBenders(scip->set, benders) );
196 
197  return SCIP_OKAY;
198 }
199 
200 /** creates a Benders' decomposition and includes it in SCIP with all non-fundamental callbacks set to NULL
201  *
202  * If needed, the non-fundamental callbacks can be added afterwards via setter functions SCIPsetBendersCopy(),
203  * SCIPsetBendersFree(), SCIPsetBendersInity(), SCIPsetBendersExit(), SCIPsetBendersInitsol(), SCIPsetBendersExitsol(),
204  * SCIPsetBendersFarkas().
205  *
206  * To use the Benders' decomposition for solving a problem, it first has to be activated with a call to SCIPactivateBenders().
207  * This should be done during the problem creation stage.
208  *
209  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
210  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
211  *
212  * @pre This method can be called if SCIP is in one of the following stages:
213  * - \ref SCIP_STAGE_INIT
214  * - \ref SCIP_STAGE_PROBLEM
215  *
216  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeBenders() instead
217  */
219  SCIP* scip, /**< SCIP data structure */
220  SCIP_BENDERS** bendersptr, /**< reference to a benders, or NULL */
221  const char* name, /**< name of Benders' decomposition */
222  const char* desc, /**< description of Benders' decomposition */
223  int priority, /**< priority of the Benders' decomposition */
224  SCIP_Bool cutlp, /**< should Benders' cuts be generated for LP solutions */
225  SCIP_Bool cutpseudo, /**< should Benders' cuts be generated for pseudo solutions */
226  SCIP_Bool cutrelax, /**< should Benders' cuts be generated for relaxation solutions */
227  SCIP_Bool shareauxvars, /**< should this Benders' use the highest priority Benders aux vars */
228  SCIP_DECL_BENDERSGETVAR((*bendersgetvar)),/**< returns the master variable for a given subproblem variable */
229  SCIP_DECL_BENDERSCREATESUB((*benderscreatesub)),/**< creates a Benders' decomposition subproblem */
230  SCIP_BENDERSDATA* bendersdata /**< Benders' decomposition data */
231  )
232 {
233  SCIP_BENDERS* benders;
234 
235  SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeBendersBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
236 
237  /* check whether Benders' decomposition is already present */
238  if( SCIPfindBenders(scip, name) != NULL )
239  {
240  SCIPerrorMessage("benders <%s> already included.\n", name);
241  return SCIP_INVALIDDATA;
242  }
243 
244  SCIP_CALL( SCIPbendersCreate(&benders, scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, priority,
245  cutlp, cutpseudo, cutrelax, shareauxvars, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, bendersgetvar,
246  benderscreatesub, NULL, NULL, NULL, NULL, NULL, bendersdata) );
247  SCIP_CALL( SCIPsetIncludeBenders(scip->set, benders) );
248 
249  if( bendersptr != NULL )
250  *bendersptr = benders;
251 
252  return SCIP_OKAY;
253 }
254 
255 /** sets copy method of benders
256  *
257  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
258  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
259  *
260  * @pre This method can be called if SCIP is in one of the following stages:
261  * - \ref SCIP_STAGE_INIT
262  * - \ref SCIP_STAGE_PROBLEM
263  */
265  SCIP* scip, /**< SCIP data structure */
266  SCIP_BENDERS* benders, /**< Benders' decomposition */
267  SCIP_DECL_BENDERSCOPY((*benderscopy)) /**< copy method of Benders' decomposition or NULL if you don't want to copy your plugin into sub-SCIPs */
268  )
269 {
270  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBendersCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
271 
272  assert(benders != NULL);
273 
274  SCIPbendersSetCopy(benders, benderscopy);
275 
276  return SCIP_OKAY;
277 }
278 
279 /** sets destructor method of benders
280  *
281  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
282  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
283  *
284  * @pre This method can be called if SCIP is in one of the following stages:
285  * - \ref SCIP_STAGE_INIT
286  * - \ref SCIP_STAGE_PROBLEM
287  */
289  SCIP* scip, /**< SCIP data structure */
290  SCIP_BENDERS* benders, /**< Benders' decomposition */
291  SCIP_DECL_BENDERSFREE((*bendersfree)) /**< destructor of Benders' decomposition */
292  )
293 {
294  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBendersFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
295 
296  assert(benders != NULL);
297 
298  SCIPbendersSetFree(benders, bendersfree);
299 
300  return SCIP_OKAY;
301 }
302 
303 /** sets initialization method of benders
304  *
305  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
306  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
307  *
308  * @pre This method can be called if SCIP is in one of the following stages:
309  * - \ref SCIP_STAGE_INIT
310  * - \ref SCIP_STAGE_PROBLEM
311  */
313  SCIP* scip, /**< SCIP data structure */
314  SCIP_BENDERS* benders, /**< Benders' decomposition */
315  SCIP_DECL_BENDERSINIT ((*bendersinit)) /**< initialize Benders' decomposition */
316  )
317 {
318  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBendersInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
319 
320  assert(benders != NULL);
321 
322  SCIPbendersSetInit(benders, bendersinit);
323 
324  return SCIP_OKAY;
325 }
326 
327 /** sets deinitialization method of benders
328  *
329  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
330  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
331  *
332  * @pre This method can be called if SCIP is in one of the following stages:
333  * - \ref SCIP_STAGE_INIT
334  * - \ref SCIP_STAGE_PROBLEM
335  */
337  SCIP* scip, /**< SCIP data structure */
338  SCIP_BENDERS* benders, /**< Benders' decomposition */
339  SCIP_DECL_BENDERSEXIT ((*bendersexit)) /**< deinitialize Benders' decomposition */
340  )
341 {
342  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBendersExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
343 
344  assert(benders != NULL);
345 
346  SCIPbendersSetExit(benders, bendersexit);
347 
348  return SCIP_OKAY;
349 }
350 
351 /** sets presolving initialization method of benders
352  *
353  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
354  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
355  *
356  * @pre This method can be called if SCIP is in one of the following stages:
357  * - \ref SCIP_STAGE_INIT
358  * - \ref SCIP_STAGE_PROBLEM
359  */
361  SCIP* scip, /**< SCIP data structure */
362  SCIP_BENDERS* benders, /**< Benders' decomposition */
363  SCIP_DECL_BENDERSINITPRE((*bendersinitpre))/**< presolving initialization method of Benders' decomposition */
364  )
365 {
366  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBendersInitpre", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
367 
368  assert(benders != NULL);
369 
370  SCIPbendersSetInitpre(benders, bendersinitpre);
371 
372  return SCIP_OKAY;
373 }
374 
375 /** sets presolving deinitialization method of benders
376  *
377  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
378  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
379  *
380  * @pre This method can be called if SCIP is in one of the following stages:
381  * - \ref SCIP_STAGE_INIT
382  * - \ref SCIP_STAGE_PROBLEM
383  */
385  SCIP* scip, /**< SCIP data structure */
386  SCIP_BENDERS* benders, /**< Benders' decomposition */
387  SCIP_DECL_BENDERSEXITPRE((*bendersexitpre))/**< presolving deinitialization method of Benders' decomposition */
388  )
389 {
390  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBendersExitpre", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
391 
392  assert(benders != NULL);
393 
394  SCIPbendersSetExitpre(benders, bendersexitpre);
395 
396  return SCIP_OKAY;
397 }
398 
399 /** sets solving process initialization method of benders
400  *
401  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
402  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
403  *
404  * @pre This method can be called if SCIP is in one of the following stages:
405  * - \ref SCIP_STAGE_INIT
406  * - \ref SCIP_STAGE_PROBLEM
407  */
409  SCIP* scip, /**< SCIP data structure */
410  SCIP_BENDERS* benders, /**< Benders' decomposition */
411  SCIP_DECL_BENDERSINITSOL((*bendersinitsol))/**< solving process initialization method of Benders' decomposition */
412  )
413 {
414  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBendersInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
415 
416  assert(benders != NULL);
417 
418  SCIPbendersSetInitsol(benders, bendersinitsol);
419 
420  return SCIP_OKAY;
421 }
422 
423 /** sets solving process deinitialization method of benders
424  *
425  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
426  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
427  *
428  * @pre This method can be called if SCIP is in one of the following stages:
429  * - \ref SCIP_STAGE_INIT
430  * - \ref SCIP_STAGE_PROBLEM
431  */
433  SCIP* scip, /**< SCIP data structure */
434  SCIP_BENDERS* benders, /**< Benders' decomposition */
435  SCIP_DECL_BENDERSEXITSOL((*bendersexitsol))/**< solving process deinitialization method of Benders' decomposition */
436  )
437 {
438  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBendersExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
439 
440  assert(benders != NULL);
441 
442  SCIPbendersSetExitsol(benders, bendersexitsol);
443 
444  return SCIP_OKAY;
445 }
446 
447 /** sets the method called prior to solving the subproblems for benders
448  *
449  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
450  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
451  *
452  * @pre This method can be called if SCIP is in one of the following stages:
453  * - \ref SCIP_STAGE_INIT
454  * - \ref SCIP_STAGE_PROBLEM
455  */
457  SCIP* scip, /**< SCIP data structure */
458  SCIP_BENDERS* benders, /**< Benders' decomposition */
459  SCIP_DECL_BENDERSPRESUBSOLVE((*benderspresubsolve))/**< method called prior to solving the subproblems */
460  )
461 {
462  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBendersPresubsolve", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
463 
464  assert(benders != NULL);
465 
466  SCIPbendersSetPresubsolve(benders, benderspresubsolve);
467 
468  return SCIP_OKAY;
469 }
470 
471 /** sets the subproblem solving and freeing methods for Benders' decomposition
472  *
473  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
474  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
475  *
476  * @pre This method can be called if SCIP is in one of the following stages:
477  * - \ref SCIP_STAGE_INIT
478  * - \ref SCIP_STAGE_PROBLEM
479  */
481  SCIP* scip, /**< SCIP data structure */
482  SCIP_BENDERS* benders, /**< Benders' decomposition */
483  SCIP_DECL_BENDERSSOLVESUBCONVEX((*benderssolvesubconvex)),/**< the solving method for convex Benders' decomposition subproblems */
484  SCIP_DECL_BENDERSSOLVESUB((*benderssolvesub)),/**< solving method for a Benders' decomposition subproblem */
485  SCIP_DECL_BENDERSFREESUB((*bendersfreesub))/**< the subproblem freeing method for Benders' decomposition */
486  )
487 {
488  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBendersSolveAndFreesub", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
489 
490  assert(benders != NULL);
491 
492  /* Checking whether the benderssolvesub and the bendersfreesub are both implemented or both are not implemented */
493  if( (benderssolvesubconvex == NULL && benderssolvesub == NULL && bendersfreesub != NULL)
494  || ((benderssolvesubconvex != NULL || benderssolvesub != NULL) && bendersfreesub == NULL) )
495  {
496  SCIPerrorMessage("Benders' decomposition <%s> requires that if bendersFreesub%s is "
497  "implemented at least one of bendersSolvesubconvex%s or bendersSolvesub%s are implemented, "
498  "or if bendersFreesub%s is not implemented, then none are implented.\n", SCIPbendersGetName(benders),
499  SCIPbendersGetName(benders), SCIPbendersGetName(benders), SCIPbendersGetName(benders),
500  SCIPbendersGetName(benders));
501  return SCIP_INVALIDCALL;
502  }
503 
504  SCIPbendersSetSolvesubconvex(benders, benderssolvesubconvex);
505  SCIPbendersSetSolvesub(benders, benderssolvesub);
506  SCIPbendersSetFreesub(benders, bendersfreesub);
507 
508  return SCIP_OKAY;
509 }
510 
511 /** sets the post solving methods for benders
512  *
513  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
514  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
515  *
516  * @pre This method can be called if SCIP is in one of the following stages:
517  * - \ref SCIP_STAGE_INIT
518  * - \ref SCIP_STAGE_PROBLEM
519  */
521  SCIP* scip, /**< SCIP data structure */
522  SCIP_BENDERS* benders, /**< Benders' decomposition */
523  SCIP_DECL_BENDERSPOSTSOLVE((*benderspostsolve))/**< solving process deinitialization method of Benders' decomposition */
524  )
525 {
526  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBendersPostsolve", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
527 
528  assert(benders != NULL);
529 
530  SCIPbendersSetPostsolve(benders, benderspostsolve);
531 
532  return SCIP_OKAY;
533 }
534 
535 /** returns the Benders' decomposition of the given name, or NULL if not existing */
537  SCIP* scip, /**< SCIP data structure */
538  const char* name /**< name of Benders' decomposition */
539  )
540 {
541  assert(scip != NULL);
542  assert(scip->set != NULL);
543  assert(name != NULL);
544 
545  return SCIPsetFindBenders(scip->set, name);
546 }
547 
548 /** returns the array of currently available Benders' decomposition; active Benders' decomposition are in the first
549  * slots of the array
550  */
552  SCIP* scip /**< SCIP data structure */
553  )
554 {
555  assert(scip != NULL);
556  assert(scip->set != NULL);
557 
558  SCIPsetSortBenders(scip->set);
559 
560  return scip->set->benders;
561 }
562 
563 /** returns the number of currently available Benders' decomposition */
565  SCIP* scip /**< SCIP data structure */
566  )
567 {
568  assert(scip != NULL);
569  assert(scip->set != NULL);
570 
571  return scip->set->nbenders;
572 }
573 
574 /** returns the number of currently active Benders' decomposition */
576  SCIP* scip /**< SCIP data structure */
577  )
578 {
579  assert(scip != NULL);
580  assert(scip->set != NULL);
581 
582  return scip->set->nactivebenders;
583 }
584 
585 /** activates the Benders' decomposition to be used for the current problem
586  *
587  * This method should be called during the problem creation stage for all pricers that are necessary to solve
588  * the problem model.
589  *
590  * @note The Benders' decompositions are automatically deactivated when the problem is freed.
591  *
592  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
593  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
594  *
595  * @pre This method can be called if SCIP is in one of the following stages:
596  * - \ref SCIP_STAGE_PROBLEM
597  */
599  SCIP* scip, /**< SCIP data structure */
600  SCIP_BENDERS* benders, /**< the Benders' decomposition structure */
601  int nsubproblems /**< the number of subproblems in the Benders' decomposition */
602  )
603 {
604  SCIP_CALL( SCIPcheckStage(scip, "SCIPactivateBenders", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
605 
606  SCIP_CALL( SCIPbendersActivate(benders, scip->set, nsubproblems) );
607 
608  return SCIP_OKAY;
609 }
610 
611 /** deactivates the Benders' decomposition
612  *
613  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
614  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
615  *
616  * @pre This method can be called if SCIP is in one of the following stages:
617  * - \ref SCIP_STAGE_PROBLEM
618  * - \ref SCIP_STAGE_EXITSOLVE
619  */
621  SCIP* scip, /**< SCIP data structure */
622  SCIP_BENDERS* benders /**< the Benders' decomposition structure */
623  )
624 {
625  SCIP_CALL( SCIPcheckStage(scip, "SCIPdeactivateBenders", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE) );
626 
627  SCIPbendersDeactivate(benders, scip->set);
628 
629  return SCIP_OKAY;
630 }
631 
632 /** sets the priority of a Benders' decomposition */
634  SCIP* scip, /**< SCIP data structure */
635  SCIP_BENDERS* benders, /**< Benders' decomposition */
636  int priority /**< new priority of the Benders' decomposition */
637  )
638 {
639  assert(scip != NULL);
640  assert(scip->set != NULL);
641  assert(benders != NULL);
642 
643  SCIPbendersSetPriority(benders, scip->set, priority);
644 }
645 
646 /** calls the exec method of Benders' decomposition to solve the subproblems
647  *
648  * The checkint flag indicates whether integer feasibility can be assumed. If it is not assumed, i.e. checkint ==
649  * FALSE, then only the convex relaxations of the subproblems are solved. If integer feasibility is assumed, i.e.
650  * checkint == TRUE, then the convex relaxations and the full CIP are solved to generate Benders' cuts and check
651  * solution feasibility.
652  *
653  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
654  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
655  *
656  * @pre This method can be called if SCIP is in one of the following stages:
657  * - \ref SCIP_STAGE_INITPRESOLVE
658  * - \ref SCIP_STAGE_PRESOLVING
659  * - \ref SCIP_STAGE_EXITPRESOLVE
660  * - \ref SCIP_STAGE_PRESOLVED
661  * - \ref SCIP_STAGE_INITSOLVE
662  * - \ref SCIP_STAGE_SOLVING
663  * - \ref SCIP_STAGE_SOLVED
664  */
666  SCIP* scip, /**< SCIP data structure */
667  SCIP_BENDERS* benders, /**< Benders' decomposition */
668  SCIP_SOL* sol, /**< primal CIP solution, can be NULL */
669  SCIP_RESULT* result, /**< result of the pricing process */
670  SCIP_Bool* infeasible, /**< is the master problem infeasible with respect to the Benders' cuts? */
671  SCIP_Bool* auxviol, /**< set to TRUE only if the solution is feasible but the aux vars are violated */
672  SCIP_BENDERSENFOTYPE type, /**< the type of solution being enforced */
673  SCIP_Bool checkint /**< should the integer solution be checked by the subproblems */
674  )
675 {
676  assert(scip != NULL);
677  assert(scip->set != NULL);
678  assert(benders != NULL);
679 
680  SCIP_CALL( SCIPcheckStage(scip, "SCIPsolveBendersSubproblems", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
681 
682  SCIP_CALL( SCIPbendersExec(benders, scip->set, sol, result, infeasible, auxviol, type, checkint) );
683 
684  return SCIP_OKAY;
685 }
686 
687 /** returns the master problem variable for the given subproblem variable
688  *
689  * This function is used as part of the cut generation process.
690  *
691  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
692  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
693  *
694  * @pre This method can be called if SCIP is in one of the following stages:
695  * - \ref SCIP_STAGE_INITPRESOLVE
696  * - \ref SCIP_STAGE_PRESOLVING
697  * - \ref SCIP_STAGE_EXITPRESOLVE
698  * - \ref SCIP_STAGE_PRESOLVED
699  * - \ref SCIP_STAGE_INITSOLVE
700  * - \ref SCIP_STAGE_SOLVING
701  * - \ref SCIP_STAGE_SOLVED
702  */
704  SCIP* scip, /**< SCIP data structure */
705  SCIP_BENDERS* benders, /**< Benders' decomposition */
706  SCIP_VAR* var, /**< the subproblem variable */
707  SCIP_VAR** mappedvar /**< pointer to store the master variable that var is mapped to */
708  )
709 {
710  assert(scip != NULL);
711  assert(scip->set != NULL);
712  assert(benders != NULL);
713  assert(var != NULL);
714  assert(mappedvar != NULL);
715 
716  SCIP_CALL( SCIPcheckStage(scip, "SCIPgetBendersMasterVar", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
717 
718  SCIP_CALL( SCIPbendersGetVar(benders, scip->set, var, mappedvar, -1) );
719 
720  return SCIP_OKAY;
721 }
722 
723 /** returns the subproblem problem variable for the given master variable
724  *
725  * This function is used as part of the cut generation process.
726  *
727  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
728  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
729  *
730  * @pre This method can be called if SCIP is in one of the following stages:
731  * - \ref SCIP_STAGE_INITPRESOLVE
732  * - \ref SCIP_STAGE_PRESOLVING
733  * - \ref SCIP_STAGE_EXITPRESOLVE
734  * - \ref SCIP_STAGE_PRESOLVED
735  * - \ref SCIP_STAGE_INITSOLVE
736  * - \ref SCIP_STAGE_SOLVING
737  * - \ref SCIP_STAGE_SOLVED
738  */
740  SCIP* scip, /**< SCIP data structure */
741  SCIP_BENDERS* benders, /**< Benders' decomposition */
742  SCIP_VAR* var, /**< the master variable */
743  SCIP_VAR** mappedvar, /**< pointer to store the subproblem variable that var is mapped to */
744  int probnumber /**< the subproblem number */
745  )
746 {
747  assert(scip != NULL);
748  assert(scip->set != NULL);
749  assert(benders != NULL);
750  assert(var != NULL);
751  assert(mappedvar != NULL);
752  assert(probnumber >= 0 && probnumber < SCIPgetBendersNSubproblems(scip, benders));
753 
754  SCIP_CALL( SCIPcheckStage(scip, "SCIPgetBendersSubproblemVar", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
755 
756  SCIP_CALL( SCIPbendersGetVar(benders, scip->set, var, mappedvar, probnumber) );
757 
758  return SCIP_OKAY;
759 }
760 
761 /** returns the number of subproblems that are stored in the given Benders' decomposition
762  *
763  * @return the number of subproblems in the Benders' decomposition
764  */
766  SCIP* scip, /**< SCIP data structure */
767  SCIP_BENDERS* benders /**< Benders' decomposition */
768  )
769 {
770  assert(scip != NULL);
771  assert(benders != NULL);
772 
773  return SCIPbendersGetNSubproblems(benders);
774 }
775 
776 /** registers the Benders' decomposition subproblem with the Benders' decomposition struct
777  *
778  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
779  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
780  *
781  * @pre This method can be called if SCIP is in one of the following stages:
782  * - \ref SCIP_STAGE_TRANSFORMED
783  */
785  SCIP* scip, /**< SCIP data structure */
786  SCIP_BENDERS* benders, /**< Benders' decomposition */
787  SCIP* subproblem /**< Benders' decomposition subproblem */
788  )
789 {
790  assert(scip != NULL);
791  assert(benders != NULL);
792  assert(subproblem != NULL);
793 
794  SCIP_CALL( SCIPcheckStage(scip, "SCIPaddBendersSubproblem", FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
795 
796  SCIP_CALL( SCIPbendersAddSubproblem(benders, subproblem) );
797 
798  return SCIP_OKAY;
799 }
800 
801 /** calls the generic subproblem setup method for a Benders' decomposition subproblem
802  *
803  * This is called if the user requires to solve the Benders' decomposition subproblem separately from the main Benders'
804  * solving loop. This could be in the case of enhancement techniques.
805  *
806  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
807  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
808  *
809  * @pre This method can be called if SCIP is in one of the following stages:
810  * - \ref SCIP_STAGE_TRANSFORMED
811  * - \ref SCIP_STAGE_INITPRESOLVE
812  * - \ref SCIP_STAGE_PRESOLVING
813  * - \ref SCIP_STAGE_EXITPRESOLVE
814  * - \ref SCIP_STAGE_PRESOLVED
815  * - \ref SCIP_STAGE_INITSOLVE
816  * - \ref SCIP_STAGE_SOLVING
817  * - \ref SCIP_STAGE_SOLVED
818  */
820  SCIP* scip, /**< SCIP data structure */
821  SCIP_BENDERS* benders, /**< the Benders' decomposition data structure */
822  SCIP_SOL* sol, /**< primal solution used to setup the problem, NULL for LP solution */
823  int probnumber /**< the subproblem number */
824  )
825 {
826  assert(scip != NULL);
827  assert(scip->set != NULL);
828  assert(benders != NULL);
829  assert(probnumber >= 0 && probnumber < SCIPgetBendersNSubproblems(scip, benders));
830 
831  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetupBendersSubproblem", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
832 
833  SCIP_CALL( SCIPbendersSetupSubproblem(benders, scip->set, sol, probnumber) );
834 
835  return SCIP_OKAY;
836 }
837 
838 /** calls the solving method for a single Benders' decomposition subproblem
839  *
840  * The method either calls the users solve subproblem method or calls the generic method. In the case of the generic
841  * method, the user must set up the subproblem prior to calling this method.
842  *
843  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
844  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
845  *
846  * @pre This method can be called if SCIP is in one of the following stages:
847  * - \ref SCIP_STAGE_TRANSFORMED
848  * - \ref SCIP_STAGE_INITPRESOLVE
849  * - \ref SCIP_STAGE_PRESOLVING
850  * - \ref SCIP_STAGE_EXITPRESOLVE
851  * - \ref SCIP_STAGE_PRESOLVED
852  * - \ref SCIP_STAGE_INITSOLVE
853  * - \ref SCIP_STAGE_SOLVING
854  * - \ref SCIP_STAGE_SOLVED
855  */
857  SCIP* scip, /**< SCIP data structure */
858  SCIP_BENDERS* benders, /**< Benders' decomposition */
859  SCIP_SOL* sol, /**< primal CIP solution, can be NULL for the current LP/Pseudo solution */
860  int probnumber, /**< the subproblem number */
861  SCIP_Bool* infeasible, /**< returns whether the current subproblem is infeasible */
862  SCIP_BENDERSENFOTYPE type, /**< the enforcement type calling this function */
863  SCIP_Bool solvecip, /**< directly solve the CIP subproblem */
864  SCIP_Real* objective /**< the objective function value of the subproblem, can be NULL */
865  )
866 {
867  assert(scip != NULL);
868  assert(scip->set != NULL);
869  assert(benders != NULL);
870  assert(probnumber >= 0 && probnumber < SCIPgetBendersNSubproblems(scip, benders));
871 
872  SCIP_CALL( SCIPcheckStage(scip, "SCIPsolveBendersSubproblem", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
873 
874  SCIP_CALL( SCIPbendersSolveSubproblem(benders, scip->set, sol, probnumber, infeasible, type, solvecip, objective) );
875 
876  return SCIP_OKAY;
877 }
878 
879 /** frees the subproblem after calling the solve subproblem method
880  *
881  * This will either call the user defined free
882  * subproblem callback for Benders' decomposition or the default freeing methods. In the default case, if the
883  * subproblem is an LP, then SCIPendProbing is called. If the subproblem is a MIP, then SCIPfreeTransform is called.
884  *
885  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
886  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
887  *
888  * @pre This method can be called if SCIP is in one of the following stages:
889  * - \ref SCIP_STAGE_TRANSFORMED
890  * - \ref SCIP_STAGE_INITPRESOLVE
891  * - \ref SCIP_STAGE_PRESOLVING
892  * - \ref SCIP_STAGE_EXITPRESOLVE
893  * - \ref SCIP_STAGE_PRESOLVED
894  * - \ref SCIP_STAGE_INITSOLVE
895  * - \ref SCIP_STAGE_SOLVING
896  * - \ref SCIP_STAGE_SOLVED
897  * - \ref SCIP_STAGE_EXITSOLVE
898  * - \ref SCIP_STAGE_FREETRANS
899  */
901  SCIP* scip, /**< SCIP data structure */
902  SCIP_BENDERS* benders, /**< Benders' decomposition */
903  int probnumber /**< the subproblem number */
904  )
905 {
906  assert(scip != NULL);
907  assert(scip->set != NULL);
908  assert(benders != NULL);
909  assert(probnumber >= 0 && probnumber < SCIPgetBendersNSubproblems(scip, benders));
910 
911  SCIP_CALL( SCIPcheckStage(scip, "SCIPfreeBendersSubproblem", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
912 
913  SCIP_CALL( SCIPbendersFreeSubproblem(benders, scip->set, probnumber) );
914 
915  return SCIP_OKAY;
916 }
917 
918 /** checks the optimality of a Benders' decomposition subproblem by comparing the objective function value against the
919  * value of the corresponding auxiliary variable
920  *
921  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
922  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
923  *
924  * @pre This method can be called if SCIP is in one of the following stages:
925  * - \ref SCIP_STAGE_INITPRESOLVE
926  * - \ref SCIP_STAGE_PRESOLVING
927  * - \ref SCIP_STAGE_SOLVING
928  * - \ref SCIP_STAGE_SOLVED
929  *
930  * @pre This method can be called if requested subproblem is in one of the following stages:
931  * - \ref SCIP_STAGE_SOLVING
932  * - \ref SCIP_STAGE_SOLVED
933  */
935  SCIP* scip, /**< SCIP data structure */
936  SCIP_BENDERS* benders, /**< the benders' decomposition structure */
937  SCIP_SOL* sol, /**< primal CIP solution, can be NULL for the current LP solution */
938  int probnumber, /**< the number of the pricing problem */
939  SCIP_Bool* optimal /**< flag to indicate whether the current subproblem is optimal for the master */
940  )
941 {
942  assert(scip != NULL);
943  assert(benders != NULL);
944  assert(probnumber >= 0 && probnumber < SCIPbendersGetNSubproblems(benders));
945 
946  /* check stages for both, SCIP and the requested subproblem data structure */
947  SCIP_CALL( SCIPcheckStage(scip, "SCIPcheckBendersSubproblemOptimality", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
948  SCIP_CALL( SCIPcheckStage(SCIPbendersSubproblem(benders, probnumber), "SCIPcheckBendersSubproblemOptimality",
950 
951  SCIP_CALL( SCIPbendersCheckSubproblemOptimality(benders, scip->set, sol, probnumber, optimal) );
952 
953  return SCIP_OKAY;
954 }
955 
956 /** returns the value of the auxiliary variable for a given subproblem
957  *
958  * @return the value of the auxiliary variable for the given subproblem
959  */
961  SCIP* scip, /**< SCIP data structure */
962  SCIP_BENDERS* benders, /**< the benders' decomposition structure */
963  SCIP_SOL* sol, /**< primal CIP solution, can be NULL for the current LP solution */
964  int probnumber /**< the number of the pricing problem */
965  )
966 {
967  assert(scip != NULL);
968  assert(benders != NULL);
969  assert(probnumber >= 0 && probnumber < SCIPbendersGetNSubproblems(benders));
970 
971  return SCIPbendersGetAuxiliaryVarVal(benders, scip->set, sol, probnumber);
972 }
973 
974 /** solves an independent subproblem to identify its lower bound and updates the lower bound of the corresponding
975  * auxiliary variable
976  *
977  * @pre This method can be called if SCIP is in one of the following stages:
978  * - \ref SCIP_STAGE_INITPRESOLVE
979  * - \ref SCIP_STAGE_PRESOLVING
980  * - \ref SCIP_STAGE_EXITPRESOLVE
981  * - \ref SCIP_STAGE_PRESOLVED
982  * - \ref SCIP_STAGE_INITSOLVE
983  * - \ref SCIP_STAGE_SOLVING
984  *
985  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
986  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
987  */
989  SCIP* scip, /**< the SCIP data structure */
990  SCIP_BENDERS* benders, /**< Benders' decomposition */
991  int probnumber, /**< the subproblem to be evaluated */
992  SCIP_Real* lowerbound, /**< the lowerbound for the subproblem */
993  SCIP_Bool* infeasible /**< was the subproblem found to be infeasible? */
994  )
995 {
996  assert(scip != NULL);
997  assert(benders != NULL);
998  assert(probnumber >= 0 && probnumber < SCIPgetBendersNSubproblems(scip, benders));
999 
1000  SCIP_CALL( SCIPcheckStage(scip, "SCIPcomputeBendersSubproblemLowerbound", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1001 
1002  SCIP_CALL( SCIPbendersComputeSubproblemLowerbound(benders, scip->set, probnumber, lowerbound, infeasible) );
1003 
1004  return SCIP_OKAY;
1005 }
1006 
1007 /** Merges a subproblem into the master problem. This process just adds a copy of the subproblem variables and
1008  * constraints to the master problem, but keeps the subproblem stored in the Benders' decomposition data structure.
1009  * The reason for keeping the subproblem available is for when it is queried for solutions after the problem is solved.
1010  *
1011  * Once the subproblem is merged into the master problem, then the subproblem is flagged as disabled. This means that
1012  * it will not be solved in the subsequent subproblem solving loops.
1013  *
1014  * The associated auxiliary variables are kept in the master problem. The objective function of the merged subproblem
1015  * is added as an underestimator constraint.
1016  *
1017  * @pre This method can be called if SCIP is in one of the following stages:
1018  * - \ref SCIP_STAGE_INITPRESOLVE
1019  * - \ref SCIP_STAGE_PRESOLVING
1020  * - \ref SCIP_STAGE_EXITPRESOLVE
1021  * - \ref SCIP_STAGE_PRESOLVED
1022  * - \ref SCIP_STAGE_INITSOLVE
1023  * - \ref SCIP_STAGE_SOLVING
1024  *
1025  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1026  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1027  */
1029  SCIP* scip, /**< the SCIP data structure */
1030  SCIP_BENDERS* benders, /**< Benders' decomposition */
1031  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of subproblem variables corresponding
1032  * to the newly created master variables, or NULL */
1033  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of subproblem constraints to the
1034  corresponding newly created constraints, or NULL */
1035  int probnumber /**< the number of the subproblem that will be merged into the master problem*/
1036  )
1037 {
1038  assert(scip != NULL);
1039  assert(benders != NULL);
1040  assert(probnumber >= 0 && probnumber < SCIPgetBendersNSubproblems(scip, benders));
1041 
1042  SCIP_CALL( SCIPcheckStage(scip, "SCIPmergeBendersSubproblemIntoMaster", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1043 
1044  SCIP_CALL( SCIPbendersMergeSubproblemIntoMaster(benders, scip->set, varmap, consmap, probnumber) );
1045 
1046  return SCIP_OKAY;
1047 }
1048 
1049 /** creates a Benders' cut algorithms and includes it in the associated Benders' decomposition
1050  *
1051  * This should be called from the SCIPincludeBendersXyz for the associated Benders' decomposition. It is only possible
1052  * to include a Benders' cut algorithm if a Benders' decomposition has already been included
1053  * This should be done during the problem creation stage.
1054  *
1055  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1056  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1057  *
1058  * @pre This method can be called if SCIP is in one of the following stages:
1059  * - \ref SCIP_STAGE_INIT
1060  * - \ref SCIP_STAGE_PROBLEM
1061  *
1062  * @note method has all Benders' decomposition callbacks as arguments and is thus changed every time a new callback is
1063  * added in future releases; consider using SCIPincludeBendersBasic() and setter functions
1064  * if you seek for a method which is less likely to change in future releases
1065  */
1067  SCIP* scip, /**< SCIP data structure */
1068  SCIP_BENDERS* benders, /**< Benders' decomposition */
1069  const char* name, /**< name of Benders' decomposition cuts */
1070  const char* desc, /**< description of Benders' decomposition cuts */
1071  int priority, /**< priority of the Benders' decomposition cuts */
1072  SCIP_Bool islpcut, /**< indicates whether the cut is generated from the LP solution */
1073  SCIP_DECL_BENDERSCUTCOPY((*benderscutcopy)),/**< copy method of Benders' decomposition cuts or NULL if you don't want to copy your plugin into sub-SCIPs */
1074  SCIP_DECL_BENDERSCUTFREE((*benderscutfree)),/**< destructor of Benders' decomposition cuts */
1075  SCIP_DECL_BENDERSCUTINIT((*benderscutinit)),/**< initialize Benders' decomposition cuts */
1076  SCIP_DECL_BENDERSCUTEXIT((*benderscutexit)),/**< deinitialize Benders' decomposition cuts */
1077  SCIP_DECL_BENDERSCUTINITSOL((*benderscutinitsol)),/**< solving process initialization method of Benders' decomposition cuts */
1078  SCIP_DECL_BENDERSCUTEXITSOL((*benderscutexitsol)),/**< solving process deinitialization method of Benders' decomposition cuts */
1079  SCIP_DECL_BENDERSCUTEXEC((*benderscutexec)),/**< execution method of Benders' decomposition cuts */
1080  SCIP_BENDERSCUTDATA* benderscutdata /**< Benders' decomposition cuts data */
1081  )
1082 {
1083  SCIP_BENDERSCUT* benderscut;
1084 
1085  SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeBenderscut", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1086 
1087  /* check whether pricer is already present */
1088  if( SCIPfindBenderscut(benders, name) != NULL )
1089  {
1090  SCIPerrorMessage("benders <%s> already included.\n", name);
1091  return SCIP_INVALIDDATA;
1092  }
1093 
1094  SCIP_CALL( SCIPbenderscutCreate(benders, &benderscut, scip->set, scip->messagehdlr, scip->mem->setmem, name, desc, priority,
1095  islpcut, benderscutcopy, benderscutfree, benderscutinit, benderscutexit,
1096  benderscutinitsol, benderscutexitsol, benderscutexec, benderscutdata) );
1097  SCIP_CALL( SCIPbendersIncludeBenderscut(benders, scip->set, benderscut) );
1098 
1099  return SCIP_OKAY;
1100 }
1101 
1102 /** creates a Benders' cut and includes it an associated Benders' decomposition with all non-fundamental callbacks set to NULL
1103  *
1104  * If needed, the non-fundamental callbacks can be added afterwards via setter functions SCIPsetBenderscutCopy(),
1105  * SCIPsetBenderscutFree(), SCIPsetBenderscutInit(), SCIPsetBenderscutExit(), SCIPsetBenderscutInitsol(),
1106  * SCIPsetBenderscutExitsol().
1107  *
1108  * This should be done during the problem creation stage.
1109  *
1110  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1111  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1112  *
1113  * @pre This method can be called if SCIP is in one of the following stages:
1114  * - \ref SCIP_STAGE_INIT
1115  * - \ref SCIP_STAGE_PROBLEM
1116  *
1117  * @note if you want to set all callbacks with a single method call, consider using SCIPincludeBenders() instead
1118  */
1120  SCIP* scip, /**< SCIP data structure */
1121  SCIP_BENDERS* benders, /**< Benders' decomposition */
1122  SCIP_BENDERSCUT** benderscutptr, /**< reference to a Benders' decomposition cut, or NULL */
1123  const char* name, /**< name of Benders' decomposition */
1124  const char* desc, /**< description of Benders' decomposition */
1125  int priority, /**< priority of the Benders' decomposition */
1126  SCIP_Bool islpcut, /**< indicates whether the cut is generated from the LP solution */
1127  SCIP_DECL_BENDERSCUTEXEC((*benderscutexec)),/**< the execution method of the Benders' cut algorithm */
1128  SCIP_BENDERSCUTDATA* benderscutdata /**< Benders' cut data */
1129  )
1130 {
1131  SCIP_BENDERSCUT* benderscut;
1132 
1133  SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeBenderscutBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1134 
1135  /* check whether Benders' decomposition cut is already present */
1136  if( SCIPfindBenderscut(benders, name) != NULL )
1137  {
1138  SCIPerrorMessage("Benders' cut <%s> already included.\n", name);
1139  return SCIP_INVALIDDATA;
1140  }
1141 
1142  SCIP_CALL( SCIPbenderscutCreate(benders, &benderscut, scip->set, scip->messagehdlr, scip->mem->setmem, name, desc,
1143  priority, islpcut, NULL, NULL, NULL, NULL, NULL, NULL, benderscutexec, benderscutdata) );
1144  SCIP_CALL( SCIPbendersIncludeBenderscut(benders, scip->set, benderscut) );
1145 
1146  if( benderscutptr != NULL )
1147  *benderscutptr = benderscut;
1148 
1149  return SCIP_OKAY;
1150 }
1151 
1152 /** sets copy method of Benders' decomposition cut
1153  *
1154  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1155  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1156  *
1157  * @pre This method can be called if SCIP is in one of the following stages:
1158  * - \ref SCIP_STAGE_INIT
1159  * - \ref SCIP_STAGE_PROBLEM
1160  */
1162  SCIP* scip, /**< SCIP data structure */
1163  SCIP_BENDERSCUT* benderscut, /**< Benders' decomposition cut */
1164  SCIP_DECL_BENDERSCUTCOPY((*benderscutcopy))/**< copy method of benderscut or NULL if you don't want to copy your plugin into sub-SCIPs */
1165  )
1166 {
1167  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBenderscutCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1168 
1169  assert(benderscut != NULL);
1170 
1171  SCIPbenderscutSetCopy(benderscut, benderscutcopy);
1172 
1173  return SCIP_OKAY;
1174 }
1175 
1176 /** sets destructor method of benderscut
1177  *
1178  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1179  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1180  *
1181  * @pre This method can be called if SCIP is in one of the following stages:
1182  * - \ref SCIP_STAGE_INIT
1183  * - \ref SCIP_STAGE_PROBLEM
1184  */
1186  SCIP* scip, /**< SCIP data structure */
1187  SCIP_BENDERSCUT* benderscut, /**< benderscut */
1188  SCIP_DECL_BENDERSCUTFREE((*benderscutfree))/**< destructor of benderscut */
1189  )
1190 {
1191  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBenderscutFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1192 
1193  assert(benderscut != NULL);
1194 
1195  SCIPbenderscutSetFree(benderscut, benderscutfree);
1196 
1197  return SCIP_OKAY;
1198 }
1199 
1200 /** sets initialization method of benderscut
1201  *
1202  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1203  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1204  *
1205  * @pre This method can be called if SCIP is in one of the following stages:
1206  * - \ref SCIP_STAGE_INIT
1207  * - \ref SCIP_STAGE_PROBLEM
1208  */
1210  SCIP* scip, /**< SCIP data structure */
1211  SCIP_BENDERSCUT* benderscut, /**< benderscut */
1212  SCIP_DECL_BENDERSCUTINIT((*benderscutinit))/**< initialize benderscut */
1213  )
1214 {
1215  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBenderscutInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1216 
1217  assert(benderscut != NULL);
1218 
1219  SCIPbenderscutSetInit(benderscut, benderscutinit);
1220 
1221  return SCIP_OKAY;
1222 }
1223 
1224 /** sets deinitialization method of benderscut
1225  *
1226  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1227  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1228  *
1229  * @pre This method can be called if SCIP is in one of the following stages:
1230  * - \ref SCIP_STAGE_INIT
1231  * - \ref SCIP_STAGE_PROBLEM
1232  */
1234  SCIP* scip, /**< SCIP data structure */
1235  SCIP_BENDERSCUT* benderscut, /**< benderscut */
1236  SCIP_DECL_BENDERSCUTEXIT((*benderscutexit))/**< deinitialize benderscut */
1237  )
1238 {
1239  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBenderscutExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1240 
1241  assert(benderscut != NULL);
1242 
1243  SCIPbenderscutSetExit(benderscut, benderscutexit);
1244 
1245  return SCIP_OKAY;
1246 }
1247 
1248 /** sets solving process initialization method of benderscut
1249  *
1250  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1251  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1252  *
1253  * @pre This method can be called if SCIP is in one of the following stages:
1254  * - \ref SCIP_STAGE_INIT
1255  * - \ref SCIP_STAGE_PROBLEM
1256  */
1258  SCIP* scip, /**< SCIP data structure */
1259  SCIP_BENDERSCUT* benderscut, /**< benderscut */
1260  SCIP_DECL_BENDERSCUTINITSOL((*benderscutinitsol))/**< solving process initialization method of benderscut */
1261  )
1262 {
1263  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBenderscutInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1264 
1265  assert(benderscut != NULL);
1266 
1267  SCIPbenderscutSetInitsol(benderscut, benderscutinitsol);
1268 
1269  return SCIP_OKAY;
1270 }
1271 
1272 /** sets solving process deinitialization method of benderscut
1273  *
1274  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1275  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1276  *
1277  * @pre This method can be called if SCIP is in one of the following stages:
1278  * - \ref SCIP_STAGE_INIT
1279  * - \ref SCIP_STAGE_PROBLEM
1280  */
1282  SCIP* scip, /**< SCIP data structure */
1283  SCIP_BENDERSCUT* benderscut, /**< benderscut */
1284  SCIP_DECL_BENDERSCUTEXITSOL((*benderscutexitsol))/**< solving process deinitialization method of benderscut */
1285  )
1286 {
1287  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBenderscutExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1288 
1289  assert(benderscut != NULL);
1290 
1291  SCIPbenderscutSetExitsol(benderscut, benderscutexitsol);
1292 
1293  return SCIP_OKAY;
1294 }
1295 
1296 /** sets the priority of a Benders' decomposition cut algorithm
1297  *
1298  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1299  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1300  *
1301  * @pre This method can be called if SCIP is in one of the following stages:
1302  * - \ref SCIP_STAGE_INIT
1303  * - \ref SCIP_STAGE_PROBLEM
1304  */
1306  SCIP* scip, /**< SCIP data structure */
1307  SCIP_BENDERSCUT* benderscut, /**< benderscut */
1308  int priority /**< new priority of the Benders' decomposition */
1309  )
1310 {
1311  SCIP_BENDERS** benders;
1312  int nbenders;
1313  int i;
1314 
1315  assert(scip != NULL);
1316  assert(scip->set != NULL);
1317  assert(benderscut != NULL);
1318 
1319  SCIP_CALL( SCIPcheckStage(scip, "SCIPsetBenderscutPriority", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
1320 
1321  SCIPbenderscutSetPriority(benderscut, priority);
1322 
1323  /* DIRTY: This is not a good fix */
1324  /* Changing the priority of one Benders' cut in a Benders' decomposition requires all Benders' cuts to be set to
1325  * unsorted. This is a fix that is not very nice, but it does the job */
1326  benders = SCIPgetBenders(scip);
1327  nbenders = SCIPgetNBenders(scip);
1328  for( i = 0; i < nbenders; i++ )
1330 
1331  return SCIP_OKAY;
1332 }
1333 
1334 /** adds the generated constraint to the Benders' decomposition cut storage
1335  *
1336  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1337  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1338  *
1339  * @pre This method can be called if SCIP is in one of the following stages:
1340  * - \ref SCIP_STAGE_INITPRESOLVE
1341  * - \ref SCIP_STAGE_PRESOLVING
1342  * - \ref SCIP_STAGE_EXITPRESOLVE
1343  * - \ref SCIP_STAGE_PRESOLVED
1344  * - \ref SCIP_STAGE_INITSOLVE
1345  * - \ref SCIP_STAGE_SOLVING
1346  */
1348  SCIP* scip, /**< the SCIP data structure */
1349  SCIP_BENDERSCUT* benderscut, /**< Benders' decomposition cuts */
1350  SCIP_CONS* cons /**< the constraint to be added to the Benders' cut storage */
1351  )
1352 {
1353  assert(scip != NULL);
1354  assert(benderscut != NULL);
1355  assert(cons != NULL);
1356 
1357  SCIP_CALL( SCIPcheckStage(scip, "SCIPstoreBenderscutCons", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1358 
1359  SCIP_CALL( SCIPbenderscutStoreCons(benderscut, scip->set, cons) );
1360 
1361  /* capturing the stored constraint */
1362  SCIP_CALL( SCIPcaptureCons(scip, cons) );
1363 
1364  return SCIP_OKAY;
1365 }
1366 
1367 /** adds the generated cuts to the Benders' cut storage
1368  *
1369  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1370  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1371  *
1372  * @pre This method can be called if SCIP is in one of the following stages:
1373  * - \ref SCIP_STAGE_INITPRESOLVE
1374  * - \ref SCIP_STAGE_PRESOLVING
1375  * - \ref SCIP_STAGE_EXITPRESOLVE
1376  * - \ref SCIP_STAGE_PRESOLVED
1377  * - \ref SCIP_STAGE_INITSOLVE
1378  * - \ref SCIP_STAGE_SOLVING
1379  */
1381  SCIP* scip, /**< the SCIP data structure */
1382  SCIP_BENDERSCUT* benderscut, /**< Benders' decomposition cuts */
1383  SCIP_ROW* cut /**< the cut to be added to the Benders' cut storage */
1384  )
1385 {
1386  assert(scip != NULL);
1387  assert(benderscut != NULL);
1388  assert(cut != NULL);
1389 
1390  SCIP_CALL( SCIPcheckStage(scip, "SCIPstoreBenderscutCut", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
1391 
1392  SCIP_CALL( SCIPbenderscutStoreCut(benderscut, scip->set, cut) );
1393 
1394  /* capturing the row */
1395  SCIP_CALL( SCIPcaptureRow(scip, cut) );
1396 
1397  return SCIP_OKAY;
1398 }
SCIP_RETCODE SCIPstoreBenderscutCut(SCIP *scip, SCIP_BENDERSCUT *benderscut, SCIP_ROW *cut)
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
SCIP_RETCODE SCIPsetBendersPresubsolve(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSPRESUBSOLVE((*benderspresubsolve)))
Definition: scip_benders.c:456
internal methods for separators
SCIP_RETCODE SCIPsetBendersSolveAndFreesub(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSSOLVESUBCONVEX((*benderssolvesubconvex)), SCIP_DECL_BENDERSSOLVESUB((*benderssolvesub)), SCIP_DECL_BENDERSFREESUB((*bendersfreesub)))
Definition: scip_benders.c:480
#define SCIP_DECL_BENDERSCREATESUB(x)
Definition: type_benders.h:170
#define NULL
Definition: def.h:239
internal methods for managing events
default message handler
SCIP_RETCODE SCIPincludeBenderscutBasic(SCIP *scip, SCIP_BENDERS *benders, SCIP_BENDERSCUT **benderscutptr, const char *name, const char *desc, int priority, SCIP_Bool islpcut, SCIP_DECL_BENDERSCUTEXEC((*benderscutexec)), SCIP_BENDERSCUTDATA *benderscutdata)
SCIP_RETCODE SCIPmergeBendersSubproblemIntoMaster(SCIP *scip, SCIP_BENDERS *benders, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, int probnumber)
SCIP_RETCODE SCIPbendersIncludeBenderscut(SCIP_BENDERS *benders, SCIP_SET *set, SCIP_BENDERSCUT *benderscut)
Definition: benders.c:4775
SCIP_RETCODE SCIPfreeBendersSubproblem(SCIP *scip, SCIP_BENDERS *benders, int probnumber)
Definition: scip_benders.c:900
trivialnegation primal heuristic
internal methods for storing primal CIP solutions
void SCIPbendersDeactivate(SCIP_BENDERS *benders, SCIP_SET *set)
Definition: benders.c:1891
void SCIPsetBendersPriority(SCIP *scip, SCIP_BENDERS *benders, int priority)
Definition: scip_benders.c:633
methods to interpret (evaluate) an expression tree "fast"
internal methods for branch and bound tree
struct SCIP_BenderscutData SCIP_BENDERSCUTDATA
#define SCIP_DECL_BENDERSINITSOL(x)
Definition: type_benders.h:130
SCIP_RETCODE SCIPbendersSetupSubproblem(SCIP_BENDERS *benders, SCIP_SET *set, SCIP_SOL *sol, int probnumber)
Definition: benders.c:3118
SCIP_RETCODE SCIPbenderscutStoreCut(SCIP_BENDERSCUT *benderscut, SCIP_SET *set, SCIP_ROW *cut)
Definition: benderscut.c:646
#define SCIP_DECL_BENDERSFREE(x)
Definition: type_benders.h:82
SCIP_RETCODE SCIPgetBendersMasterVar(SCIP *scip, SCIP_BENDERS *benders, SCIP_VAR *var, SCIP_VAR **mappedvar)
Definition: scip_benders.c:703
methods for implications, variable bounds, and cliques
const char * SCIPbendersGetName(SCIP_BENDERS *benders)
Definition: benders.c:4194
void SCIPbenderscutSetPriority(SCIP_BENDERSCUT *benderscut, int priority)
Definition: benderscut.c:519
internal methods for clocks and timing issues
#define SCIP_DECL_BENDERSINITPRE(x)
Definition: type_benders.h:111
#define SCIP_DECL_BENDERSCUTFREE(x)
void SCIPbendersSetSolvesub(SCIP_BENDERS *benders, SCIP_DECL_BENDERSSOLVESUB((*benderssolvesub)))
Definition: benders.c:4161
internal methods for NLPI solver interfaces
SCIP_RETCODE SCIPsetBendersExitsol(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSEXITSOL((*bendersexitsol)))
Definition: scip_benders.c:432
void SCIPbenderscutSetInitsol(SCIP_BENDERSCUT *benderscut, SCIP_DECL_BENDERSCUTINITSOL((*benderscutinitsol)))
Definition: benderscut.c:467
interface methods for specific LP solvers
internal methods for displaying statistics tables
#define SCIP_DECL_BENDERSGETVAR(x)
Definition: type_benders.h:339
#define FALSE
Definition: def.h:65
SCIP_RETCODE SCIPsetBendersInit(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSINIT((*bendersinit)))
Definition: scip_benders.c:312
public methods for Benders&#39; decomposition
methods for the aggregation rows
internal methods for Benders&#39; decomposition
#define TRUE
Definition: def.h:64
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
enum SCIP_BendersEnfoType SCIP_BENDERSENFOTYPE
Definition: type_benders.h:42
methods commonly used by primal heuristics
SCIP_RETCODE SCIPincludeBenderscut(SCIP *scip, SCIP_BENDERS *benders, const char *name, const char *desc, int priority, SCIP_Bool islpcut, SCIP_DECL_BENDERSCUTCOPY((*benderscutcopy)), SCIP_DECL_BENDERSCUTFREE((*benderscutfree)), SCIP_DECL_BENDERSCUTINIT((*benderscutinit)), SCIP_DECL_BENDERSCUTEXIT((*benderscutexit)), SCIP_DECL_BENDERSCUTINITSOL((*benderscutinitsol)), SCIP_DECL_BENDERSCUTEXITSOL((*benderscutexitsol)), SCIP_DECL_BENDERSCUTEXEC((*benderscutexec)), SCIP_BENDERSCUTDATA *benderscutdata)
internal methods for branching rules and branching candidate storage
SCIP_Real SCIPgetBendersAuxiliaryVarVal(SCIP *scip, SCIP_BENDERS *benders, SCIP_SOL *sol, int probnumber)
Definition: scip_benders.c:960
datastructures for concurrent solvers
void SCIPbendersSetFree(SCIP_BENDERS *benders, SCIP_DECL_BENDERSFREE((*bendersfree)))
Definition: benders.c:4062
#define SCIP_DECL_BENDERSINIT(x)
Definition: type_benders.h:91
void SCIPbendersSetExitpre(SCIP_BENDERS *benders, SCIP_DECL_BENDERSEXITPRE((*bendersexitpre)))
Definition: benders.c:4106
#define SCIP_DECL_BENDERSCUTEXEC(x)
SCIP_RETCODE SCIPbenderscutStoreCons(SCIP_BENDERSCUT *benderscut, SCIP_SET *set, SCIP_CONS *cons)
Definition: benderscut.c:616
internal methods for handling parameter settings
methods for creating output for visualization tools (VBC, BAK)
nodereopt branching rule
SCIP_RETCODE SCIPbendersCheckSubproblemOptimality(SCIP_BENDERS *benders, SCIP_SET *set, SCIP_SOL *sol, int probnumber, SCIP_Bool *optimal)
Definition: benders.c:3655
void SCIPbendersSetInit(SCIP_BENDERS *benders, SCIP_DECL_BENDERSINIT((*bendersinit)))
Definition: benders.c:4073
void SCIPbendersSetExit(SCIP_BENDERS *benders, SCIP_DECL_BENDERSEXIT((*bendersexit)))
Definition: benders.c:4084
int nactivebenders
Definition: struct_set.h:137
#define SCIP_DECL_BENDERSCUTCOPY(x)
SCIP_RETCODE SCIPgetBendersSubproblemVar(SCIP *scip, SCIP_BENDERS *benders, SCIP_VAR *var, SCIP_VAR **mappedvar, int probnumber)
Definition: scip_benders.c:739
void SCIPbendersSetPostsolve(SCIP_BENDERS *benders, SCIP_DECL_BENDERSPOSTSOLVE((*benderspostsolve)))
Definition: benders.c:4172
internal methods for LP management
internal methods for branching and inference history
#define SCIP_DECL_BENDERSCUTINIT(x)
SCIP_RETCODE SCIPsetIncludeBenders(SCIP_SET *set, SCIP_BENDERS *benders)
Definition: set.c:3668
internal methods for collecting primal CIP solutions and primal informations
int SCIPgetNActiveBenders(SCIP *scip)
Definition: scip_benders.c:575
void SCIPbendersSetFreesub(SCIP_BENDERS *benders, SCIP_DECL_BENDERSFREESUB((*bendersfreesub)))
Definition: benders.c:4183
internal methods for propagators
SCIP_RETCODE SCIPsetBendersExit(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSEXIT((*bendersexit)))
Definition: scip_benders.c:336
SCIP_RETCODE SCIPbendersAddSubproblem(SCIP_BENDERS *benders, SCIP *subproblem)
Definition: benders.c:4362
void SCIPbenderscutSetExit(SCIP_BENDERSCUT *benderscut, SCIP_DECL_BENDERSCUTEXIT((*benderscutexit)))
Definition: benderscut.c:456
SCIP_RETCODE SCIPcomputeBendersSubproblemLowerbound(SCIP *scip, SCIP_BENDERS *benders, int probnumber, SCIP_Real *lowerbound, SCIP_Bool *infeasible)
Definition: scip_benders.c:988
#define SCIP_DECL_BENDERSFREESUB(x)
Definition: type_benders.h:323
SCIP_MEM * mem
Definition: struct_scip.h:61
void SCIPbendersSetSolvesubconvex(SCIP_BENDERS *benders, SCIP_DECL_BENDERSSOLVESUBCONVEX((*benderssolvesubconvex)))
Definition: benders.c:4150
SCIP_RETCODE SCIPincludeBenders(SCIP *scip, const char *name, const char *desc, int priority, SCIP_Bool cutlp, SCIP_Bool cutpseudo, SCIP_Bool cutrelax, SCIP_Bool shareauxvars, SCIP_DECL_BENDERSCOPY((*benderscopy)), SCIP_DECL_BENDERSFREE((*bendersfree)), SCIP_DECL_BENDERSINIT((*bendersinit)), SCIP_DECL_BENDERSEXIT((*bendersexit)), SCIP_DECL_BENDERSINITPRE((*bendersinitpre)), SCIP_DECL_BENDERSEXITPRE((*bendersexitpre)), SCIP_DECL_BENDERSINITSOL((*bendersinitsol)), SCIP_DECL_BENDERSEXITSOL((*bendersexitsol)), SCIP_DECL_BENDERSGETVAR((*bendersgetvar)), SCIP_DECL_BENDERSCREATESUB((*benderscreatesub)), SCIP_DECL_BENDERSPRESUBSOLVE((*benderspresubsolve)), SCIP_DECL_BENDERSSOLVESUBCONVEX((*benderssolvesubconvex)), SCIP_DECL_BENDERSSOLVESUB((*benderssolvesub)), SCIP_DECL_BENDERSPOSTSOLVE((*benderspostsolve)), SCIP_DECL_BENDERSFREESUB((*bendersfreesub)), SCIP_BENDERSDATA *bendersdata)
Definition: scip_benders.c:143
git hash methods
public methods for Benders decomposition
internal methods for storing and manipulating the main problem
SCIP_RETCODE SCIPbendersFreeSubproblem(SCIP_BENDERS *benders, SCIP_SET *set, int probnumber)
Definition: benders.c:3605
#define SCIPerrorMessage
Definition: pub_message.h:45
SCIP_RETCODE SCIPsetupBendersSubproblem(SCIP *scip, SCIP_BENDERS *benders, SCIP_SOL *sol, int probnumber)
Definition: scip_benders.c:819
methods for block memory pools and memory buffers
#define SCIP_DECL_BENDERSEXIT(x)
Definition: type_benders.h:100
#define SCIP_DECL_BENDERSSOLVESUB(x)
Definition: type_benders.h:265
void SCIPbendersSetExitsol(SCIP_BENDERS *benders, SCIP_DECL_BENDERSEXITSOL((*bendersexitsol)))
Definition: benders.c:4128
register additional core functionality that is designed as plugins
SCIP_RETCODE SCIPcheckStage(SCIP *scip, const char *method, SCIP_Bool init, SCIP_Bool problem, SCIP_Bool transforming, SCIP_Bool transformed, SCIP_Bool initpresolve, SCIP_Bool presolving, SCIP_Bool exitpresolve, SCIP_Bool presolved, SCIP_Bool initsolve, SCIP_Bool solving, SCIP_Bool solved, SCIP_Bool exitsolve, SCIP_Bool freetrans, SCIP_Bool freescip)
Definition: debug.c:1933
void SCIPbendersSetPriority(SCIP_BENDERS *benders, SCIP_SET *set, int priority)
Definition: benders.c:4224
int nbenders
Definition: struct_set.h:136
internal methods for presolvers
SCIP_RETCODE SCIPbendersSolveSubproblem(SCIP_BENDERS *benders, SCIP_SET *set, SCIP_SOL *sol, int probnumber, SCIP_Bool *infeasible, SCIP_BENDERSENFOTYPE type, SCIP_Bool solvecip, SCIP_Real *objective)
Definition: benders.c:3217
SCIP_RETCODE SCIPincludeBendersBasic(SCIP *scip, SCIP_BENDERS **bendersptr, const char *name, const char *desc, int priority, SCIP_Bool cutlp, SCIP_Bool cutpseudo, SCIP_Bool cutrelax, SCIP_Bool shareauxvars, SCIP_DECL_BENDERSGETVAR((*bendersgetvar)), SCIP_DECL_BENDERSCREATESUB((*benderscreatesub)), SCIP_BENDERSDATA *bendersdata)
Definition: scip_benders.c:218
internal methods for NLP management
internal miscellaneous methods
SCIP_BENDERSCUT * SCIPfindBenderscut(SCIP_BENDERS *benders, const char *name)
Definition: benders.c:4799
#define SCIP_DECL_BENDERSCUTEXIT(x)
struct SCIP_BendersData SCIP_BENDERSDATA
Definition: type_benders.h:63
internal methods for node selectors and node priority queues
internal methods for variable pricers
internal methods for global SCIP settings
internal methods for storing conflicts
#define SCIP_CALL(x)
Definition: def.h:351
SCIP main data structure.
SCIP_RETCODE SCIPsetBenderscutExit(SCIP *scip, SCIP_BENDERSCUT *benderscut, SCIP_DECL_BENDERSCUTEXIT((*benderscutexit)))
#define SCIP_DECL_BENDERSSOLVESUBCONVEX(x)
Definition: type_benders.h:232
BMS_BLKMEM * setmem
Definition: struct_mem.h:39
void SCIPbenderscutSetExitsol(SCIP_BENDERSCUT *benderscut, SCIP_DECL_BENDERSCUTEXITSOL((*benderscutexitsol)))
Definition: benderscut.c:478
SCIP_RETCODE SCIPbendersExec(SCIP_BENDERS *benders, SCIP_SET *set, SCIP_SOL *sol, SCIP_RESULT *result, SCIP_Bool *infeasible, SCIP_Bool *auxviol, SCIP_BENDERSENFOTYPE type, SCIP_Bool checkint)
Definition: benders.c:2505
internal methods for storing priced variables
internal methods for relaxators
SCIP_RETCODE SCIPcaptureCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip_cons.c:1152
void SCIPbendersSetInitsol(SCIP_BENDERS *benders, SCIP_DECL_BENDERSINITSOL((*bendersinitsol)))
Definition: benders.c:4117
internal methods for storing separated cuts
SCIP_RETCODE SCIPbendersCreate(SCIP_BENDERS **benders, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int priority, SCIP_Bool cutlp, SCIP_Bool cutpseudo, SCIP_Bool cutrelax, SCIP_Bool shareauxvars, SCIP_DECL_BENDERSCOPY((*benderscopy)), SCIP_DECL_BENDERSFREE((*bendersfree)), SCIP_DECL_BENDERSINIT((*bendersinit)), SCIP_DECL_BENDERSEXIT((*bendersexit)), SCIP_DECL_BENDERSINITPRE((*bendersinitpre)), SCIP_DECL_BENDERSEXITPRE((*bendersexitpre)), SCIP_DECL_BENDERSINITSOL((*bendersinitsol)), SCIP_DECL_BENDERSEXITSOL((*bendersexitsol)), SCIP_DECL_BENDERSGETVAR((*bendersgetvar)), SCIP_DECL_BENDERSCREATESUB((*benderscreatesub)), SCIP_DECL_BENDERSPRESUBSOLVE((*benderspresubsolve)), SCIP_DECL_BENDERSSOLVESUBCONVEX((*benderssolvesubconvex)), SCIP_DECL_BENDERSSOLVESUB((*benderssolvesub)), SCIP_DECL_BENDERSPOSTSOLVE((*benderspostsolve)), SCIP_DECL_BENDERSFREESUB((*bendersfreesub)), SCIP_BENDERSDATA *bendersdata)
Definition: benders.c:835
SCIP_RETCODE SCIPsetBenderscutPriority(SCIP *scip, SCIP_BENDERSCUT *benderscut, int priority)
public methods for constraint handler plugins and constraints
methods commonly used for presolving
methods for catching the user CTRL-C interrupt
internal methods for problem variables
data structures and methods for collecting reoptimization information
the function declarations for the synchronization store
#define SCIP_DECL_BENDERSCOPY(x)
Definition: type_benders.h:74
void SCIPsetSortBenders(SCIP_SET *set)
Definition: set.c:3711
SCIP_BENDERS * SCIPfindBenders(SCIP *scip, const char *name)
Definition: scip_benders.c:536
void SCIPbendersSetPresubsolve(SCIP_BENDERS *benders, SCIP_DECL_BENDERSPRESUBSOLVE((*benderspresubsolve)))
Definition: benders.c:4139
internal methods for user interface dialog
#define SCIP_Bool
Definition: def.h:62
SCIP_RETCODE SCIPbendersComputeSubproblemLowerbound(SCIP_BENDERS *benders, SCIP_SET *set, int probnumber, SCIP_Real *lowerbound, SCIP_Bool *infeasible)
Definition: benders.c:3708
void SCIPbenderscutSetFree(SCIP_BENDERSCUT *benderscut, SCIP_DECL_BENDERSCUTFREE((*benderscutfree)))
Definition: benderscut.c:434
SCIP_BENDERS ** SCIPgetBenders(SCIP *scip)
Definition: scip_benders.c:551
internal methods for input file readers
SCIP_RETCODE SCIPcaptureRow(SCIP *scip, SCIP_ROW *row)
Definition: scip_lp.c:1452
void SCIPbendersSetInitpre(SCIP_BENDERS *benders, SCIP_DECL_BENDERSINITPRE((*bendersinitpre)))
Definition: benders.c:4095
methods for debugging
SCIP_BENDERS ** benders
Definition: struct_set.h:92
SCIP_RETCODE SCIPstoreBenderscutCons(SCIP *scip, SCIP_BENDERSCUT *benderscut, SCIP_CONS *cons)
SCIP_RETCODE SCIPsetBendersCopy(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSCOPY((*benderscopy)))
Definition: scip_benders.c:264
SCIP_RETCODE SCIPbendersMergeSubproblemIntoMaster(SCIP_BENDERS *benders, SCIP_SET *set, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, int probnumber)
Definition: benders.c:3821
SCIP * SCIPbendersSubproblem(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:4248
SCIP_RETCODE SCIPdeactivateBenders(SCIP *scip, SCIP_BENDERS *benders)
Definition: scip_benders.c:620
reoptsols primal heuristic
SCIP_Real SCIPbendersGetAuxiliaryVarVal(SCIP_BENDERS *benders, SCIP_SET *set, SCIP_SOL *sol, int probnumber)
Definition: benders.c:3687
internal methods for storing cuts in a cut pool
SCIP_RETCODE SCIPaddBendersSubproblem(SCIP *scip, SCIP_BENDERS *benders, SCIP *subproblem)
Definition: scip_benders.c:784
Constraint handler for linear constraints in their most general form, .
SCIP_RETCODE SCIPbendersActivate(SCIP_BENDERS *benders, SCIP_SET *set, int nsubproblems)
Definition: benders.c:1828
SCIP_RETCODE SCIPcheckBendersSubproblemOptimality(SCIP *scip, SCIP_BENDERS *benders, SCIP_SOL *sol, int probnumber, SCIP_Bool *optimal)
Definition: scip_benders.c:934
int SCIPbendersGetNSubproblems(SCIP_BENDERS *benders)
Definition: benders.c:4238
int SCIPgetNBenders(SCIP *scip)
Definition: scip_benders.c:564
void SCIPbenderscutSetInit(SCIP_BENDERSCUT *benderscut, SCIP_DECL_BENDERSCUTINIT((*benderscutinit)))
Definition: benderscut.c:445
SCIP_RETCODE SCIPbendersGetVar(SCIP_BENDERS *benders, SCIP_SET *set, SCIP_VAR *var, SCIP_VAR **mappedvar, int probnumber)
Definition: benders.c:4004
helper functions for concurrent scip solvers
public methods for the LP relaxation, rows and columns
SCIP_RETCODE SCIPsetBendersPostsolve(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSPOSTSOLVE((*benderspostsolve)))
Definition: scip_benders.c:520
internal methods for return codes for SCIP methods
SCIP_RETCODE SCIPsetBenderscutInit(SCIP *scip, SCIP_BENDERSCUT *benderscut, SCIP_DECL_BENDERSCUTINIT((*benderscutinit)))
SCIP_RETCODE SCIPsolveBendersSubproblem(SCIP *scip, SCIP_BENDERS *benders, SCIP_SOL *sol, int probnumber, SCIP_Bool *infeasible, SCIP_BENDERSENFOTYPE type, SCIP_Bool solvecip, SCIP_Real *objective)
Definition: scip_benders.c:856
SCIP_RETCODE SCIPsetBendersInitsol(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSINITSOL((*bendersinitsol)))
Definition: scip_benders.c:408
SCIP_RETCODE SCIPsetBenderscutInitsol(SCIP *scip, SCIP_BENDERSCUT *benderscut, SCIP_DECL_BENDERSCUTINITSOL((*benderscutinitsol)))
SCIP_RETCODE SCIPsetBenderscutCopy(SCIP *scip, SCIP_BENDERSCUT *benderscut, SCIP_DECL_BENDERSCUTCOPY((*benderscutcopy)))
internal methods for conflict analysis
SCIP_BENDERS * SCIPsetFindBenders(SCIP_SET *set, const char *name)
Definition: set.c:3691
internal methods for tree compressions
internal methods for main solving loop and node processing
#define SCIP_DECL_BENDERSEXITSOL(x)
Definition: type_benders.h:141
void SCIPbendersSetBenderscutsSorted(SCIP_BENDERS *benders, SCIP_Bool sorted)
Definition: benders.c:4763
SCIP_RETCODE SCIPsetBenderscutExitsol(SCIP *scip, SCIP_BENDERSCUT *benderscut, SCIP_DECL_BENDERSCUTEXITSOL((*benderscutexitsol)))
SCIP_SET * set
Definition: struct_scip.h:62
public methods for message output
SCIP_RETCODE SCIPsetBendersFree(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSFREE((*bendersfree)))
Definition: scip_benders.c:288
SCIP_MESSAGEHDLR * messagehdlr
Definition: struct_scip.h:65
default user interface dialog
#define SCIP_Real
Definition: def.h:150
internal methods for problem statistics
#define SCIP_DECL_BENDERSCUTEXITSOL(x)
internal methods for constraints and constraint handlers
SCIP_RETCODE SCIPsetBenderscutFree(SCIP *scip, SCIP_BENDERSCUT *benderscut, SCIP_DECL_BENDERSCUTFREE((*benderscutfree)))
int SCIPgetBendersNSubproblems(SCIP *scip, SCIP_BENDERS *benders)
Definition: scip_benders.c:765
declarations for XML parsing
#define SCIP_DECL_BENDERSPOSTSOLVE(x)
Definition: type_benders.h:301
void SCIPbendersSetCopy(SCIP_BENDERS *benders, SCIP_DECL_BENDERSCOPY((*benderscopy)))
Definition: benders.c:4051
build flags methods
#define SCIP_DECL_BENDERSEXITPRE(x)
Definition: type_benders.h:119
common defines and data types used in all packages of SCIP
SCIP_RETCODE SCIPactivateBenders(SCIP *scip, SCIP_BENDERS *benders, int nsubproblems)
Definition: scip_benders.c:598
SCIP_RETCODE SCIPbenderscutCreate(SCIP_BENDERS *benders, SCIP_BENDERSCUT **benderscut, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int priority, SCIP_Bool islpcut, SCIP_DECL_BENDERSCUTCOPY((*benderscutcopy)), SCIP_DECL_BENDERSCUTFREE((*benderscutfree)), SCIP_DECL_BENDERSCUTINIT((*benderscutinit)), SCIP_DECL_BENDERSCUTEXIT((*benderscutexit)), SCIP_DECL_BENDERSCUTINITSOL((*benderscutinitsol)), SCIP_DECL_BENDERSCUTEXITSOL((*benderscutexitsol)), SCIP_DECL_BENDERSCUTEXEC((*benderscutexec)), SCIP_BENDERSCUTDATA *benderscutdata)
Definition: benderscut.c:98
void SCIPbenderscutSetCopy(SCIP_BENDERSCUT *benderscut, SCIP_DECL_BENDERSCUTCOPY((*benderscutcopy)))
Definition: benderscut.c:423
internal methods for primal heuristics
SCIP_RETCODE SCIPsetBendersExitpre(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSEXITPRE((*bendersexitpre)))
Definition: scip_benders.c:384
SCIP_RETCODE SCIPsolveBendersSubproblems(SCIP *scip, SCIP_BENDERS *benders, SCIP_SOL *sol, SCIP_RESULT *result, SCIP_Bool *infeasible, SCIP_Bool *auxviol, SCIP_BENDERSENFOTYPE type, SCIP_Bool checkint)
Definition: scip_benders.c:665
SCIP_RETCODE SCIPsetBendersInitpre(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSINITPRE((*bendersinitpre)))
Definition: scip_benders.c:360
internal methods for Benders&#39; decomposition cuts
#define SCIP_DECL_BENDERSCUTINITSOL(x)
#define SCIP_DECL_BENDERSPRESUBSOLVE(x)
Definition: type_benders.h:192
internal methods for displaying runtime statistics
OFINS - Objective Function Induced Neighborhood Search - a primal heuristic for reoptimization.