Scippy

SCIP

Solving Constraint Integer Programs

benderscut_feas.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-2022 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 benderscut_feas.c
17  * @ingroup OTHER_CFILES
18  * @brief Standard feasibility cuts for Benders' decomposition
19  * @author Stephen J. Maher
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #include "scip/pub_expr.h"
25 #include "scip/benderscut_feas.h"
26 #include "scip/benderscut_opt.h"
27 #include "scip/cons_linear.h"
28 #include "scip/pub_benderscut.h"
29 #include "scip/pub_benders.h"
30 #include "scip/pub_lp.h"
31 #include "scip/pub_message.h"
32 #include "scip/pub_misc.h"
33 #include "scip/pub_misc_linear.h"
34 #include "scip/pub_nlp.h"
35 #include "scip/pub_var.h"
36 #include "scip/scip_benders.h"
37 #include "scip/scip_cons.h"
38 #include "scip/scip_general.h"
39 #include "scip/scip_lp.h"
40 #include "scip/scip_mem.h"
41 #include "scip/scip_message.h"
42 #include "scip/scip_nlp.h"
43 #include "scip/scip_nlpi.h"
44 #include "scip/scip_numerics.h"
45 #include "scip/scip_prob.h"
46 #include "scip/scip_solvingstats.h"
47 #include "scip/scip_var.h"
48 
49 #define BENDERSCUT_NAME "feas"
50 #define BENDERSCUT_DESC "Standard feasibility cuts for Benders' decomposition"
51 #define BENDERSCUT_PRIORITY 10000
52 #define BENDERSCUT_LPCUT TRUE
53 
54 /*
55  * Local methods
56  */
57 
58 /** adds a variable and value to the constraint/row arrays */
59 static
61  SCIP* masterprob, /**< the SCIP instance of the master problem */
62  SCIP_VAR*** vars, /**< pointer to array of variables in the generated cut with non-zero coefficient */
63  SCIP_Real** vals, /**< pointer to array of coefficients of the variables in the generated cut */
64  SCIP_VAR* addvar, /**< the variable that will be added to the array */
65  SCIP_Real addval, /**< the value that will be added to the array */
66  int* nvars, /**< the number of variables in the variable array */
67  int* varssize /**< the length of the variable size */
68  )
69 {
70  assert(masterprob != NULL);
71  assert(vars != NULL);
72  assert(*vars != NULL);
73  assert(vals != NULL);
74  assert(*vals != NULL);
75  assert(addvar != NULL);
76  assert(nvars != NULL);
77  assert(varssize != NULL);
78 
79  if( *nvars >= *varssize )
80  {
81  *varssize = SCIPcalcMemGrowSize(masterprob, *varssize + 1);
82  SCIP_CALL( SCIPreallocBufferArray(masterprob, vars, *varssize) );
83  SCIP_CALL( SCIPreallocBufferArray(masterprob, vals, *varssize) );
84  }
85  assert(*nvars < *varssize);
86 
87  (*vars)[*nvars] = addvar;
88  (*vals)[*nvars] = addval;
89  (*nvars)++;
90 
91  return SCIP_OKAY;
92 }
93 
94 /** computing as standard Benders' feasibility cut from the dual solutions of the LP */
95 static
97  SCIP* masterprob, /**< the SCIP instance of the master problem */
98  SCIP* subproblem, /**< the SCIP instance of the pricing problem */
99  SCIP_BENDERS* benders, /**< the benders' decomposition structure */
100  SCIP_VAR*** vars, /**< pointer to array of variables in the generated cut with non-zero coefficient */
101  SCIP_Real** vals, /**< pointer to array of coefficients of the variables in the generated cut */
102  SCIP_Real* lhs, /**< the left hand side of the cut */
103  int* nvars, /**< the number of variables in the cut */
104  int* varssize, /**< the number of variables in the array */
105  SCIP_Bool* success /**< was the cut generation successful? */
106  )
107 {
108  SCIP_VAR** subvars;
109  int nsubvars;
110  int nrows;
111  SCIP_Real dualsol;
112  SCIP_Real addval; /* the value that must be added to the lhs */
113  int i;
114 
115  assert(masterprob != NULL);
116  assert(subproblem != NULL);
117  assert(benders != NULL);
118  assert(SCIPgetLPSolstat(subproblem) == SCIP_LPSOLSTAT_INFEASIBLE);
119 
120  (*success) = FALSE;
121 
122  /* looping over all LP rows and setting the coefficients of the cut */
123  nrows = SCIPgetNLPRows(subproblem);
124  for( i = 0; i < nrows; i++ )
125  {
126  SCIP_ROW* lprow;
127 
128  lprow = SCIPgetLPRows(subproblem)[i];
129  assert(lprow != NULL);
130 
131  dualsol = SCIProwGetDualfarkas(lprow);
132  assert( !SCIPisInfinity(subproblem, dualsol) && !SCIPisInfinity(subproblem, -dualsol) );
133 
134  if( SCIPisDualfeasZero(subproblem, dualsol) )
135  continue;
136 
137  if( dualsol > 0.0 )
138  addval = dualsol*SCIProwGetLhs(lprow);
139  else
140  addval = dualsol*SCIProwGetRhs(lprow);
141 
142  *lhs += addval;
143 
144  /* if the bound becomes infinite, then the cut generation terminates. */
145  if( SCIPisInfinity(masterprob, *lhs) || SCIPisInfinity(masterprob, -*lhs)
146  || SCIPisInfinity(masterprob, addval) || SCIPisInfinity(masterprob, -addval))
147  {
148  (*success) = FALSE;
149  SCIPdebugMsg(masterprob, "Infinite bound when generating feasibility cut.\n");
150  return SCIP_OKAY;
151  }
152  }
153 
154  nsubvars = SCIPgetNVars(subproblem);
155  subvars = SCIPgetVars(subproblem);
156 
157  /* looping over all variables to update the coefficients in the computed cut. */
158  for( i = 0; i < nsubvars; i++ )
159  {
160  SCIP_VAR* var;
161  SCIP_VAR* mastervar;
162 
163  var = subvars[i];
164 
165  /* retrieving the master problem variable for the given subproblem variable. */
166  SCIP_CALL( SCIPgetBendersMasterVar(masterprob, benders, var, &mastervar) );
167 
168  dualsol = SCIPgetVarFarkasCoef(subproblem, var);
169 
170  if( SCIPisZero(subproblem, dualsol) )
171  continue;
172 
173  /* checking whether the original variable is a linking variable.
174  * If this is the case, then the corresponding master variable is added to the generated cut.
175  * If the pricing variable is not a linking variable, then the farkas dual value is added to the lhs
176  */
177  if( mastervar != NULL )
178  {
179  SCIPdebugMsg(masterprob ,"Adding coeffs to feasibility cut: <%s> dualsol %g\n", SCIPvarGetName(mastervar), dualsol);
180 
181  /* adding the variable to the storage */
182  SCIP_CALL( addVariableToArray(masterprob, vars, vals, mastervar, dualsol, nvars, varssize) );
183  }
184  else
185  {
186  addval = 0;
187 
188  if( SCIPisPositive(subproblem, dualsol) )
189  addval = dualsol*SCIPvarGetUbGlobal(var);
190  else if( SCIPisNegative(subproblem, dualsol) )
191  addval = dualsol*SCIPvarGetLbGlobal(var);
192 
193  *lhs -= addval;
194 
195  /* if the bound becomes infinite, then the cut generation terminates. */
196  if( SCIPisInfinity(masterprob, *lhs) || SCIPisInfinity(masterprob, -*lhs)
197  || SCIPisInfinity(masterprob, addval) || SCIPisInfinity(masterprob, -addval))
198  {
199  (*success) = FALSE;
200  SCIPdebugMsg(masterprob, "Infinite bound when generating feasibility cut.\n");
201  return SCIP_OKAY;
202  }
203  }
204  }
205 
206  (*success) = TRUE;
207 
208  return SCIP_OKAY;
209 }
210 
211 
212 /** computing as standard Benders' feasibility cut from the dual solutions of the NLP
213  *
214  * NOTE: The cut must be created before being passed to this function
215  */
216 static
218  SCIP* masterprob, /**< the SCIP instance of the master problem */
219  SCIP* subproblem, /**< the SCIP instance of the pricing problem */
220  SCIP_BENDERS* benders, /**< the benders' decomposition structure */
221  SCIP_VAR*** vars, /**< pointer to array of variables in the generated cut with non-zero coefficient */
222  SCIP_Real** vals, /**< pointer to array of coefficients of the variables in the generated cut */
223  SCIP_Real* lhs, /**< the left hand side of the cut */
224  int* nvars, /**< the number of variables in the cut */
225  int* varssize, /**< the number of variables in the array */
226  SCIP_Bool* success /**< was the cut generation successful? */
227  )
228 {
229  int nrows;
230  SCIP_Real activity;
231  SCIP_Real dirderiv;
232  SCIP_Real dualsol;
233  int i;
234 
235  assert(masterprob != NULL);
236  assert(subproblem != NULL);
237  assert(benders != NULL);
238  assert(SCIPisNLPConstructed(subproblem));
240 
241  (*success) = FALSE;
242 
243  *lhs = 0.0;
244  dirderiv = 0.0;
245 
246  /* looping over all NLP rows and setting the corresponding coefficients of the cut */
247  nrows = SCIPgetNNLPNlRows(subproblem);
248  for( i = 0; i < nrows; i++ )
249  {
250  SCIP_NLROW* nlrow;
251 
252  nlrow = SCIPgetNLPNlRows(subproblem)[i];
253  assert(nlrow != NULL);
254 
255  dualsol = SCIPnlrowGetDualsol(nlrow);
256  assert( !SCIPisInfinity(subproblem, dualsol) && !SCIPisInfinity(subproblem, -dualsol) );
257 
258  if( SCIPisZero(subproblem, dualsol) )
259  continue;
260 
261  SCIP_CALL( SCIPaddNlRowGradientBenderscutOpt(masterprob, subproblem, benders, nlrow, -dualsol,
262  NULL, NULL, &dirderiv, vars, vals, nvars, varssize) );
263 
264  SCIP_CALL( SCIPgetNlRowActivity(subproblem, nlrow, &activity) );
265 
266  if( dualsol > 0.0 )
267  {
268  assert(!SCIPisInfinity(subproblem, SCIPnlrowGetRhs(nlrow)));
269  *lhs += dualsol * (activity - SCIPnlrowGetRhs(nlrow));
270  }
271  else
272  {
273  assert(!SCIPisInfinity(subproblem, -SCIPnlrowGetLhs(nlrow)));
274  *lhs += dualsol * (activity - SCIPnlrowGetLhs(nlrow));
275  }
276  }
277 
278  *lhs += dirderiv;
279 
280  /* if the side became infinite or dirderiv was infinite, then the cut generation terminates. */
281  if( SCIPisInfinity(masterprob, *lhs) || SCIPisInfinity(masterprob, -*lhs)
282  || SCIPisInfinity(masterprob, dirderiv) || SCIPisInfinity(masterprob, -dirderiv))
283  {
284  (*success) = FALSE;
285  SCIPdebugMsg(masterprob, "Infinite bound when generating feasibility cut. lhs = %g dirderiv = %g.\n", *lhs, dirderiv);
286  return SCIP_OKAY;
287  }
288 
289  (*success) = TRUE;
290 
291  return SCIP_OKAY;
292 }
293 
294 /** generates and applies Benders' cuts */
295 static
297  SCIP* masterprob, /**< the SCIP instance of the master problem */
298  SCIP* subproblem, /**< the SCIP instance of the pricing problem */
299  SCIP_BENDERS* benders, /**< the benders' decomposition */
300  SCIP_BENDERSCUT* benderscut, /**< the benders' decomposition cut method */
301  SCIP_SOL* sol, /**< primal CIP solution */
302  int probnumber, /**< the number of the pricing problem */
303  SCIP_RESULT* result /**< the result from solving the subproblems */
304  )
305 {
306  SCIP_CONS* cut;
307  SCIP_VAR** vars;
308  SCIP_Real* vals;
309  SCIP_Real lhs;
310  SCIP_Real activity;
311  int nvars;
312  int varssize;
313  int nmastervars;
314  char cutname[SCIP_MAXSTRLEN];
315  SCIP_Bool success;
316 
317  assert(masterprob != NULL);
318  assert(subproblem != NULL);
319  assert(benders != NULL);
320  assert(result != NULL);
321 
322  /* allocating memory for the variable and values arrays */
323  nmastervars = SCIPgetNVars(masterprob) + SCIPgetNFixedVars(masterprob);
324  SCIP_CALL( SCIPallocClearBufferArray(masterprob, &vars, nmastervars) );
325  SCIP_CALL( SCIPallocClearBufferArray(masterprob, &vals, nmastervars) );
326  lhs = 0.0;
327  nvars = 0;
328  varssize = nmastervars;
329 
330  /* setting the name of the generated cut */
331  (void) SCIPsnprintf(cutname, SCIP_MAXSTRLEN, "feasibilitycut_%d_%" SCIP_LONGINT_FORMAT, probnumber,
332  SCIPbenderscutGetNFound(benderscut) );
333 
334  if( SCIPisNLPConstructed(subproblem) && SCIPgetNNlpis(subproblem) )
335  {
336  /* computing the coefficients of the feasibility cut from the NLP */
337  SCIP_CALL( computeStandardNLPFeasibilityCut(masterprob, subproblem, benders, &vars, &vals, &lhs, &nvars, &varssize,
338  &success) );
339  }
340  else
341  {
342  if( SCIPgetNLPIterations(subproblem) == 0 )
343  {
344  SCIPverbMessage(masterprob, SCIP_VERBLEVEL_FULL, NULL, "There were no iterations in pricing problem %d. "
345  "A Benders' decomposition feasibility cut will be generated from the presolved LP data.\n", probnumber);
346  }
347 
348  /* computing the coefficients of the feasibility cut from the LP */
349  SCIP_CALL( computeStandardLPFeasibilityCut(masterprob, subproblem, benders, &vars, &vals, &lhs, &nvars, &varssize,
350  &success) );
351  }
352 
353  /* if success is FALSE, then there was an error in generating the feasibility cut. No cut will be added to the master
354  * problem. Otherwise, the constraint is added to the master problem.
355  */
356  if( !success )
357  {
358  (*result) = SCIP_DIDNOTFIND;
359  SCIPdebugMsg(masterprob, "Error in generating Benders' feasibility cut for problem %d.\n", probnumber);
360  }
361  else
362  {
363  /* creating a constraint with the variables and coefficients previously stored */
364  SCIP_CALL( SCIPcreateConsBasicLinear(masterprob, &cut, cutname, nvars, vars, vals, lhs, SCIPinfinity(masterprob)) );
365  SCIP_CALL( SCIPsetConsDynamic(masterprob, cut, TRUE) );
366  SCIP_CALL( SCIPsetConsRemovable(masterprob, cut, TRUE) );
367 
368  assert(SCIPisInfinity(masterprob, SCIPgetRhsLinear(masterprob, cut)));
369 
370  /* the activity of the cut should be less than the lhs. This will ensure that the evaluated solution will be cut off.
371  * It is possible that the activity is greater than the lhs. This could be caused by numerical difficulties. In this
372  * case, no cut will be generated.
373  */
374  lhs = SCIPgetLhsLinear(masterprob, cut);
375  activity = SCIPgetActivityLinear(masterprob, cut, sol);
376  if( SCIPisGE(masterprob, activity, lhs) )
377  {
378  success = FALSE;
379  SCIPdebugMsg(masterprob ,"Invalid feasibility cut - activity is greater than lhs %g >= %g.\n", activity, lhs);
380 #ifdef SCIP_DEBUG
381  SCIPABORT();
382 #endif
383  }
384 
385  assert(cut != NULL);
386 
387  if( success )
388  {
389  /* adding the constraint to the master problem */
390  SCIP_CALL( SCIPaddCons(masterprob, cut) );
391 
392  SCIPdebugPrintCons(masterprob, cut, NULL);
393 
394  (*result) = SCIP_CONSADDED;
395  }
396 
397  SCIP_CALL( SCIPreleaseCons(masterprob, &cut) );
398  }
399 
400  SCIPfreeBufferArray(masterprob, &vals);
401  SCIPfreeBufferArray(masterprob, &vars);
402 
403  return SCIP_OKAY;
404 }
405 
406 /*
407  * Callback methods of Benders' decomposition cuts
408  */
409 
410 /** execution method of Benders' decomposition cuts */
411 static
412 SCIP_DECL_BENDERSCUTEXEC(benderscutExecFeas)
413 { /*lint --e{715}*/
414  SCIP* subproblem;
415  SCIP_Bool nlprelaxation;
416 
417  assert(scip != NULL);
418  assert(benders != NULL);
419  assert(benderscut != NULL);
420  assert(result != NULL);
421  assert(probnumber >= 0 && probnumber < SCIPbendersGetNSubproblems(benders));
422 
423  subproblem = SCIPbendersSubproblem(benders, probnumber);
424 
425  if( subproblem == NULL )
426  {
427  SCIPdebugMsg(scip, "The subproblem %d is set to NULL. The <%s> Benders' decomposition cut can not be executed.\n",
428  probnumber, BENDERSCUT_NAME);
429 
430  (*result) = SCIP_DIDNOTRUN;
431  return SCIP_OKAY;
432  }
433 
434  /* setting a flag to indicate whether the NLP relaxation should be used to generate cuts */
435  nlprelaxation = SCIPisNLPConstructed(subproblem) && SCIPgetNNlpis(subproblem);
436 
437  /* only generate feasibility cuts if the subproblem LP or NLP is infeasible,
438  * since we use the farkas proof from the LP or the dual solution of the NLP to construct the feasibility cut
439  */
440  if( SCIPgetStage(subproblem) == SCIP_STAGE_SOLVING &&
441  ((!nlprelaxation && SCIPgetLPSolstat(subproblem) == SCIP_LPSOLSTAT_INFEASIBLE) ||
442  (nlprelaxation && (SCIPgetNLPSolstat(subproblem) == SCIP_NLPSOLSTAT_LOCINFEASIBLE || SCIPgetNLPSolstat(subproblem) == SCIP_NLPSOLSTAT_GLOBINFEASIBLE))) )
443  {
444  /* generating a cut for a given subproblem */
445  SCIP_CALL( generateAndApplyBendersCuts(scip, subproblem, benders, benderscut,
446  sol, probnumber, result) );
447  }
448 
449  return SCIP_OKAY;
450 }
451 
452 
453 /*
454  * Benders' decomposition cuts specific interface methods
455  */
456 
457 /** creates the Standard Feasibility Benders' decomposition cuts and includes it in SCIP */
459  SCIP* scip, /**< SCIP data structure */
460  SCIP_BENDERS* benders /**< Benders' decomposition */
461  )
462 {
463  SCIP_BENDERSCUT* benderscut;
464 
465  assert(benders != NULL);
466 
467  benderscut = NULL;
468 
469  /* include Benders' decomposition cuts */
471  BENDERSCUT_PRIORITY, BENDERSCUT_LPCUT, benderscutExecFeas, NULL) );
472 
473  assert(benderscut != NULL);
474 
475  return SCIP_OKAY;
476 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
SCIP_ROW ** SCIPgetLPRows(SCIP *scip)
Definition: scip_lp.c:596
SCIP_Real SCIPgetActivityLinear(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol)
int SCIPgetNNLPNlRows(SCIP *scip)
Definition: scip_nlp.c:332
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_Bool SCIPisNLPConstructed(SCIP *scip)
Definition: scip_nlp.c:101
internal miscellaneous methods for linear constraints
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip_general.c:356
SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
SCIP_RETCODE SCIPcreateConsBasicLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs)
public methods for memory management
#define SCIPallocClearBufferArray(scip, ptr, num)
Definition: scip_mem.h:117
SCIP_RETCODE SCIPgetBendersMasterVar(SCIP *scip, SCIP_BENDERS *benders, SCIP_VAR *var, SCIP_VAR **mappedvar)
Definition: scip_benders.c:651
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:17910
#define SCIP_MAXSTRLEN
Definition: def.h:293
int SCIPcalcMemGrowSize(SCIP *scip, int num)
Definition: scip_mem.c:130
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_NLPSOLSTAT SCIPgetNLPSolstat(SCIP *scip)
Definition: scip_nlp.c:532
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
Definition: lp.c:17225
#define FALSE
Definition: def.h:87
public methods for Benders&#39; decomposition
#define BENDERSCUT_LPCUT
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10755
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
#define TRUE
Definition: def.h:86
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
Generates a standard Benders&#39; decomposition optimality cut.
SCIP_Real SCIPnlrowGetRhs(SCIP_NLROW *nlrow)
Definition: nlp.c:1814
static SCIP_RETCODE addVariableToArray(SCIP *masterprob, SCIP_VAR ***vars, SCIP_Real **vals, SCIP_VAR *addvar, SCIP_Real addval, int *nvars, int *varssize)
SCIP_Bool SCIPisDualfeasZero(SCIP *scip, SCIP_Real val)
public methods for problem variables
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:127
#define SCIPdebugPrintCons(x, y, z)
Definition: pub_message.h:93
public methods for SCIP variables
#define SCIPdebugMsg
Definition: scip_message.h:69
SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Longint SCIPbenderscutGetNFound(SCIP_BENDERSCUT *benderscut)
Definition: benderscut.c:534
#define BENDERSCUT_DESC
public methods for numerical tolerances
public functions to work with algebraic expressions
public methods for querying solving statistics
int SCIPgetNNlpis(SCIP *scip)
Definition: scip_nlpi.c:190
int SCIPgetNFixedVars(SCIP *scip)
Definition: scip_prob.c:2308
Standard feasibility cuts for Benders&#39; decomposition.
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:17920
public methods for NLPI solver interfaces
SCIP_RETCODE SCIPsetConsRemovable(SCIP *scip, SCIP_CONS *cons, SCIP_Bool removable)
Definition: scip_cons.c:1411
public methods for Benders decomposition
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip_prob.c:2769
SCIP_RETCODE SCIPsetConsDynamic(SCIP *scip, SCIP_CONS *cons, SCIP_Bool dynamic)
Definition: scip_cons.c:1386
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:17251
SCIP_Real SCIPnlrowGetDualsol(SCIP_NLROW *nlrow)
Definition: nlp.c:1876
#define NULL
Definition: lpi_spx1.cpp:155
int SCIPgetNLPRows(SCIP *scip)
Definition: scip_lp.c:617
#define SCIP_CALL(x)
Definition: def.h:384
SCIP_NLROW ** SCIPgetNLPNlRows(SCIP *scip)
Definition: scip_nlp.c:310
SCIP_RETCODE SCIPincludeBenderscutFeas(SCIP *scip, SCIP_BENDERS *benders)
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
Definition: lp.c:17235
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
Definition: scip_message.c:216
public methods for constraint handler plugins and constraints
public methods for NLP management
public data structures and miscellaneous methods
#define SCIP_Bool
Definition: def.h:84
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
Definition: scip_lp.c:159
SCIP_RETCODE SCIPaddNlRowGradientBenderscutOpt(SCIP *masterprob, SCIP *subproblem, SCIP_BENDERS *benders, SCIP_NLROW *nlrow, SCIP_Real mult, SCIP_Real *primalvals, SCIP_HASHMAP *var2idx, SCIP_Real *dirderiv, SCIP_VAR ***vars, SCIP_Real **vals, int *nvars, int *varssize)
SCIP_RETCODE SCIPgetNlRowActivity(SCIP *scip, SCIP_NLROW *nlrow, SCIP_Real *activity)
Definition: scip_nlp.c:1396
public methods for LP management
SCIP * SCIPbendersSubproblem(SCIP_BENDERS *benders, int probnumber)
Definition: benders.c:5949
SCIP_Real SCIProwGetDualfarkas(SCIP_ROW *row)
Definition: lp.c:17258
Constraint handler for linear constraints in their most general form, .
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
int SCIPbendersGetNSubproblems(SCIP_BENDERS *benders)
Definition: benders.c:5939
public methods for the LP relaxation, rows and columns
int SCIPgetNVars(SCIP *scip)
Definition: scip_prob.c:1991
public methods for nonlinear relaxation
public methods for Benders&#39; decomposition cuts
general public methods
static SCIP_RETCODE generateAndApplyBendersCuts(SCIP *masterprob, SCIP *subproblem, SCIP_BENDERS *benders, SCIP_BENDERSCUT *benderscut, SCIP_SOL *sol, int probnumber, SCIP_RESULT *result)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip_cons.c:1110
public methods for message output
SCIP_VAR ** SCIPgetVars(SCIP *scip)
Definition: scip_prob.c:1946
#define SCIP_Real
Definition: def.h:177
public methods for message handling
#define BENDERSCUT_NAME
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
static SCIP_DECL_BENDERSCUTEXEC(benderscutExecFeas)
#define BENDERSCUT_PRIORITY
SCIP_Real SCIPgetVarFarkasCoef(SCIP *scip, SCIP_VAR *var)
Definition: scip_var.c:1951
SCIP_Real SCIPnlrowGetLhs(SCIP_NLROW *nlrow)
Definition: nlp.c:1804
#define SCIPABORT()
Definition: def.h:356
public methods for global and local (sub)problems
static SCIP_RETCODE computeStandardNLPFeasibilityCut(SCIP *masterprob, SCIP *subproblem, SCIP_BENDERS *benders, SCIP_VAR ***vars, SCIP_Real **vals, SCIP_Real *lhs, int *nvars, int *varssize, SCIP_Bool *success)
SCIP_Real SCIPgetLhsLinear(SCIP *scip, SCIP_CONS *cons)
static SCIP_RETCODE computeStandardLPFeasibilityCut(SCIP *masterprob, SCIP *subproblem, SCIP_BENDERS *benders, SCIP_VAR ***vars, SCIP_Real **vals, SCIP_Real *lhs, int *nvars, int *varssize, SCIP_Bool *success)
#define SCIPreallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:119