Scippy

SCIP

Solving Constraint Integer Programs

benders_default.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-2020 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file benders_default.c
17  * @ingroup OTHER_CFILES
18  * @brief default Benders' decomposition plugin
19  * @author Stephen J. Maher
20  *
21  * The default Benders' decomposition plugin is provided to simplify the interaction the Benders' decomposition
22  * framework within SCIP. This plugin is included in the SCIP package by default. Using the default Benders'
23  * decomposition plugin, a problem can be solved by Benders' decomposition by calling
24  *
25  * SCIPcreateBendersDefault(master problem, array of subproblems, number of subproblems)
26  *
27  * where "master problem" is a SCIP instance of the master problem, "array of subproblems" is an array of SCIP instances
28  * that are the Benders' decomposition subproblems and "number of subproblems" is an integer indicating the number of
29  * subproblems for this decomposition.
30  *
31  * A key feature of the default Benders' decomposition plugin is the automatic generation of the variable mapping
32  * between the variables of the master problem and the subproblems.
33  *
34  * In the traditional application of Benders' decomposition, master problem variables are fixed to a solution value and
35  * modify the RHS of the second stage constraints. The implementation within SCIP requires that a variable is created
36  * in the subproblem for every master problem variable that appears in the subproblem constraints. This variable MUST
37  * have the same name as the corresponding variable in the master problem. This name is used to automatically generate
38  * the mapping between the master problem and the corresponding subproblem variables.
39  *
40  */
41 
42 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
43 
44 #include "scip/benders_default.h"
45 #include "scip/bendersdefcuts.h"
46 #include "scip/pub_benders.h"
47 #include "scip/pub_message.h"
48 #include "scip/pub_misc.h"
49 #include "scip/pub_var.h"
50 #include "scip/scip.h"
51 
52 #define BENDERS_NAME "default"
53 #define BENDERS_DESC "default implementation of Benders' decomposition"
54 #define BENDERS_PRIORITY 0
55 #define BENDERS_CUTLP TRUE /**< should Benders' cut be generated for LP solutions */
56 #define BENDERS_CUTPSEUDO TRUE /**< should Benders' cut be generated for pseudo solutions */
57 #define BENDERS_CUTRELAX TRUE /**< should Benders' cut be generated for relaxation solutions */
58 #define BENDERS_SHAREAUXVARS FALSE /**< should this Benders' share the highest priority Benders' aux vars */
59 
60 
61 /*
62  * Data structures
63  */
64 
65 /** Benders' decomposition data */
66 struct SCIP_BendersData
67 {
68  SCIP** subproblems; /**< the Benders' decomposition subproblems */
69  SCIP_HASHMAP* mastervartosubindex;/**< hash map from the master variable to an index for the subproblemn variables */
70  SCIP_HASHMAP* subvartomastervar; /**< hashmap from the subproblem variable to the master variable */
71  SCIP_VAR*** subproblemvars; /**< the subproblem variables corresponding to master problem variables */
72  int nmastervars; /**< the number of variables in the master problem */
73  int nsubproblems; /**< the number of subproblems */
74  SCIP_Bool created; /**< flag to indicate that the Benders' decomposition Data was created */
75  SCIP_Bool subprobscopied; /**< were the subproblems copied during the SCIP copy */
76  SCIP_Bool mappingcreated; /**< flag to indicate whether the variable mapping has been created */
77 };
78 
79 
80 
81 
82 /*
83  * Local methods
84  */
85 
86 /** creates the Benders' decomposition data */
87 static
89  SCIP* scip, /**< SCIP data structure */
90  SCIP** subproblems, /**< the Benders' decomposition subproblems */
91  SCIP_BENDERSDATA** bendersdata, /**< the Benders' decomposition data */
92  int nsubproblems /**< the number of subproblems in the Benders' decomposition */
93  )
94 {
95  int i;
96 
97  assert(scip != NULL);
98  assert(subproblems != NULL);
99 
100  (*bendersdata)->nsubproblems = nsubproblems;
101 
102  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &(*bendersdata)->subproblems, nsubproblems) );
103 
104  /* Copying the subproblem to the Benders' decomposition data. */
105  for( i = 0; i < nsubproblems; i++ )
106  (*bendersdata)->subproblems[i] = subproblems[i];
107 
108  (*bendersdata)->created = TRUE;
109 
110  return SCIP_OKAY;
111 }
112 
113 
114 /** Creates the variable mappings between the master problem and the corresponding variable in the subproblem.
115  *
116  * TODO: add the functionality to allow the user to provide an array of hashmaps for mapping between the master problem
117  * variables and the corresponding subproblem variables.
118  * TODO: check for uniqueness of names in this function.
119  */
120 static
122  SCIP* scip, /**< SCIP data structure */
123  SCIP_BENDERS* benders /**< the Benders' decomposition structure */
124  )
125 {
126  SCIP_BENDERSDATA* bendersdata;
127  SCIP_VAR** vars;
128  int nsubproblems;
129  int nvars;
130  char varname[SCIP_MAXSTRLEN];
131  int i;
132  int j;
133 
134  assert(scip != NULL);
135  assert(benders != NULL);
136 
137  bendersdata = SCIPbendersGetData(benders);
138  assert(bendersdata != NULL);
139 
140  nsubproblems = bendersdata->nsubproblems;
141 
142  /* getting the master problem variable data */
143  vars = SCIPgetVars(scip);
144  nvars = SCIPgetNVars(scip);
145 
146  bendersdata->nmastervars = nvars;
147 
148  /* creating the hashmaps for the mapping between the master variables and the sub variables */
149  SCIP_CALL( SCIPhashmapCreate(&bendersdata->mastervartosubindex, SCIPblkmem(scip), nvars) );
150  SCIP_CALL( SCIPhashmapCreate(&bendersdata->subvartomastervar, SCIPblkmem(scip), nvars*nsubproblems) );
151  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &bendersdata->subproblemvars, nsubproblems) );
152  for( i = 0; i < nsubproblems; i++ )
153  {
154  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &bendersdata->subproblemvars[i], nvars) );
155  }
156 
157  /* this loop stores a mapping between the master problem variables and their counterpart in the subproblems. For each
158  * master problem variable, the variable name is used to search for any corresponding variables in each of the
159  * subproblems. If a corresponding variable exists, then a mapping is inserted into subvartomastervar and
160  * mastervartosubvar hashmaps
161  */
162  for( i = 0; i < nvars; i++ )
163  {
164  SCIP_VAR* origvar;
165  SCIP_VAR* subvar;
166  SCIP_Real scalar;
167  SCIP_Real constant;
168  const char* origvarname;
169  int charcount = SCIPgetSubscipDepth(scip)*2;
170 
171  /* getting the original variable for the master variable
172  * NOTE: This retrieved variable is the original variable. It may be a bug in regards to other parts of the code.
173  * The process maps the subproblem variable to the original master variable. It was original supposed to be a
174  * mapping between the subproblem variables and the transformed master variable.
175  */
176  origvar = vars[i];
177  scalar = 1.0;
178  constant = 0.0;
179  SCIP_CALL( SCIPvarGetOrigvarSum(&origvar, &scalar, &constant) );
180 
181  /* retrieving the var name */
182  origvarname = SCIPvarGetName(origvar);
183  (void) SCIPsnprintf(varname, SCIP_MAXSTRLEN, "%s", &origvarname[charcount]);
184 
185  /* retrieving the subproblem variable for the given master variable */
186  for( j = 0; j < nsubproblems; j++ )
187  {
188  /* find the corresponding subproblem variable for a given master problem variable using the variable name. */
189  subvar = SCIPfindVar(bendersdata->subproblems[j], varname);
190 
191  /* adding the subvariable to master variable mapping into the hash map */
192  if( subvar != NULL )
193  {
194  SCIP_CALL( SCIPhashmapInsert(bendersdata->subvartomastervar, subvar, origvar) );
195  }
196 
197  /* storing the subproblem variable */
198  bendersdata->subproblemvars[j][i] = subvar;
199 
200  if( subvar != NULL )
201  {
202  SCIP_CALL( SCIPcaptureVar(bendersdata->subproblems[j], bendersdata->subproblemvars[j][i]) );
203  }
204  }
205 
206  /* storing the mapping of the master variable to the variable index */
207  SCIP_CALL( SCIPhashmapInsertInt(bendersdata->mastervartosubindex, vars[i], i) );
208  }
209 
210  bendersdata->mappingcreated = TRUE;
211 
212  return SCIP_OKAY;
213 }
214 
215 
216 
217 /*
218  * Callback methods for Benders' decomposition
219  */
220 
221 /** copy method for Benders' decomposition plugins (called when SCIP copies plugins) */
222 static
223 SCIP_DECL_BENDERSCOPY(bendersCopyDefault)
224 { /*lint --e{715}*/
225  SCIP_BENDERSDATA* bendersdata; /* the source Benders' decomposition data */
226 
227  assert(scip != NULL);
228  assert(benders != NULL);
229 
230  bendersdata = SCIPbendersGetData(benders);
231 
232  /* including the Benders' decomposition in the target SCIP.
233  * NOTE: this method uses the same subproblems as the main SCIP. In a parallel setting, this will not be thread safe.
234  * It would be cleaner to copy the subproblems also.
235  */
237 
238  /* if the Benders' decomposition is active, then it must be created in the copy */
239  if( SCIPbendersIsActive(benders) )
240  {
241  SCIP** subproblems;
242  int i;
243 
244  /* copying the subproblems if the threadsafe flag was set to TRUE */
245  if( threadsafe )
246  {
247  /* allocating memory for the subproblems array */
248  SCIP_CALL( SCIPallocBufferArray(scip, &subproblems, bendersdata->nsubproblems) );
249 
250  for( i = 0; i < bendersdata->nsubproblems; i++ )
251  {
252  SCIP_Bool valid;
253 
254  /* creating the SCIP instance for the subproblem */
255  SCIP_CALL( SCIPcreate(&subproblems[i]) );
256 
257  /* the original problem is copied so that the variable mappings are created correctly.
258  * TODO: use a varmap to create the mappings for the copies
259  */
260  SCIP_CALL( SCIPcopyOrig(bendersdata->subproblems[i], subproblems[i], NULL, NULL, "", TRUE, FALSE, FALSE,
261  &valid) );
262  assert(valid);
263  }
264  }
265  else
266  subproblems = bendersdata->subproblems;
267 
268  SCIP_CALL( SCIPcreateBendersDefault(scip, subproblems, bendersdata->nsubproblems) );
269 
270  /* freeing the buffer memory for the subproblems */
271  if( threadsafe )
272  {
273  SCIP_BENDERS* targetbenders;
274  SCIP_BENDERSDATA* targetbendersdata;
275 
276  targetbenders = SCIPfindBenders(scip, BENDERS_NAME);
277  assert(targetbenders != NULL);
278 
279  targetbendersdata = SCIPbendersGetData(targetbenders);
280 
281  /* indicating that the subproblems have been copied */
282  targetbendersdata->subprobscopied = TRUE;
283 
284  SCIPfreeBufferArray(scip, &subproblems);
285  }
286  }
287 
288  return SCIP_OKAY;
289 }
290 
291 /** destructor of Benders' decomposition to free user data (called when SCIP is exiting) */
292 /**! [SnippetBendersFreeDefault] */
293 static
294 SCIP_DECL_BENDERSFREE(bendersFreeDefault)
295 { /*lint --e{715}*/
296  SCIP_BENDERSDATA* bendersdata;
297  int i;
298 
299  assert(scip != NULL);
300  assert(benders != NULL);
301 
302  bendersdata = SCIPbendersGetData(benders);
303 
304  assert(bendersdata != NULL);
305 
306  /* should have been freed in bendersExitDefault (if mappingcreated), or not been created at the first place */
307  assert(bendersdata->subproblemvars == NULL);
308  assert(bendersdata->subvartomastervar == NULL);
309  assert(bendersdata->mastervartosubindex == NULL);
310  if( bendersdata->created )
311  {
312  /* if the subproblems were copied, then the copy needs to be freed */
313  if( bendersdata->subprobscopied )
314  {
315  for( i = bendersdata->nsubproblems - 1; i >= 0; i-- )
316  {
317  SCIP_CALL( SCIPfree(&bendersdata->subproblems[i]) );
318  }
319  }
320 
321  SCIPfreeBlockMemoryArray(scip, &bendersdata->subproblems, bendersdata->nsubproblems);
322  }
323 
324  SCIPfreeBlockMemory(scip, &bendersdata);
325 
326  return SCIP_OKAY;
327 }
328 /**! [SnippetBendersFreeDefault] */
329 
330 
331 /** initialization method of Benders' decomposition (called after problem was transformed) */
332 static
333 SCIP_DECL_BENDERSINIT(bendersInitDefault)
334 { /*lint --e{715}*/
335  assert(scip != NULL);
336  assert(benders != NULL);
337 
338  /* creating the variable mappings */
340 
341  return SCIP_OKAY;
342 }
343 
344 /** deinitialization method of Benders' decomposition (called before transformed problem is freed and the Benders'
345  * decomposition is active)
346  */
347 static
348 SCIP_DECL_BENDERSEXIT(bendersExitDefault)
349 {
350  SCIP_BENDERSDATA* bendersdata;
351  int i;
352  int j;
353 
354  assert(scip != NULL);
355  assert(benders != NULL);
356 
357  bendersdata = SCIPbendersGetData(benders);
358 
359  assert(bendersdata != NULL);
360 
361  if( bendersdata->mappingcreated )
362  {
363  for( i = bendersdata->nsubproblems - 1; i >= 0; i-- )
364  {
365  for( j = 0; j < bendersdata->nmastervars; j++ )
366  {
367  if( bendersdata->subproblemvars[i][j] != NULL )
368  {
369  SCIP_CALL( SCIPreleaseVar(bendersdata->subproblems[i], &bendersdata->subproblemvars[i][j]) );
370  }
371  }
372  SCIPfreeBlockMemoryArray(scip, &bendersdata->subproblemvars[i], bendersdata->nmastervars);
373  }
374  SCIPfreeBlockMemoryArray(scip, &bendersdata->subproblemvars, bendersdata->nsubproblems);
375 
376  /* free hash map */
377  SCIPhashmapFree(&bendersdata->subvartomastervar);
378  SCIPhashmapFree(&bendersdata->mastervartosubindex);
379  }
380 
381  return SCIP_OKAY;
382 }
383 
384 /** mapping method between the master problem variables and the subproblem variables of Benders' decomposition */
385 /**! [SnippetBendersGetvarDefault] */
386 static
387 SCIP_DECL_BENDERSGETVAR(bendersGetvarDefault)
388 { /*lint --e{715}*/
389  SCIP_BENDERSDATA* bendersdata;
390  SCIP_VAR* origvar;
391  SCIP_Real scalar;
392  SCIP_Real constant;
393 
394  assert(scip != NULL);
395  assert(benders != NULL);
396  assert(var != NULL);
397  assert(mappedvar != NULL);
398 
399  bendersdata = SCIPbendersGetData(benders);
400 
401  if( probnumber == -1 )
402  {
403  origvar = var;
404  /* The variable needs to be transformed back into an original variable. If the variable is already original, then
405  * this function just returns the same variable
406  */
407  scalar = 1.0;
408  constant = 0.0;
409  SCIP_CALL( SCIPvarGetOrigvarSum(&origvar, &scalar, &constant) );
410 
411  /* using the original variable, the master variable can be retrieved from the hash map */
412  (*mappedvar) = (SCIP_VAR*) SCIPhashmapGetImage(bendersdata->subvartomastervar, origvar);
413 
414  if( (*mappedvar) == NULL )
415  (*mappedvar) = (SCIP_VAR*) SCIPhashmapGetImage(bendersdata->subvartomastervar, var);
416  }
417  else
418  {
419  int masterindex;
420  /* The variable needs to be transformed back into an original variable. If the variable is already original, then
421  * this function just returns the same variable
422  */
423 
424  /* we are requesting the subproblem variable for a master problem variable
425  * The master problem variable is a transformed variable. The original variable is not required.
426  * NOTE: Currently the original variable is being used. This may not be correct and should be the transformed
427  * variable.
428  */
429  masterindex = SCIPhashmapGetImageInt(bendersdata->mastervartosubindex, var);
430  (*mappedvar) = bendersdata->subproblemvars[probnumber][masterindex];
431  }
432 
433  return SCIP_OKAY;
434 }
435 /**! [SnippetBendersGetvarDefault] */
436 
437 /** the method for creating the Benders' decomposition subproblem. This method is called during the initialisation stage
438  * (after the master problem was transformed)
439  *
440  * This method must create the SCIP instance for the subproblem and add the required variables and constraints. In
441  * addition, the settings required for the solving the problem must be set here. However, some settings will be
442  * overridden by the standard solving method included in the Benders' decomposition framework. If a special solving
443  * method is desired, the user can implement the bendersSolvesubDefault callback.
444  */
445 static
446 SCIP_DECL_BENDERSCREATESUB(bendersCreatesubDefault)
447 { /*lint --e{715}*/
448  SCIP_BENDERSDATA* bendersdata;
449 
450  assert(scip != NULL);
451  assert(benders != NULL);
452 
453  bendersdata = SCIPbendersGetData(benders);
454  assert(bendersdata != NULL);
455 
456  /* adding the subproblem to the Benders' decomposition structure */
457  SCIP_CALL( SCIPaddBendersSubproblem(scip, benders, bendersdata->subproblems[probnumber]) );
458 
459  return SCIP_OKAY;
460 }
461 
462 
463 /*
464  * Benders' decomposition specific interface methods
465  */
466 
467 /** Creates a default Benders' decomposition algorithm and activates it in SCIP
468  *
469  * @note Every variable that appears in the subproblem constraints must be created in the corresponding subproblem with
470  * the same name as in the master problem.
471  *
472  * @note The default Benders' decomposition implementation relies on unique variable names in the master problem and in
473  * each of the subproblems. This is required because a variable mapping is made between the master problem variables and
474  * the counterparts in the subproblems. This mapping is created using the variable names.
475  */
477  SCIP* scip, /**< SCIP data structure */
478  SCIP** subproblems, /**< the Benders' decomposition subproblems */
479  int nsubproblems /**< the number of subproblems in the Benders' decomposition */
480  )
481 {
482  SCIP_BENDERS* benders;
483  SCIP_BENDERSDATA* bendersdata;
484  int maxrestarts;
485 
486  assert(scip != NULL);
487  assert(subproblems != NULL);
488  assert(nsubproblems > 0);
489 
490  benders = SCIPfindBenders(scip, BENDERS_NAME);
491  bendersdata = SCIPbendersGetData(benders);
492 
493  /* turning restarts off */
494  SCIP_CALL( SCIPgetIntParam(scip, "presolving/maxrestarts", &maxrestarts) );
495  if( SCIPisParamFixed(scip, "presolving/maxrestarts") && maxrestarts != 0)
496  {
497  SCIPerrorMessage("The number of restarts is fixed to %d. The default Benders' decomposition requires the number"
498  " of restarts to be 0.", maxrestarts);
499  return SCIP_ERROR;
500  }
501  else
502  {
503  SCIP_CALL( SCIPsetIntParam(scip, "presolving/maxrestarts", 0) );
504  SCIP_CALL( SCIPfixParam(scip, "presolving/maxrestarts") );
505  }
506 
507  SCIP_CALL( createBendersData(scip, subproblems, &bendersdata, nsubproblems) );
508 
509  SCIP_CALL( SCIPactivateBenders(scip, benders, nsubproblems) );
510 
511  return SCIP_OKAY;
512 }
513 
514 /** creates the default Benders' decomposition and includes it in SCIP */
516  SCIP* scip /**< SCIP data structure */
517  )
518 {
519  SCIP_BENDERSDATA* bendersdata;
520  SCIP_BENDERS* benders;
521 
522  /* create default Benders' decomposition data */
523  bendersdata = NULL;
524 
525  SCIP_CALL( SCIPallocBlockMemory(scip, &bendersdata) );
526  BMSclearMemory(bendersdata);
527 
528  benders = NULL;
529 
530  /* include Benders' decomposition */
532  BENDERS_CUTPSEUDO, BENDERS_CUTRELAX, BENDERS_SHAREAUXVARS, bendersGetvarDefault, bendersCreatesubDefault,
533  bendersdata) );
534  assert(benders != NULL);
535 
536  /* set non fundamental callbacks via setter functions */
537  SCIP_CALL( SCIPsetBendersCopy(scip, benders, bendersCopyDefault) );
538  SCIP_CALL( SCIPsetBendersFree(scip, benders, bendersFreeDefault) );
539  SCIP_CALL( SCIPsetBendersInit(scip, benders, bendersInitDefault) );
540  SCIP_CALL( SCIPsetBendersExit(scip, benders, bendersExitDefault) );
541 
542  /* OPTIONAL: including the default cuts for Benders' decomposition */
543  SCIP_CALL( SCIPincludeBendersDefaultCuts(scip, benders) );
544 
545  return SCIP_OKAY;
546 }
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:97
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:3095
#define SCIPallocBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:80
SCIP_RETCODE SCIPincludeBendersDefault(SCIP *scip)
#define BENDERS_CUTLP
static SCIP_DECL_BENDERSINIT(bendersInitDefault)
#define SCIP_MAXSTRLEN
Definition: def.h:273
SCIP_RETCODE SCIPcopyOrig(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_Bool enablepricing, SCIP_Bool threadsafe, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:2989
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
Definition: scip_var.c:1218
SCIP_RETCODE SCIPsetBendersFree(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSFREE((*bendersfree)))
Definition: scip_benders.c:212
SCIP_RETCODE SCIPhashmapInsertInt(SCIP_HASHMAP *hashmap, void *origin, int image)
Definition: misc.c:3131
int SCIPgetNVars(SCIP *scip)
Definition: scip_prob.c:1986
#define FALSE
Definition: def.h:73
public methods for Benders&#39; decomposition
#define TRUE
Definition: def.h:72
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
#define BENDERS_CUTRELAX
static SCIP_DECL_BENDERSEXIT(bendersExitDefault)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3200
public methods for problem variables
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:95
#define BENDERS_DESC
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:123
#define BENDERS_PRIORITY
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip_mem.h:78
static SCIP_DECL_BENDERSFREE(bendersFreeDefault)
int SCIPhashmapGetImageInt(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3220
SCIP_BENDERS * SCIPfindBenders(SCIP *scip, const char *name)
Definition: scip_benders.c:484
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:283
SCIP_BENDERSDATA * SCIPbendersGetData(SCIP_BENDERS *benders)
Definition: benders.c:5719
#define BENDERS_SHAREAUXVARS
SCIP_EXPORT const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:17017
#define SCIPerrorMessage
Definition: pub_message.h:55
SCIP_RETCODE SCIPfixParam(SCIP *scip, const char *name)
Definition: scip_param.c:358
static SCIP_RETCODE createVariableMappings(SCIP *scip, SCIP_BENDERS *benders)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
Definition: scip_prob.c:1941
static SCIP_DECL_BENDERSCREATESUB(bendersCreatesubDefault)
SCIP_RETCODE SCIPincludeBendersDefaultCuts(SCIP *scip, SCIP_BENDERS *benders)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:48
#define NULL
Definition: lpi_spx1.cpp:155
struct SCIP_BendersData SCIP_BENDERSDATA
Definition: type_benders.h:73
#define SCIP_CALL(x)
Definition: def.h:364
#define BENDERS_CUTPSEUDO
SCIP_RETCODE SCIPgetIntParam(SCIP *scip, const char *name, int *value)
Definition: scip_param.c:260
static SCIP_DECL_BENDERSCOPY(bendersCopyDefault)
SCIP_RETCODE SCIPsetBendersCopy(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSCOPY((*benderscopy)))
Definition: scip_benders.c:188
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:111
public data structures and miscellaneous methods
#define SCIP_Bool
Definition: def.h:70
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:3013
SCIP_Bool SCIPisParamFixed(SCIP *scip, const char *name)
Definition: scip_param.c:210
SCIP_Bool SCIPbendersIsActive(SCIP_BENDERS *benders)
Definition: benders.c:2674
SCIP_RETCODE SCIPsetBendersInit(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSINIT((*bendersinit)))
Definition: scip_benders.c:236
#define BMSclearMemory(ptr)
Definition: memory.h:121
SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
Definition: scip_prob.c:2679
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:142
public methods for message output
SCIP_RETCODE SCIPcreateBendersDefault(SCIP *scip, SCIP **subproblems, int nsubproblems)
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10590
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:3047
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
Definition: scip_var.c:1252
#define SCIP_Real
Definition: def.h:163
default Benders&#39; decomposition plugin
SCIP_EXPORT SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
Definition: var.c:12545
SCIP_RETCODE SCIPaddBendersSubproblem(SCIP *scip, SCIP_BENDERS *benders, SCIP *subproblem)
Definition: scip_benders.c:737
static SCIP_RETCODE createBendersData(SCIP *scip, SCIP **subproblems, SCIP_BENDERSDATA **bendersdata, int nsubproblems)
SCIP_RETCODE SCIPactivateBenders(SCIP *scip, SCIP_BENDERS *benders, int nsubproblems)
Definition: scip_benders.c:546
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:315
SCIP_RETCODE SCIPsetBendersExit(SCIP *scip, SCIP_BENDERS *benders, SCIP_DECL_BENDERSEXIT((*bendersexit)))
Definition: scip_benders.c:260
int SCIPgetSubscipDepth(SCIP *scip)
Definition: scip_copy.c:2548
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip_param.c:497
#define BENDERS_NAME
static SCIP_DECL_BENDERSGETVAR(bendersGetvarDefault)
SCIP callable library.