Scippy

SCIP

Solving Constraint Integer Programs

sepa_disjunctive.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 sepa_disjunctive.c
17  * @ingroup DEFPLUGINS_SEPA
18  * @brief disjunctive cut separator
19  * @author Tobias Fischer
20  * @author Marc Pfetsch
21  *
22  * We separate disjunctive cuts for two term disjunctions of the form \f$x_1 = 0 \vee x_2 = 0\f$. They can be generated
23  * directly from the simplex tableau. For further information, we refer to@n
24  * "A complementarity-based partitioning and disjunctive cut algorithm for mathematical programming problems with
25  * equilibrium constraints"@n
26  * Júdice, J.J., Sherali, H.D., Ribeiro, I.M., Faustino, A.M., Journal of Global Optimization 36(1), 89–114 (2006)
27  *
28  * Cut coefficients belonging to integer variables can be strengthened by the 'monoidal cut strengthening' procedure, see@n
29  * "Strengthening cuts for mixed integer programs"@n
30  * Egon Balas, Robert G. Jeroslow, European Journal of Operational Research, Volume 4, Issue 4, 1980, Pages 224-234
31  */
32 
33 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34 
35 #include "blockmemshell/memory.h"
36 #include "scip/cons_sos1.h"
37 #include "scip/pub_cons.h"
38 #include "scip/pub_lp.h"
39 #include "scip/pub_message.h"
40 #include "scip/pub_misc.h"
41 #include "scip/pub_misc_sort.h"
42 #include "scip/pub_sepa.h"
43 #include "scip/pub_var.h"
44 #include "scip/scip_cons.h"
45 #include "scip/scip_cut.h"
46 #include "scip/scip_general.h"
47 #include "scip/scip_lp.h"
48 #include "scip/scip_mem.h"
49 #include "scip/scip_message.h"
50 #include "scip/scip_numerics.h"
51 #include "scip/scip_param.h"
52 #include "scip/scip_sepa.h"
53 #include "scip/scip_sol.h"
54 #include "scip/scip_solvingstats.h"
55 #include "scip/scip_tree.h"
56 #include "scip/sepa_disjunctive.h"
57 #include <string.h>
58 
59 
60 #define SEPA_NAME "disjunctive"
61 #define SEPA_DESC "disjunctive cut separator"
62 #define SEPA_PRIORITY 10 /**< priority for separation */
63 #define SEPA_FREQ 0 /**< frequency for separating cuts; zero means to separate only in the root node */
64 #define SEPA_MAXBOUNDDIST 0.0 /**< maximal relative distance from the current node's dual bound to primal bound
65  * compared to best node's dual bound for applying separation.*/
66 #define SEPA_USESSUBSCIP FALSE /**< does the separator use a secondary SCIP instance? */
67 #define SEPA_DELAY TRUE /**< should separation method be delayed, if other separators found cuts? */
68 
69 #define DEFAULT_MAXRANK 20 /**< maximal rank of a cut that could not be scaled to integral coefficients (-1: unlimited) */
70 #define DEFAULT_MAXRANKINTEGRAL -1 /**< maximal rank of a cut that could be scaled to integral coefficients (-1: unlimited) */
71 #define DEFAULT_MAXWEIGHTRANGE 1e+03 /**< maximal valid range max(|weights|)/min(|weights|) of row weights */
72 #define DEFAULT_STRENGTHEN TRUE /**< strengthen cut if integer variables are present */
73 
74 #define DEFAULT_MAXDEPTH -1 /**< node depth of separating cuts (-1: no limit) */
75 #define DEFAULT_MAXROUNDS 25 /**< maximal number of separation rounds in a branching node (-1: no limit) */
76 #define DEFAULT_MAXROUNDSROOT 100 /**< maximal number of separation rounds in the root node (-1: no limit) */
77 #define DEFAULT_MAXINVCUTS 50 /**< maximal number of cuts investigated per iteration in a branching node */
78 #define DEFAULT_MAXINVCUTSROOT 250 /**< maximal number of cuts investigated per iteration in the root node */
79 #define DEFAULT_MAXCONFSDELAY 100000 /**< delay separation if number of conflict graph edges is larger than predefined value (-1: no limit) */
80 
81 #define MAKECONTINTEGRAL FALSE /**< convert continuous variable to integral variables in SCIPmakeRowIntegral() */
82 
83 
84 /** separator data */
85 struct SCIP_SepaData
86 {
87  SCIP_Bool strengthen; /**< strengthen cut if integer variables are present */
88  SCIP_CONSHDLR* conshdlr; /**< SOS1 constraint handler */
89  SCIP_Real maxweightrange; /**< maximal valid range max(|weights|)/min(|weights|) of row weights */
90  int maxrank; /**< maximal rank of a cut that could not be scaled to integral coefficients (-1: unlimited) */
91  int maxrankintegral; /**< maximal rank of a cut that could be scaled to integral coefficients (-1: unlimited) */
92  int maxdepth; /**< node depth of separating cuts (-1: no limit) */
93  int maxrounds; /**< maximal number of separation rounds in a branching node (-1: no limit) */
94  int maxroundsroot; /**< maximal number of separation rounds in the root node (-1: no limit) */
95  int maxinvcuts; /**< maximal number of cuts separated per iteration in a branching node */
96  int maxinvcutsroot; /**< maximal number of cuts separated per iteration in the root node */
97  int maxconfsdelay; /**< delay separation if number of conflict graph edges is larger than predefined value (-1: no limit) */
98  int lastncutsfound; /**< total number of cuts found after last call of separator */
99 };
100 
101 
102 /** gets rank of variable corresponding to row of \f$B^{-1}\f$ */
103 static
104 int getVarRank(
105  SCIP* scip, /**< SCIP pointer */
106  SCIP_Real* binvrow, /**< row of \f$B^{-1}\f$ */
107  SCIP_Real* rowsmaxval, /**< maximal row multiplicator from nonbasic matrix A_N */
108  SCIP_Real maxweightrange, /**< maximal valid range max(|weights|)/min(|weights|) of row weights */
109  SCIP_ROW** rows, /**< rows of LP relaxation of scip */
110  int nrows /**< number of rows */
111  )
112 {
113  SCIP_Real maxweight = 0.0;
114  int maxrank = 0;
115  int r;
116 
117  assert( scip != NULL );
118  assert( binvrow != NULL || nrows == 0 );
119  assert( rowsmaxval != NULL || nrows == 0 );
120  assert( rows != NULL || nrows == 0 );
121 
122  /* compute maximum row weights resulting from multiplication */
123  for (r = 0; r < nrows; ++r)
124  {
125  SCIP_Real val;
126 
127  val = REALABS(binvrow[r] * rowsmaxval[r]);/*lint !e613*/
128  if ( SCIPisGT(scip, val, maxweight) )
129  maxweight = val;
130  }
131 
132  /* compute rank */
133  for (r = 0; r < nrows; ++r)
134  {
135  SCIP_Real val;
136  int rank;
137 
138  val = REALABS(binvrow[r] * rowsmaxval[r]);/*lint !e613*/
139  rank = SCIProwGetRank(rows[r]);/*lint !e613*/
140  if ( rank > maxrank && SCIPisGT(scip, val * maxweightrange, maxweight) )
141  maxrank = rank;
142  }
143 
144  return maxrank;
145 }
146 
147 
148 /** gets the nonbasic coefficients of a simplex row */
149 static
151  SCIP* scip, /**< SCIP pointer */
152  SCIP_ROW** rows, /**< LP rows */
153  int nrows, /**< number LP rows */
154  SCIP_COL** cols, /**< LP columns */
155  int ncols, /**< number of LP columns */
156  SCIP_Real* coef, /**< row of \f$B^{-1} \cdot A\f$ */
157  SCIP_Real* binvrow, /**< row of \f$B^{-1}\f$ */
158  SCIP_Real* simplexcoefs, /**< pointer to store the nonbasic simplex-coefficients */
159  int* nonbasicnumber /**< pointer to store the number of nonbasic simplex-coefficients */
160  )
161 {
162  int r;
163  int c;
164 
165  assert( scip != NULL );
166  assert( rows != NULL );
167  assert( nonbasicnumber != NULL );
168  assert( simplexcoefs != NULL );
169  assert( cols != NULL );
170 
171  *nonbasicnumber = 0;
172 
173  /* note: the non-slack variables have to be added first (see the function generateDisjCutSOS1()) */
174 
175  /* get simplex-coefficients of the non-basic non-slack variables */
176  for (c = 0; c < ncols; ++c)
177  {
178  SCIP_COL* col;
179 
180  col = cols[c];
181  assert( col != NULL );
183  simplexcoefs[(*nonbasicnumber)++] = coef[c];
184  }
185 
186  /* get simplex-coefficients of the non-basic slack variables */
187  for (r = 0; r < nrows; ++r)
188  {
189  SCIP_ROW* row;
190  row = rows[r];
191  assert( row != NULL );
192 
194  {
195  assert( SCIPisFeasZero(scip, SCIPgetRowLPActivity(scip, row) - SCIProwGetRhs(row)) || SCIPisFeasZero(scip, SCIPgetRowLPActivity(scip, row) - SCIProwGetLhs(row)) );
196 
197  simplexcoefs[(*nonbasicnumber)++] = binvrow[r];
198  }
199  }
200 
201  return SCIP_OKAY;
202 }
203 
204 
205 /** computes a disjunctive cut inequality based on two simplex tableau rows */
206 static
208  SCIP* scip, /**< SCIP pointer */
209  SCIP_SEPA* sepa, /**< separator */
210  int depth, /**< current depth */
211  SCIP_ROW** rows, /**< LP rows */
212  int nrows, /**< number of LP rows */
213  SCIP_COL** cols, /**< LP columns */
214  int ncols, /**< number of LP columns */
215  int ndisjcuts, /**< number of disjunctive cuts found so far */
216  SCIP_Bool scale, /**< should cut be scaled */
217  SCIP_Bool strengthen, /**< should cut be strengthened if integer variables are present */
218  SCIP_Real cutlhs1, /**< left hand side of the first simplex row */
219  SCIP_Real cutlhs2, /**< left hand side of the second simplex row */
220  SCIP_Real bound1, /**< bound of first simplex row */
221  SCIP_Real bound2, /**< bound of second simplex row */
222  SCIP_Real* simplexcoefs1, /**< simplex coefficients of first row */
223  SCIP_Real* simplexcoefs2, /**< simplex coefficients of second row */
224  SCIP_Real* cutcoefs, /**< pointer to store cut coefficients (length: nscipvars) */
225  SCIP_ROW** row, /**< pointer to store disjunctive cut inequality */
226  SCIP_Bool* madeintegral /**< pointer to store whether cut has been scaled to integral values */
227  )
228 {
229  char cutname[SCIP_MAXSTRLEN];
230  SCIP_COL** rowcols;
231  SCIP_COL* col;
232  SCIP_Real* rowvals;
233  SCIP_Real lhsrow;
234  SCIP_Real rhsrow;
235  SCIP_Real cutlhs;
236  SCIP_Real sgn;
237  SCIP_Real lb;
238  SCIP_Real ub;
239  int nonbasicnumber = 0;
240  int rownnonz;
241  int ind;
242  int r;
243  int c;
244 
245  assert( scip != NULL );
246  assert( row != NULL );
247  assert( rows != NULL );
248  assert( cols != NULL );
249  assert( simplexcoefs1 != NULL );
250  assert( simplexcoefs2 != NULL );
251  assert( cutcoefs != NULL );
252  assert( sepa != NULL );
253  assert( madeintegral != NULL );
254 
255  *madeintegral = FALSE;
256 
257  /* check signs */
258  if ( SCIPisFeasPositive(scip, cutlhs1) == SCIPisFeasPositive(scip, cutlhs2) )
259  sgn = 1.0;
260  else
261  sgn = -1.0;
262 
263  /* check bounds */
264  if ( SCIPisInfinity(scip, REALABS(bound1)) || SCIPisInfinity(scip, REALABS(bound2)) )
265  strengthen = FALSE;
266 
267  /* compute left hand side of row (a later update is possible, see below) */
268  cutlhs = sgn * cutlhs1 * cutlhs2;
269 
270  /* add cut-coefficients of the non-basic non-slack variables */
271  for (c = 0; c < ncols; ++c)
272  {
273  col = cols[c];
274  assert( col != NULL );
275  ind = SCIPcolGetLPPos(col);
276  assert( ind >= 0 );
277 
279  {
280  lb = SCIPcolGetLb(col);
281 
282  /* for integer variables we may obtain stronger coefficients */
283  if ( strengthen && SCIPcolIsIntegral(col) )
284  {
285  SCIP_Real mval;
286  SCIP_Real mvalfloor;
287  SCIP_Real mvalceil;
288 
289  mval = (cutlhs2 * simplexcoefs1[nonbasicnumber] - cutlhs1 * simplexcoefs2[nonbasicnumber]) / (cutlhs2 * bound1 + cutlhs1 * bound2);
290  mvalfloor = SCIPfloor(scip, mval);
291  mvalceil = SCIPceil(scip, mval);
292 
293  cutcoefs[ind] = MIN(sgn * cutlhs2 * (simplexcoefs1[nonbasicnumber] - mvalfloor * bound1), sgn * cutlhs1 * (simplexcoefs2[nonbasicnumber] + mvalceil * bound2));
294  assert( SCIPisFeasLE(scip, cutcoefs[ind], MAX(sgn * cutlhs2 * simplexcoefs1[nonbasicnumber], sgn * cutlhs1 * simplexcoefs2[nonbasicnumber])) );
295  }
296  else
297  cutcoefs[ind] = MAX(sgn * cutlhs2 * simplexcoefs1[nonbasicnumber], sgn * cutlhs1 * simplexcoefs2[nonbasicnumber]);
298 
299  cutlhs += cutcoefs[ind] * lb;
300  ++nonbasicnumber;
301  }
302  else if ( SCIPcolGetBasisStatus(col) == SCIP_BASESTAT_UPPER )
303  {
304  ub = SCIPcolGetUb(col);
305 
306  /* for integer variables we may obtain stronger coefficients */
307  if ( strengthen && SCIPcolIsIntegral(col) )
308  {
309  SCIP_Real mval;
310  SCIP_Real mvalfloor;
311  SCIP_Real mvalceil;
312 
313  mval = (cutlhs2 * simplexcoefs1[nonbasicnumber] - cutlhs1 * simplexcoefs2[nonbasicnumber]) / (cutlhs2 * bound1 + cutlhs1 * bound2);
314  mvalfloor = SCIPfloor(scip, -mval);
315  mvalceil = SCIPceil(scip, -mval);
316 
317  cutcoefs[ind] = MAX(sgn * cutlhs2 * (simplexcoefs1[nonbasicnumber] + mvalfloor * bound1), sgn * cutlhs1 * (simplexcoefs2[nonbasicnumber] - mvalceil * bound2));
318  assert( SCIPisFeasLE(scip, -cutcoefs[ind], -MIN(sgn * cutlhs2 * simplexcoefs1[nonbasicnumber], sgn * cutlhs1 * simplexcoefs2[nonbasicnumber])) );
319  }
320  else
321  cutcoefs[ind] = MIN(sgn * cutlhs2 * simplexcoefs1[nonbasicnumber], sgn * cutlhs1 * simplexcoefs2[nonbasicnumber]);
322 
323  cutlhs += cutcoefs[ind] * ub;
324  ++nonbasicnumber;
325  }
326  else
327  {
328  assert( SCIPcolGetBasisStatus(col) != SCIP_BASESTAT_ZERO );
329  cutcoefs[ind] = 0.0;
330  }
331  }
332 
333  /* add cut-coefficients of the non-basic slack variables */
334  for (r = 0; r < nrows; ++r)
335  {
336  rhsrow = SCIProwGetRhs(rows[r]) - SCIProwGetConstant(rows[r]);
337  lhsrow = SCIProwGetLhs(rows[r]) - SCIProwGetConstant(rows[r]);
338 
339  assert( SCIProwGetBasisStatus(rows[r]) != SCIP_BASESTAT_ZERO );
340  assert( SCIPisFeasZero(scip, lhsrow - rhsrow) || SCIPisNegative(scip, lhsrow - rhsrow) );
341  assert( SCIProwIsInLP(rows[r]) );
342 
343  if ( SCIProwGetBasisStatus(rows[r]) != SCIP_BASESTAT_BASIC )
344  {
345  SCIP_Real cutcoef;
346 
347  if ( SCIProwGetBasisStatus(rows[r]) == SCIP_BASESTAT_UPPER )
348  {
349  assert( SCIPisFeasZero(scip, SCIPgetRowLPActivity(scip, rows[r]) - SCIProwGetRhs(rows[r])) );
350 
351  cutcoef = MAX(sgn * cutlhs2 * simplexcoefs1[nonbasicnumber], sgn * cutlhs1 * simplexcoefs2[nonbasicnumber]);
352  cutlhs -= cutcoef * rhsrow;
353  ++nonbasicnumber;
354  }
355  else /* SCIProwGetBasisStatus(rows[r]) == SCIP_BASESTAT_LOWER */
356  {
357  assert( SCIProwGetBasisStatus(rows[r]) == SCIP_BASESTAT_LOWER );
358  assert( SCIPisFeasZero(scip, SCIPgetRowLPActivity(scip, rows[r]) - SCIProwGetLhs(rows[r])) );
359 
360  cutcoef = MIN(sgn * cutlhs2 * simplexcoefs1[nonbasicnumber], sgn * cutlhs1 * simplexcoefs2[nonbasicnumber]);
361  cutlhs -= cutcoef * lhsrow;
362  ++nonbasicnumber;
363  }
364 
365  rownnonz = SCIProwGetNNonz(rows[r]);
366  rowvals = SCIProwGetVals(rows[r]);
367  rowcols = SCIProwGetCols(rows[r]);
368 
369  for (c = 0; c < rownnonz; ++c)
370  {
371  ind = SCIPcolGetLPPos(rowcols[c]);
372 
373  /* if column is not in LP, then return without generating cut */
374  if ( ind < 0 )
375  {
376  *row = NULL;
377  return SCIP_OKAY;
378  }
379 
380  cutcoefs[ind] -= cutcoef * rowvals[c];
381  }
382  }
383  }
384 
385  /* create cut */
386  (void) SCIPsnprintf(cutname, SCIP_MAXSTRLEN, "%s_%" SCIP_LONGINT_FORMAT "_%d", SCIPsepaGetName(sepa), SCIPgetNLPs(scip), ndisjcuts);
387 
388  /* we create the cut as locally valid, SCIP will make it globally valid if we are at the root node */
389  SCIP_CALL( SCIPcreateEmptyRowSepa(scip, row, sepa, cutname, cutlhs, SCIPinfinity(scip), TRUE, FALSE, TRUE) );
390 
391  SCIP_CALL( SCIPcacheRowExtensions(scip, *row) );
392  for (c = 0; c < ncols; ++c)
393  {
394  ind = SCIPcolGetLPPos(cols[c]);
395  assert( ind >= 0 );
396  if ( ! SCIPisFeasZero(scip, cutcoefs[ind]) )
397  {
398  SCIP_CALL( SCIPaddVarToRow(scip, *row, SCIPcolGetVar(cols[c]), cutcoefs[ind] ) );
399  }
400  }
401  SCIP_CALL( SCIPflushRowExtensions(scip, *row) );
402 
403  /* try to scale the cut to integral values
404  * @todo find better but still stable disjunctive cut settings
405  */
406  if ( scale )
407  {
408  SCIP_Longint maxdnom;
409  SCIP_Real maxscale;
410 
411  assert( depth >= 0 );
412  if( depth == 0 )
413  {
414  maxdnom = 100;
415  maxscale = 100.0;
416  }
417  else
418  {
419  maxdnom = 10;
420  maxscale = 10.0;
421  }
422 
423  SCIP_CALL( SCIPmakeRowIntegral(scip, *row, -SCIPepsilon(scip), SCIPsumepsilon(scip), maxdnom, maxscale, TRUE, madeintegral) );
424  }
425 
426  return SCIP_OKAY;
427 }
428 
429 
430 /*
431  * Callback methods
432  */
433 
434 /** copy method for separator plugins (called when SCIP copies plugins) */
435 static
436 SCIP_DECL_SEPACOPY(sepaCopyDisjunctive)
437 {
438  assert( scip != NULL );
439  assert( sepa != NULL );
440  assert( strcmp(SCIPsepaGetName(sepa), SEPA_NAME) == 0 );
441 
442  /* call inclusion method of constraint handler */
444 
445  return SCIP_OKAY;
446 }
447 
448 
449 /** destructor of separator to free user data (called when SCIP is exiting) */
450 static
451 SCIP_DECL_SEPAFREE(sepaFreeDisjunctive)/*lint --e{715}*/
452 {
453  SCIP_SEPADATA* sepadata;
454 
455  assert( strcmp(SCIPsepaGetName(sepa), SEPA_NAME) == 0 );
456 
457  /* free separator data */
458  sepadata = SCIPsepaGetData(sepa);
459  assert( sepadata != NULL );
460 
461  SCIPfreeBlockMemory(scip, &sepadata);
462 
463  SCIPsepaSetData(sepa, NULL);
464 
465  return SCIP_OKAY;
466 }
467 
468 
469 /** solving process initialization method of separator */
470 static
471 SCIP_DECL_SEPAEXITSOL(sepaInitsolDisjunctive)
472 { /*lint --e{715}*/
473  SCIP_SEPADATA* sepadata;
474 
475  sepadata = SCIPsepaGetData(sepa);
476  assert(sepadata != NULL);
477 
478  sepadata->conshdlr = SCIPfindConshdlr(scip, "SOS1");
479 
480  return SCIP_OKAY;
481 }
482 
483 
484 /** LP solution separation method for disjunctive cuts */
485 static
486 SCIP_DECL_SEPAEXECLP(sepaExeclpDisjunctive)
487 {
488  SCIP_SEPADATA* sepadata;
489  SCIP_CONSHDLR* conshdlr;
490  SCIP_DIGRAPH* conflictgraph;
491  SCIP_ROW** rows;
492  SCIP_COL** cols;
493  SCIP_Real* cutcoefs = NULL;
494  SCIP_Real* simplexcoefs1 = NULL;
495  SCIP_Real* simplexcoefs2 = NULL;
496  SCIP_Real* coef = NULL;
497  SCIP_Real* binvrow = NULL;
498  SCIP_Real* rowsmaxval = NULL;
499  SCIP_Real* violationarray = NULL;
500  int* fixings1 = NULL;
501  int* fixings2 = NULL;
502  int* basisind = NULL;
503  int* basisrow = NULL;
504  int* varrank = NULL;
505  int* edgearray = NULL;
506  int nedges;
507  int ndisjcuts;
508  int nrelevantedges;
509  int nsos1vars;
510  int nconss;
511  int maxcuts;
512  int ncalls;
513  int ncols;
514  int nrows;
515  int ind;
516  int j;
517  int i;
518 
519  assert( sepa != NULL );
520  assert( strcmp(SCIPsepaGetName(sepa), SEPA_NAME) == 0 );
521  assert( scip != NULL );
522  assert( result != NULL );
523 
524  *result = SCIP_DIDNOTRUN;
525 
526  if( !allowlocal )
527  return SCIP_OKAY;
528 
529  /* only generate disjunctive cuts if we are not close to terminating */
530  if ( SCIPisStopped(scip) )
531  return SCIP_OKAY;
532 
533  /* only generate disjunctive cuts if an optimal LP solution is at hand */
535  return SCIP_OKAY;
536 
537  /* only generate disjunctive cuts if the LP solution is basic */
538  if ( ! SCIPisLPSolBasic(scip) )
539  return SCIP_OKAY;
540 
541  /* get LP data */
542  SCIP_CALL( SCIPgetLPColsData(scip, &cols, &ncols) );
543  SCIP_CALL( SCIPgetLPRowsData(scip, &rows, &nrows) );
544 
545  /* return if LP has no columns or no rows */
546  if ( ncols == 0 || nrows == 0 )
547  return SCIP_OKAY;
548 
549  assert( cols != NULL );
550  assert( rows != NULL );
551 
552  /* get sepa data */
553  sepadata = SCIPsepaGetData(sepa);
554  assert( sepadata != NULL );
555 
556  /* get constraint handler */
557  conshdlr = sepadata->conshdlr;
558  if ( conshdlr == NULL )
559  return SCIP_OKAY;
560 
561  /* get number of constraints */
562  nconss = SCIPconshdlrGetNConss(conshdlr);
563  if ( nconss == 0 )
564  return SCIP_OKAY;
565 
566  /* check for maxdepth < depth, maxinvcutsroot = 0 and maxinvcuts = 0 */
567  if ( ( sepadata->maxdepth >= 0 && sepadata->maxdepth < depth )
568  || ( depth == 0 && sepadata->maxinvcutsroot == 0 )
569  || ( depth > 0 && sepadata->maxinvcuts == 0 ) )
570  return SCIP_OKAY;
571 
572  /* only call the cut separator a given number of times at each node */
573  ncalls = SCIPsepaGetNCallsAtNode(sepa);
574  if ( (depth == 0 && sepadata->maxroundsroot >= 0 && ncalls >= sepadata->maxroundsroot)
575  || (depth > 0 && sepadata->maxrounds >= 0 && ncalls >= sepadata->maxrounds) )
576  return SCIP_OKAY;
577 
578  /* get conflict graph and number of conflict graph edges (note that the digraph arcs were added in both directions) */
579  conflictgraph = SCIPgetConflictgraphSOS1(conshdlr);
580  if( conflictgraph == NULL )
581  return SCIP_OKAY;
582 
583  nedges = (int)SCIPceil(scip, (SCIP_Real)SCIPdigraphGetNArcs(conflictgraph)/2);
584 
585  /* if too many conflict graph edges, the separator can be slow: delay it until no other cuts have been found */
586  if ( sepadata->maxconfsdelay >= 0 && nedges >= sepadata->maxconfsdelay )
587  {
588  int ncutsfound;
589 
590  ncutsfound = SCIPgetNCutsFound(scip);
591  if ( ncutsfound > sepadata->lastncutsfound || ! SCIPsepaWasLPDelayed(sepa) )
592  {
593  sepadata->lastncutsfound = ncutsfound;
594  *result = SCIP_DELAYED;
595  return SCIP_OKAY;
596  }
597  }
598 
599  /* check basis status */
600  for (j = 0; j < ncols; ++j)
601  {
602  if ( SCIPcolGetBasisStatus(cols[j]) == SCIP_BASESTAT_ZERO )
603  return SCIP_OKAY;
604  }
605 
606  /* check accuracy of rows */
607  for (j = 0; j < nrows; ++j)
608  {
609  SCIP_ROW* row;
610 
611  row = rows[j];
612 
613  if ( ( SCIProwGetBasisStatus(row) == SCIP_BASESTAT_UPPER && ! SCIPisEQ(scip, SCIPgetRowLPActivity(scip, row), SCIProwGetRhs(row)) )
614  || ( SCIProwGetBasisStatus(row) == SCIP_BASESTAT_LOWER && ! SCIPisEQ(scip, SCIPgetRowLPActivity(scip, row), SCIProwGetLhs(row)) ) )
615  return SCIP_OKAY;
616  }
617 
618  /* get number of SOS1 variables */
619  nsos1vars = SCIPgetNSOS1Vars(conshdlr);
620 
621  /* allocate buffer arrays */
622  SCIP_CALL( SCIPallocBufferArray(scip, &edgearray, nedges) );
623  SCIP_CALL( SCIPallocBufferArray(scip, &fixings1, nedges) );
624  SCIP_CALL( SCIPallocBufferArray(scip, &fixings2, nedges) );
625  SCIP_CALL( SCIPallocBufferArray(scip, &violationarray, nedges) );
626 
627  /* get all violated conflicts {i, j} in the conflict graph and sort them based on the degree of a violation value */
628  nrelevantedges = 0;
629  for (j = 0; j < nsos1vars; ++j)
630  {
631  SCIP_VAR* var;
632 
633  var = SCIPnodeGetVarSOS1(conflictgraph, j);
634 
636  {
637  int* succ;
638  int nsucc;
639 
640  /* get successors and number of successors */
641  nsucc = SCIPdigraphGetNSuccessors(conflictgraph, j);
642  succ = SCIPdigraphGetSuccessors(conflictgraph, j);
643 
644  for (i = 0; i < nsucc; ++i)
645  {
646  SCIP_VAR* varsucc;
647  int succind;
648 
649  succind = succ[i];
650  varsucc = SCIPnodeGetVarSOS1(conflictgraph, succind);
651  if ( SCIPvarIsActive(varsucc) && succind < j && ! SCIPisFeasZero(scip, SCIPgetSolVal(scip, NULL, varsucc) ) &&
653  {
654  fixings1[nrelevantedges] = j;
655  fixings2[nrelevantedges] = succind;
656  edgearray[nrelevantedges] = nrelevantedges;
657  violationarray[nrelevantedges++] = SCIPgetSolVal(scip, NULL, var) * SCIPgetSolVal(scip, NULL, varsucc);
658  }
659  }
660  }
661  }
662 
663  /* sort violation score values */
664  if ( nrelevantedges > 0)
665  SCIPsortDownRealInt(violationarray, edgearray, nrelevantedges);
666  else
667  {
668  SCIPfreeBufferArrayNull(scip, &violationarray);
669  SCIPfreeBufferArrayNull(scip, &fixings2);
670  SCIPfreeBufferArrayNull(scip, &fixings1);
671  SCIPfreeBufferArrayNull(scip, &edgearray);
672 
673  return SCIP_OKAY;
674  }
675  SCIPfreeBufferArrayNull(scip, &violationarray);
676 
677  /* compute maximal number of cuts */
678  if ( depth == 0 )
679  maxcuts = MIN(sepadata->maxinvcutsroot, nrelevantedges);
680  else
681  maxcuts = MIN(sepadata->maxinvcuts, nrelevantedges);
682  assert( maxcuts > 0 );
683 
684  /* allocate buffer arrays */
685  SCIP_CALL( SCIPallocBufferArray(scip, &varrank, ncols) );
686  SCIP_CALL( SCIPallocBufferArray(scip, &rowsmaxval, nrows) );
687  SCIP_CALL( SCIPallocBufferArray(scip, &basisrow, ncols) );
688  SCIP_CALL( SCIPallocBufferArray(scip, &binvrow, nrows) );
689  SCIP_CALL( SCIPallocBufferArray(scip, &coef, ncols) );
690  SCIP_CALL( SCIPallocBufferArray(scip, &simplexcoefs1, ncols) );
691  SCIP_CALL( SCIPallocBufferArray(scip, &simplexcoefs2, ncols) );
692  SCIP_CALL( SCIPallocBufferArray(scip, &cutcoefs, ncols) );
693  SCIP_CALL( SCIPallocBufferArray(scip, &basisind, nrows) );
694 
695  /* get basis indices */
696  SCIP_CALL( SCIPgetLPBasisInd(scip, basisind) );
697 
698  /* create vector "basisrow" with basisrow[column of non-slack basis variable] = corresponding row of B^-1;
699  * compute maximum absolute value of nonbasic row coefficients */
700  for (j = 0; j < nrows; ++j)
701  {
702  SCIP_COL** rowcols;
703  SCIP_Real* rowvals;
704  SCIP_ROW* row;
705  SCIP_Real val;
706  SCIP_Real max = 0.0;
707  int nnonz;
708 
709  /* fill basisrow vector */
710  ind = basisind[j];
711  if ( ind >= 0 )
712  basisrow[ind] = j;
713 
714  /* compute maximum absolute value of nonbasic row coefficients */
715  row = rows[j];
716  assert( row != NULL );
717  rowvals = SCIProwGetVals(row);
718  nnonz = SCIProwGetNNonz(row);
719  rowcols = SCIProwGetCols(row);
720 
721  for (i = 0; i < nnonz; ++i)
722  {
724  {
725  val = REALABS(rowvals[i]);
726  if ( SCIPisFeasGT(scip, val, max) )
727  max = REALABS(val);
728  }
729  }
730 
731  /* handle slack variable coefficient and save maximum value */
732  rowsmaxval[j] = MAX(max, 1.0);
733  }
734 
735  /* initialize variable ranks with -1 */
736  for (j = 0; j < ncols; ++j)
737  varrank[j] = -1;
738 
739  /* free buffer array */
740  SCIPfreeBufferArrayNull(scip, &basisind);
741 
742  /* for the most promising disjunctions: try to generate disjunctive cuts */
743  ndisjcuts = 0;
744  for (i = 0; i < maxcuts; ++i)
745  {
746  SCIP_Bool madeintegral;
747  SCIP_Real cutlhs1;
748  SCIP_Real cutlhs2;
749  SCIP_Real bound1;
750  SCIP_Real bound2;
751  SCIP_ROW* row = NULL;
752  SCIP_VAR* var;
753  SCIP_COL* col;
754 
755  int nonbasicnumber;
756  int cutrank = 0;
757  int edgenumber;
758  int rownnonz;
759 
760  edgenumber = edgearray[i];
761 
762  /* determine first simplex row */
763  var = SCIPnodeGetVarSOS1(conflictgraph, fixings1[edgenumber]);
764  col = SCIPvarGetCol(var);
765  ind = SCIPcolGetLPPos(col);
766  assert( ind >= 0 );
767  assert( SCIPcolGetBasisStatus(col) == SCIP_BASESTAT_BASIC );
768 
769  /* get the 'ind'th row of B^-1 and B^-1 \cdot A */
770  SCIP_CALL( SCIPgetLPBInvRow(scip, basisrow[ind], binvrow, NULL, NULL) );
771  SCIP_CALL( SCIPgetLPBInvARow(scip, basisrow[ind], binvrow, coef, NULL, NULL) );
772 
773  /* get the simplex-coefficients of the non-basic variables */
774  SCIP_CALL( getSimplexCoefficients(scip, rows, nrows, cols, ncols, coef, binvrow, simplexcoefs1, &nonbasicnumber) );
775 
776  /* get rank of variable if not known already */
777  if ( varrank[ind] < 0 )
778  varrank[ind] = getVarRank(scip, binvrow, rowsmaxval, sepadata->maxweightrange, rows, nrows);
779  cutrank = MAX(cutrank, varrank[ind]);
780 
781  /* get right hand side and bound of simplex talbeau row */
782  cutlhs1 = SCIPcolGetPrimsol(col);
783  if ( SCIPisFeasPositive(scip, cutlhs1) )
784  bound1 = SCIPcolGetUb(col);
785  else
786  bound1 = SCIPcolGetLb(col);
787 
788  /* determine second simplex row */
789  var = SCIPnodeGetVarSOS1(conflictgraph, fixings2[edgenumber]);
790  col = SCIPvarGetCol(var);
791  ind = SCIPcolGetLPPos(col);
792  assert( ind >= 0 );
793  assert( SCIPcolGetBasisStatus(col) == SCIP_BASESTAT_BASIC );
794 
795  /* get the 'ind'th row of B^-1 and B^-1 \cdot A */
796  SCIP_CALL( SCIPgetLPBInvRow(scip, basisrow[ind], binvrow, NULL, NULL) );
797  SCIP_CALL( SCIPgetLPBInvARow(scip, basisrow[ind], binvrow, coef, NULL, NULL) );
798 
799  /* get the simplex-coefficients of the non-basic variables */
800  SCIP_CALL( getSimplexCoefficients(scip, rows, nrows, cols, ncols, coef, binvrow, simplexcoefs2, &nonbasicnumber) );
801 
802  /* get rank of variable if not known already */
803  if ( varrank[ind] < 0 )
804  varrank[ind] = getVarRank(scip, binvrow, rowsmaxval, sepadata->maxweightrange, rows, nrows);
805  cutrank = MAX(cutrank, varrank[ind]);
806 
807  /* get right hand side and bound of simplex talbeau row */
808  cutlhs2 = SCIPcolGetPrimsol(col);
809  if ( SCIPisFeasPositive(scip, cutlhs2) )
810  bound2 = SCIPcolGetUb(col);
811  else
812  bound2 = SCIPcolGetLb(col);
813 
814  /* add coefficients to cut */
815  SCIP_CALL( generateDisjCutSOS1(scip, sepa, depth, rows, nrows, cols, ncols, ndisjcuts, MAKECONTINTEGRAL, sepadata->strengthen, cutlhs1, cutlhs2, bound1, bound2, simplexcoefs1, simplexcoefs2, cutcoefs, &row, &madeintegral) );
816  if ( row == NULL )
817  continue;
818 
819  /* raise cutrank for present cut */
820  ++cutrank;
821 
822  /* check if there are numerical evidences */
823  if ( ( madeintegral && ( sepadata->maxrankintegral == -1 || cutrank <= sepadata->maxrankintegral ) )
824  || ( ! madeintegral && ( sepadata->maxrank == -1 || cutrank <= sepadata->maxrank ) ) )
825  {
826  /* possibly add cut to LP if it is useful; in case the lhs of the cut is minus infinity (due to scaling) the cut is useless */
827  rownnonz = SCIProwGetNNonz(row);
828  if ( rownnonz > 0 && ! SCIPisInfinity(scip, -SCIProwGetLhs(row)) && ! SCIProwIsInLP(row) && SCIPisCutEfficacious(scip, NULL, row) )
829  {
830  SCIP_Bool infeasible;
831 
832  /* set cut rank */
833  SCIProwChgRank(row, cutrank);
834 
835  /* add cut */
836  SCIP_CALL( SCIPaddRow(scip, row, FALSE, &infeasible) );
837  SCIPdebug( SCIP_CALL( SCIPprintRow(scip, row, NULL) ) );
838  if ( infeasible )
839  {
840  *result = SCIP_CUTOFF;
841  break;
842  }
843  ++ndisjcuts;
844  }
845  }
846 
847  /* release row */
848  SCIP_CALL( SCIPreleaseRow(scip, &row) );
849  }
850 
851  /* save total number of cuts found so far */
852  sepadata->lastncutsfound = SCIPgetNCutsFound(scip);
853 
854  /* evaluate the result of the separation */
855  if ( *result != SCIP_CUTOFF )
856  {
857  if ( ndisjcuts > 0 )
858  *result = SCIP_SEPARATED;
859  else
860  *result = SCIP_DIDNOTFIND;
861  }
862 
863  SCIPdebugMsg(scip, "Number of found disjunctive cuts: %d.\n", ndisjcuts);
864 
865  /* free buffer arrays */
866  SCIPfreeBufferArrayNull(scip, &cutcoefs);
867  SCIPfreeBufferArrayNull(scip, &simplexcoefs2);
868  SCIPfreeBufferArrayNull(scip, &simplexcoefs1);
869  SCIPfreeBufferArrayNull(scip, &coef);
870  SCIPfreeBufferArrayNull(scip, &binvrow);
871  SCIPfreeBufferArrayNull(scip, &basisrow);
872  SCIPfreeBufferArrayNull(scip, &rowsmaxval);
873  SCIPfreeBufferArrayNull(scip, &varrank);
874  SCIPfreeBufferArrayNull(scip, &fixings2);
875  SCIPfreeBufferArrayNull(scip, &fixings1);
876  SCIPfreeBufferArrayNull(scip, &edgearray);
877 
878  return SCIP_OKAY;
879 }
880 
881 
882 /** creates the disjunctive cut separator and includes it in SCIP */
884  SCIP* scip /**< SCIP data structure */
885  )
886 {
887  SCIP_SEPADATA* sepadata = NULL;
888  SCIP_SEPA* sepa = NULL;
889 
890  /* create separator data */
891  SCIP_CALL( SCIPallocBlockMemory(scip, &sepadata) );
892  sepadata->conshdlr = NULL;
893  sepadata->lastncutsfound = 0;
894 
895  /* include separator */
897  SEPA_USESSUBSCIP, SEPA_DELAY, sepaExeclpDisjunctive, NULL, sepadata) );
898 
899  assert( sepa != NULL );
900 
901  /* set non fundamental callbacks via setter functions */
902  SCIP_CALL( SCIPsetSepaCopy(scip, sepa, sepaCopyDisjunctive) );
903  SCIP_CALL( SCIPsetSepaFree(scip, sepa, sepaFreeDisjunctive) );
904  SCIP_CALL( SCIPsetSepaInitsol(scip, sepa, sepaInitsolDisjunctive) );
905 
906  /* add separator parameters */
907  SCIP_CALL( SCIPaddBoolParam(scip, "separating/" SEPA_NAME "/strengthen",
908  "strengthen cut if integer variables are present.",
909  &sepadata->strengthen, TRUE, DEFAULT_STRENGTHEN, NULL, NULL) );
910 
911  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxdepth",
912  "node depth of separating bipartite disjunctive cuts (-1: no limit)",
913  &sepadata->maxdepth, TRUE, DEFAULT_MAXDEPTH, -1, INT_MAX, NULL, NULL) );
914 
915  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxrounds",
916  "maximal number of separation rounds per iteration in a branching node (-1: no limit)",
917  &sepadata->maxrounds, TRUE, DEFAULT_MAXROUNDS, -1, INT_MAX, NULL, NULL) );
918 
919  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxroundsroot",
920  "maximal number of separation rounds in the root node (-1: no limit)",
921  &sepadata->maxroundsroot, TRUE, DEFAULT_MAXROUNDSROOT, -1, INT_MAX, NULL, NULL) );
922 
923  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxinvcuts",
924  "maximal number of cuts investigated per iteration in a branching node",
925  &sepadata->maxinvcuts, TRUE, DEFAULT_MAXINVCUTS, 0, INT_MAX, NULL, NULL) );
926 
927  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxinvcutsroot",
928  "maximal number of cuts investigated per iteration in the root node",
929  &sepadata->maxinvcutsroot, TRUE, DEFAULT_MAXINVCUTSROOT, 0, INT_MAX, NULL, NULL) );
930 
931  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxconfsdelay",
932  "delay separation if number of conflict graph edges is larger than predefined value (-1: no limit)",
933  &sepadata->maxconfsdelay, TRUE, DEFAULT_MAXCONFSDELAY, -1, INT_MAX, NULL, NULL) );
934 
935  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxrank",
936  "maximal rank of a disj. cut that could not be scaled to integral coefficients (-1: unlimited)",
937  &sepadata->maxrank, FALSE, DEFAULT_MAXRANK, -1, INT_MAX, NULL, NULL) );
938 
939  SCIP_CALL( SCIPaddIntParam(scip, "separating/" SEPA_NAME "/maxrankintegral",
940  "maximal rank of a disj. cut that could be scaled to integral coefficients (-1: unlimited)",
941  &sepadata->maxrankintegral, FALSE, DEFAULT_MAXRANKINTEGRAL, -1, INT_MAX, NULL, NULL) );
942 
943  SCIP_CALL( SCIPaddRealParam(scip, "separating/" SEPA_NAME "/maxweightrange",
944  "maximal valid range max(|weights|)/min(|weights|) of row weights",
945  &sepadata->maxweightrange, TRUE, DEFAULT_MAXWEIGHTRANGE, 1.0, SCIP_REAL_MAX, NULL, NULL) );
946 
947  return SCIP_OKAY;
948 }
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPgetLPBInvRow(SCIP *scip, int r, SCIP_Real *coefs, int *inds, int *ninds)
Definition: scip_lp.c:705
#define DEFAULT_MAXINVCUTS
static SCIP_DECL_SEPAEXECLP(sepaExeclpDisjunctive)
SCIP_RETCODE SCIPcacheRowExtensions(SCIP *scip, SCIP_ROW *row)
Definition: scip_lp.c:1626
public methods for SCIP parameter handling
static SCIP_DECL_SEPAEXITSOL(sepaInitsolDisjunctive)
public methods for memory management
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip_cons.c:877
SCIP_RETCODE SCIPflushRowExtensions(SCIP *scip, SCIP_ROW *row)
Definition: scip_lp.c:1649
#define DEFAULT_MAXINVCUTSROOT
#define SCIP_MAXSTRLEN
Definition: def.h:293
SCIP_BASESTAT SCIPcolGetBasisStatus(SCIP_COL *col)
Definition: lp.c:16997
SCIP_RETCODE SCIPaddVarToRow(SCIP *scip, SCIP_ROW *row, SCIP_VAR *var, SCIP_Real val)
Definition: scip_lp.c:1686
int SCIProwGetNNonz(SCIP_ROW *row)
Definition: lp.c:17179
int * SCIPdigraphGetSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7721
#define SEPA_PRIORITY
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
Definition: lp.c:17258
#define FALSE
Definition: def.h:87
SCIP_Bool SCIPcolIsIntegral(SCIP_COL *col)
Definition: lp.c:17038
SCIP_Real SCIPcolGetUb(SCIP_COL *col)
Definition: lp.c:16939
SCIP_BASESTAT SCIProwGetBasisStatus(SCIP_ROW *row)
Definition: lp.c:17306
SCIP_Real SCIPinfinity(SCIP *scip)
int SCIPgetNSOS1Vars(SCIP_CONSHDLR *conshdlr)
Definition: cons_sos1.c:10680
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
#define SCIPdebug(x)
Definition: pub_message.h:84
const char * SCIPsepaGetName(SCIP_SEPA *sepa)
Definition: sepa.c:734
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
#define DEFAULT_MAXWEIGHTRANGE
public methods for problem variables
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:99
disjunctive cut separator
void SCIPsortDownRealInt(SCIP_Real *realarray, int *intarray, int len)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPgetLPColsData(SCIP *scip, SCIP_COL ***cols, int *ncols)
Definition: scip_lp.c:462
SCIP_RETCODE SCIPsetSepaCopy(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPACOPY((*sepacopy)))
Definition: scip_sepa.c:142
#define SCIPdebugMsg
Definition: scip_message.h:69
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:74
public methods for separator plugins
SCIP_Real SCIPepsilon(SCIP *scip)
public methods for numerical tolerances
SCIP_SEPADATA * SCIPsepaGetData(SCIP_SEPA *sepa)
Definition: sepa.c:624
public methods for querying solving statistics
SCIP_Bool SCIProwIsInLP(SCIP_ROW *row)
Definition: lp.c:17489
#define SEPA_MAXBOUNDDIST
public methods for the branch-and-bound tree
SCIP_Bool SCIPisLPSolBasic(SCIP *scip)
Definition: scip_lp.c:658
SCIP_Bool SCIPisCutEfficacious(SCIP *scip, SCIP_SOL *sol, SCIP_ROW *cut)
Definition: scip_cut.c:108
public methods for managing constraints
SCIP_Real SCIPcolGetPrimsol(SCIP_COL *col)
Definition: lp.c:16962
#define MAKECONTINTEGRAL
int SCIPgetNCutsFound(SCIP *scip)
#define SCIPfreeBufferArrayNull(scip, ptr)
Definition: scip_mem.h:128
int SCIPsepaGetNCallsAtNode(SCIP_SEPA *sepa)
Definition: sepa.c:871
SCIP_Real SCIPcolGetLb(SCIP_COL *col)
Definition: lp.c:16929
static SCIP_DECL_SEPAFREE(sepaFreeDisjunctive)
void SCIPsepaSetData(SCIP_SEPA *sepa, SCIP_SEPADATA *sepadata)
Definition: sepa.c:634
SCIP_RETCODE SCIPincludeSepaDisjunctive(SCIP *scip)
#define NULL
Definition: lpi_spx1.cpp:155
#define REALABS(x)
Definition: def.h:201
SCIP_RETCODE SCIPsetSepaInitsol(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAINITSOL((*sepainitsol)))
Definition: scip_sepa.c:206
#define DEFAULT_MAXCONFSDELAY
#define SCIP_CALL(x)
Definition: def.h:384
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SEPA_DESC
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
Definition: lp.c:17268
SCIP_Real SCIPgetRowLPActivity(SCIP *scip, SCIP_ROW *row)
Definition: scip_lp.c:1978
SCIP_RETCODE SCIPaddRow(SCIP *scip, SCIP_ROW *row, SCIP_Bool forcecut, SCIP_Bool *infeasible)
Definition: scip_cut.c:241
SCIP_DIGRAPH * SCIPgetConflictgraphSOS1(SCIP_CONSHDLR *conshdlr)
Definition: cons_sos1.c:10658
SCIP_COL ** SCIProwGetCols(SCIP_ROW *row)
Definition: lp.c:17204
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4590
public methods for constraint handler plugins and constraints
SCIP_RETCODE SCIPincludeSepaBasic(SCIP *scip, SCIP_SEPA **sepa, const char *name, const char *desc, int priority, int freq, SCIP_Real maxbounddist, SCIP_Bool usessubscip, SCIP_Bool delay, SCIP_DECL_SEPAEXECLP((*sepaexeclp)), SCIP_DECL_SEPAEXECSOL((*sepaexecsol)), SCIP_SEPADATA *sepadata)
Definition: scip_sepa.c:100
SCIP_Bool SCIPsepaWasLPDelayed(SCIP_SEPA *sepa)
Definition: sepa.c:1090
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:115
SCIP_RETCODE SCIPgetLPBInvARow(SCIP *scip, int r, SCIP_Real *binvrow, SCIP_Real *coefs, int *inds, int *ninds)
Definition: scip_lp.c:776
SCIP_Real * SCIProwGetVals(SCIP_ROW *row)
Definition: lp.c:17214
static SCIP_DECL_SEPACOPY(sepaCopyDisjunctive)
public data structures and miscellaneous methods
int SCIPdigraphGetNSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7706
#define SCIP_Bool
Definition: def.h:84
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
Definition: scip_lp.c:159
#define SEPA_FREQ
#define MAX(x, y)
Definition: tclique_def.h:83
int SCIPdigraphGetNArcs(SCIP_DIGRAPH *digraph)
Definition: misc.c:7688
public methods for LP management
SCIP_RETCODE SCIPcreateEmptyRowSepa(SCIP *scip, SCIP_ROW **row, SCIP_SEPA *sepa, const char *name, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool removable)
Definition: scip_lp.c:1444
public methods for cuts and aggregation rows
static int getVarRank(SCIP *scip, SCIP_Real *binvrow, SCIP_Real *rowsmaxval, SCIP_Real maxweightrange, SCIP_ROW **rows, int nrows)
SCIP_VAR * SCIPnodeGetVarSOS1(SCIP_DIGRAPH *conflictgraph, int node)
Definition: cons_sos1.c:10757
#define DEFAULT_MAXROUNDS
#define DEFAULT_STRENGTHEN
SCIP_COL * SCIPvarGetCol(SCIP_VAR *var)
Definition: var.c:17621
SCIP_RETCODE SCIPgetLPBasisInd(SCIP *scip, int *basisind)
Definition: scip_lp.c:677
static SCIP_RETCODE generateDisjCutSOS1(SCIP *scip, SCIP_SEPA *sepa, int depth, SCIP_ROW **rows, int nrows, SCIP_COL **cols, int ncols, int ndisjcuts, SCIP_Bool scale, SCIP_Bool strengthen, SCIP_Real cutlhs1, SCIP_Real cutlhs2, SCIP_Real bound1, SCIP_Real bound2, SCIP_Real *simplexcoefs1, SCIP_Real *simplexcoefs2, SCIP_Real *cutcoefs, SCIP_ROW **row, SCIP_Bool *madeintegral)
static SCIP_RETCODE getSimplexCoefficients(SCIP *scip, SCIP_ROW **rows, int nrows, SCIP_COL **cols, int ncols, SCIP_Real *coef, SCIP_Real *binvrow, SCIP_Real *simplexcoefs, int *nonbasicnumber)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
#define SEPA_NAME
public methods for the LP relaxation, rows and columns
int SCIProwGetRank(SCIP_ROW *row)
Definition: lp.c:17347
#define SCIP_REAL_MAX
Definition: def.h:178
SCIP_Real * r
Definition: circlepacking.c:50
methods for sorting joint arrays of various types
SCIP_Real SCIProwGetConstant(SCIP_ROW *row)
Definition: lp.c:17224
SCIP_RETCODE SCIPreleaseRow(SCIP *scip, SCIP_ROW **row)
Definition: scip_lp.c:1553
general public methods
SCIP_RETCODE SCIPsetSepaFree(SCIP *scip, SCIP_SEPA *sepa, SCIP_DECL_SEPAFREE((*sepafree)))
Definition: scip_sepa.c:158
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
Definition: lp.c:17008
public methods for solutions
#define DEFAULT_MAXROUNDSROOT
void SCIProwChgRank(SCIP_ROW *row, int rank)
Definition: lp.c:17500
public methods for message output
SCIP_Bool SCIPisFeasPositive(SCIP *scip, SCIP_Real val)
#define SCIP_Real
Definition: def.h:177
SCIP_Bool SCIPisStopped(SCIP *scip)
Definition: scip_general.c:694
constraint handler for SOS type 1 constraints
public methods for message handling
SCIP_RETCODE SCIPprintRow(SCIP *scip, SCIP_ROW *row, FILE *file)
Definition: scip_lp.c:2197
#define DEFAULT_MAXRANKINTEGRAL
#define SCIP_Longint
Definition: def.h:162
#define SEPA_DELAY
SCIP_Real SCIPsumepsilon(SCIP *scip)
#define DEFAULT_MAXRANK
public methods for separators
SCIP_RETCODE SCIPgetLPRowsData(SCIP *scip, SCIP_ROW ***rows, int *nrows)
Definition: scip_lp.c:561
SCIPallocBlockMemory(scip, subsol))
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
SCIP_Longint SCIPgetNLPs(SCIP *scip)
int SCIPcolGetLPPos(SCIP_COL *col)
Definition: lp.c:17059
SCIP_RETCODE SCIPmakeRowIntegral(SCIP *scip, SCIP_ROW *row, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Longint maxdnom, SCIP_Real maxscale, SCIP_Bool usecontvars, SCIP_Bool *success)
Definition: scip_lp.c:1829
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
Definition: scip_sol.c:1352
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:130
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
struct SCIP_SepaData SCIP_SEPADATA
Definition: type_sepa.h:43
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:48
#define DEFAULT_MAXDEPTH
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
Definition: var.c:17580
#define SEPA_USESSUBSCIP
memory allocation routines