Cgl  0.60.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CglTwomir.hpp
Go to the documentation of this file.
1 // $Id: CglTwomir.hpp 1469 2019-03-15 16:16:04Z stefan $
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef CglTwomir_H
7 #define CglTwomir_H
8 #include <string>
9 
10 #include "CglCutGenerator.hpp"
11 #include "CoinFactorization.hpp"
12 
13 typedef struct
14 {
15 
16  int nz; /* current length of arrays index[] and coeff[] */
17  int max_nz; /* max length of arrays index[] and coeff[] */
18  double *coeff; /* coefficient of each variable in the constraint */
19  int *index; /* index of the variable (value in 0 ... nrow+ncol) */
20  double rhs; /* rhs of the constraint */
21  char sense; /* ?? is it necessary */
22 
24 
25 typedef struct{
26  int n;
28  int *ctype;
29  double *alpha;
30 } DGG_list_t;
31 
32 /******************** BASIS INFORMATION ADTs **********************************/
33 typedef struct{
34  int q_min;
35  int q_max;
36  int t_min;
37  int t_max;
38  int a_max;
40 } cutParams;
41 
42 typedef struct
43 {
44  double gomory_threshold; /* factional variable must be this away from int */
45  int ncol, /* number of columns in LP */
46  nrow, /* number of constaints in LP */
47  ninteger; /* number of integer variables in LP */
48 
49  int nbasic_col, /* number of basic columns in the LP */
50  nbasic_row; /* number of basic rows in the LP */
51 
52  /* the following arrays are all of size (ncol+nrow) */
53  int *info; /* description of each variable (see below) */
54  double *lb; /* specifies the lower bound (if any) of each variable */
55  double *ub; /* specifies the upper bound (if any) of each variable */
56  double *x; /* current solution */
57  double *rc; /* current reduced cost */
58  double *opt_x;
59 
61 } DGG_data_t;
62 
63 /* the following macros allow us to decode the info of the DGG_data
64  type. The encoding is as follows,
65  bit 1 : if the variable is basic or not (non-basic).
66  bit 2 : if the variable is integer or or not (rational).
67  bit 3 : if the variable is structural or not (artifical).
68  bit 4 : if the variable is non-basic and at its upper bound
69  (else if non-basic at lower bound). */
70 
71 #define DGG_isBasic(data,idx) ((data->info[idx])&1)
72 #define DGG_isInteger(data,idx) ((data->info[idx] >> 1)&1)
73 #define DGG_isStructural(data,idx) ((data->info[idx] >> 2)&1)
74 #define DGG_isEqualityConstraint(data,idx) ((data->info[idx] >> 3)&1)
75 #define DGG_isNonBasicAtUB(data,idx) ((data->info[idx] >> 4)&1)
76 #define DGG_isNonBasicAtLB(data,idx) ((data->info[idx] >> 5)&1)
77 #define DGG_isConstraintBoundedAbove(data,idx) ((data->info[idx] >> 6)&1)
78 #define DGG_isConstraintBoundedBelow(data,idx) ((data->info[idx] >> 7)&1)
79 
80 #define DGG_setIsBasic(data,idx) ((data->info[idx]) |= 1)
81 #define DGG_setIsInteger(data,idx) ((data->info[idx]) |= (1<<1))
82 #define DGG_setIsStructural(data,idx) ((data->info[idx]) |= (1<<2))
83 #define DGG_setEqualityConstraint(data,idx) ((data->info[idx]) |= (1<<3))
84 #define DGG_setIsNonBasicAtUB(data,idx) ((data->info[idx]) |= (1<<4))
85 #define DGG_setIsNonBasicAtLB(data,idx) ((data->info[idx]) |= (1<<5))
86 #define DGG_setIsConstraintBoundedAbove(data,idx) ((data->info[idx]) |= (1<<6))
87 #define DGG_setIsConstraintBoundedBelow(data,idx) ((data->info[idx]) |= (1<<7))
88 
89 class CoinWarmStartBasis;
91 class CglTwomir : public CglCutGenerator {
92 
93  friend void CglTwomirUnitTest(const OsiSolverInterface * siP,
94  const std::string mpdDir );
95 
96 
97 public:
98 
100  std::string probname_;
101 
107  virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
108  const CglTreeInfo info = CglTreeInfo());
110  virtual bool needsOptimalBasis() const;
111 
114  void setMirScale (int tmin, int tmax) {t_min_ = tmin; t_max_ = tmax;}
116  void setTwomirScale (int qmin, int qmax) {q_min_ = qmin; q_max_ = qmax;}
117  void setAMax (int a) {a_max_ = a;}
118  void setMaxElements (int n) {max_elements_ = n;}
120  void setCutTypes (bool mir, bool twomir, bool tab, bool form)
121  { do_mir_ = mir; do_2mir_ = twomir; do_tab_ = tab; do_form_ = form;}
122  void setFormulationRows (int n) {form_nrows_ = n;}
123 
125  int getTmin() const {return t_min_;}
126  int getTmax() const {return t_max_;}
127  int getQmin() const {return q_min_;}
128  int getQmax() const {return q_max_;}
129  int getAmax() const {return a_max_;}
130  int getMaxElements() const {return max_elements_;}
132  int getIfMir() const { return do_mir_;}
133  int getIfTwomir() const { return do_2mir_;}
134  int getIfTableau() const { return do_tab_;}
135  int getIfFormulation() const { return do_form_;}
137 
142  void setAway(double value);
145  double getAway() const;
147  void setAwayAtRoot(double value);
149  double getAwayAtRoot() const;
151  virtual int maximumLengthOfCutInTree() const
152  { return max_elements_;}
154 
161  { return originalSolver_;}
163  inline void setTwomirType(int type)
164  { twomirType_=type;}
166  inline int twomirType() const
167  { return twomirType_;}
169 
172  CglTwomir ();
174 
176  CglTwomir (const CglTwomir &);
177 
179  virtual CglCutGenerator * clone() const;
180 
182  CglTwomir & operator=(const CglTwomir& rhs);
183 
185  virtual ~CglTwomir ();
187  virtual std::string generateCpp( FILE * fp);
189  virtual void refreshSolver(OsiSolverInterface * solver);
191 
192 private:
193  // Private member data
201  double away_;
203  double awayAtRoot_;
206  bool do_mir_;
207  bool do_2mir_;
208  bool do_tab_;
209  bool do_form_;
210 
211  int t_min_;
212  int t_max_;
213  int q_min_;
214  int q_max_;
215  int a_max_;
218  int form_nrows_; //number of rows on which formulation cuts will be generated
220 };
221 
222 //#############################################################################
223 
224 /*
225 #include <stdlib.h>
226 #include <stdio.h>
227 #include <stdarg.h>
228 #include <math.h>
229 #include <float.h>
230 #include <cassert>
231 #include <iostream.h>
232 */
233 
234 /******************** DEBUG DEFINITIONS ***************************************/
235 
236 #define DGG_DEBUG_DGG 1
237 #define DGG_TRACE_ERRORS 0
238 #define DGG_DISPLAY 0
239 #define DGG_AUTO_CHECK_CUT_OFF_OPTIMAL 1
240 
241 /******************** CONFIGURATION DEFAULTS **********************************/
242 
243 #define DGG_DEFAULT_METHOD 2
244 #define DGG_DEFAULT_TMIN 1
245 #define DGG_DEFAULT_TMAX 1
246 #define DGG_DEFAULT_TAUMIN 2
247 #define DGG_DEFAULT_TAUMAX 6
248 #define DGG_DEFAULT_MAX_CUTS 500
249 #define DGG_DEFAULT_IMPROVEMENT_THRESH 0.001
250 #define DGG_DEFAULT_NBELOW_THRESH INT_MAX
251 #define DGG_DEFAULT_NROOT_ROUNDS 2
252 #define DGG_DEFAULT_NEGATIVE_SCALED_TWOSTEPS 0
253 #define DGG_DEFAULT_ALPHA_RULE 0
254 #define DGG_DEFAULT_CUT_INC 250
255 #define DGG_DEFAULT_CUT_FORM 0
256 #define DGG_DEFAULT_NICEFY 0
257 #define DGG_DEFAULT_ONLY_DELAYED 0
258 #define DGG_DEFAULT_DELAYED_FREQ 9999999
259 #define DGG_DEFAULT_LPROWS_FREQ 9999999
260 #define DGG_DEFAULT_WHICH_FORMULATION_CUTS 2
261 
262 /******************** SOLVER CONFIGURATION DEFINITIONS ************************/
263 
264 #define DGG_OSI 0
265 #define DGG_CPX 1
266 #define DGG_QSO 2
267 
268 /* determines the solver to be used */
269 #define DGG_SOLVER DGG_OSI
270 
271 /* adds checking routines to make sure solver works as expected */
272 #define DGG_DEBUG_SOLVER 0
273 
274 /* turn off screen output from solver */
275 #define DGG_SOLVER_SCREEN_FLAG 0
276 
277 /******************** CUT DEFINITIONS *****************************************/
278 
279 /* internal names for cut types */
280 #define DGG_TMIR_CUT 1
281 #define DGG_2STEP_CUT 2
282 
283 /* internal names for alpha-selection rules */
284 #define DGG_ALPHA_MIN_SUM 0
285 #define DGG_ALPHA_RANDOM_01 1
286 #define DGG_ALPHA_RANDOM_COEFF 2
287 #define DGG_ALPHA_ALL 3
288 #define DGG_ALPHA_MAX_STEEP 5
289 
290 /******************** PRECISION & NUMERICAL ISSUES DEFINITIONS ****************/
291 
292 /* how steep a cut must be before adding it to the lp */
293 #define DGG_MIN_STEEPNESS 1.0e-4
294 #define DGG_MAX_L2NORM 1.0e7
295 
296 /* 0 = min steepness, 1 = max norm */
297 #define DGG_NORM_CRITERIA 1
298 
299 /* used to define how fractional a basic-integer variable must be
300  before choosing to use it to generate a TMIR cut on.
301  OSI's default is 1.0e-7 */
302 #define DGG_GOMORY_THRESH 0.005
303 
304 #define DGG_RHS_THRESH 0.005
305 
306 /* used for comparing variables to their upper bounds.
307  OSI's default is 1.0e-7.
308  We set it to 1.0e6 because e-7 seems too sensitive.
309  In fact, with e-7 the problem dsbmip.mps complains. */
310 #define DGG_BOUND_THRESH 1.0e-6
311 
312 /* used for comparing the lhs (activity) value of a tableau row
313  with the rhs. This is only used for debugging purposes. */
314 #define DGG_EQUALITY_THRESH 1.0e-5
315 
316 /* used for comparing a variable's lower bound to 0.0
317  and determining if we need to shift the variable */
318 #define DGG_SHIFT_THRESH 1.0e-6
319 
320 /* used for determing how far from an integer is still an integer.
321  This value is used for comparing coefficients to integers.
322  OSI's default is 1.0e-10. */
323 #define DGG_INTEGRALITY_THRESH 1.0e-10
324 
325 /* the min value that a coeff can have in the tableau row
326  before being set to zero. */
327 #define CBC_CHECK_CUT
328 #ifndef CBC_CHECK_CUT
329 #define DGG_MIN_TABLEAU_COEFFICIENT 1.0e-8
330 #else
331 #define DGG_MIN_TABLEAU_COEFFICIENT 1.0e-12
332 #endif
333 
334 /* smallest value rho is allowed to have for a simple 2-step MIR
335  (ie: not an extended two-step MIR) */
336 #define DGG_MIN_RHO 1.0e-7
337 #define DGG_MIN_ALPHA 1.0e-7
338 
339 /* when a slack is null: used to check if a cut is satisfied or not. */
340 #define DGG_NULL_SLACK 1.0e-5
341 
342 /* nicefy constants */
343 #define DGG_NICEFY_MIN_ABSVALUE 1.0e-13
344 #define DGG_NICEFY_MIN_FIX 1.0e-7
345 #define DGG_NICEFY_MAX_PADDING 1.0e-6
346 #define DGG_NICEFY_MAX_RATIO 1.0e9
347 
348 
349 /******************** ERROR-CATCHING MACROS ***********************************/
350 #if DGG_TRACE_ERRORS > 0
351 
352 #define __DGG_PRINT_LOC__(F) fprintf(((F==0)?stdout:F), " in %s (%s:%d)\n", __func__, __FILE__, __LINE__)
353 
354 #define DGG_THROW(A,REST...) {\
355  fprintf(stdout, ##REST); \
356  __DGG_PRINT_LOC__(stdout); \
357  return (A);}
358 
359 #define DGG_IF_EXIT(A,B,REST...) {\
360  if(A) {\
361  fprintf(stdout, ##REST); \
362  __DGG_PRINT_LOC__(stdout); \
363  exit(B);}}
364 
365 #define DGG_CHECKRVAL(A,B) {\
366  if(A) {\
367  __DGG_PRINT_LOC__(stdout); \
368  return B; } }
369 
370 #define DGG_CHECKRVAL1(A,B) {\
371  if(A) {\
372  __DGG_PRINT_LOC__(stdout); \
373  rval = B; goto CLEANUP; } }
374 
375 #define DGG_WARNING(A, REST...) {\
376  if(A) {\
377  fprintf(stdout, ##REST); \
378  __DGG_PRINT_LOC__(stdout); \
379  }}
380 
381 #define DGG_TEST(A,B,REST...) {\
382  if(A) DGG_THROW(B,##REST) }
383 
384 #define DGG_TEST2(A,B,C,REST) {DGG_TEST(A,B,C,REST) }
385 #define DGG_TEST3(A,B,C,D,REST) {DGG_TEST(A,B,C,D,REST) }
386 
387 #else
388 
389 #define DGG_IF_EXIT(A,B,REST) {if(A) {fprintf(stdout, REST);exit(B);}}
390 
391 #define DGG_THROW(A,B) return(A)
392 
393 #define DGG_CHECKRVAL(A,B) { if(A) return(B); }
394 #define DGG_CHECKRVAL1(A,B){ if(A) { rval = B; goto CLEANUP; } }
395 
396 #define DGG_TEST(A,B,REST) { if(A) return(B);}
397 #define DGG_TEST2(A,B,REST,C) { DGG_TEST(A,B,REST) }
398 #define DGG_TEST3(A,B,REST,C,D) { DGG_TEST(A,B,REST) }
399 
400 #endif
401 
402 /******************** SIMPLE MACROS AND FUNCTIONS *****************************/
403 
404 #define DGG_MIN(a,b) ( (a<b)?a:b )
405 #define DGG_MAX(a,b) ( (a>b)?a:b )
406 #define KREM(vht,alpha,tau) (DGG_MIN( ceil(vht / alpha), tau ) - 1)
407 #define LMIN(vht, d, bht) (DGG_MIN( floor(d*bht/bht), d))
408 #define ABOV(v) (v - floor(v))
409 #define QINT(vht,bht,tau) ( (int)floor( (vht*(tau-1))/bht ) )
410 #define V2I(bht,tau,i) ( ((i+1)*bht / tau) )
411 
412 int DGG_is_even(double vht, double bht, int tau, int q);
413 double frac_part(double value);
414 int DGG_is_a_multiple_of_b(double a, double b);
415 
416 
417 /* free function for DGG_data_t. Frees internal arrays and data structure */
418 int DGG_freeData( DGG_data_t *data );
419 
420 /******************** CONSTRAINT ADTs *****************************************/
421 DGG_constraint_t* DGG_newConstraint(int max_arrays);
424 void DGG_scaleConstraint(DGG_constraint_t *c, int t);
425 
426 /******************** CONFIGURATION *******************************************/
427 void DGG_list_init (DGG_list_t *l);
428 int DGG_list_addcut (DGG_list_t *l, DGG_constraint_t *cut, int ctype, double alpha);
429 void DGG_list_delcut (DGG_list_t *l, int i);
430 void DGG_list_free(DGG_list_t *l);
431 
432 /******************* SOLVER SPECIFIC METHODS **********************************/
433 DGG_data_t *DGG_getData(const void *solver_ptr);
434 
435 /******************* CONSTRAINT MANIPULATION **********************************/
436 
437 /* DGG_transformConstraint: manipulates a constraint in the following way:
438 
439 packs everything in output
440 
441 1 - variables at their upper bounds are substituted for their
442 complements. This is done by adjusting the coefficients and
443 the right hand side (simple substitution).
444 
445 2 - variables with non-zero lower bounds are shifted. */
446 
448  double **x_out,
449  double **rc_out,
450  char **isint_out,
451  DGG_constraint_t *constraint );
452 
453 /* DGG_unTransformConstraint :
454 
455 1 - Undoes step (1) of DGG_transformConstraint
456 2 - Undoes step (2) of DGG_transformConstraint */
457 
459  DGG_constraint_t *constraint );
460 
461 /* substitutes each slack variable by the structural variables which
462  define it. This function, hence, changes the constraint 'cut'. */
463 
464 int DGG_substituteSlacks( const void *solver_ptr,
465  DGG_data_t *data,
467 
468 int DGG_nicefyConstraint( const void *solver_ptr,
469  DGG_data_t *data,
471 
472 /******************* CUT GENERATION *******************************************/
473 int DGG_getFormulaConstraint( int row_idx,
474  const void *solver_ptr,
475  DGG_data_t *data,
476  DGG_constraint_t* row );
477 
478 int DGG_getTableauConstraint( int index,
479  const void *solver_ptr,
480  DGG_data_t *data,
481  DGG_constraint_t* tabrow,
482  const int * colIsBasic,
483  const int * rowIsBasic,
484  CoinFactorization & factorization,
485  int mode );
486 
487 DGG_constraint_t* DGG_getSlackExpression(const void *solver_ptr, DGG_data_t* data, int row_index);
488 
490  DGG_data_t *data,
491  const void *solver_ptr );
492 
494  DGG_data_t *data,
495  const void *solver_ptr,
496  int nrows,
497  CoinThreadRandom & generator);
498 
499 
501  double slack,
502  DGG_list_t *list,
503  DGG_data_t *data,
504  const void *solver_ptr,
505  CoinThreadRandom & generator);
506 
508  DGG_list_t *list,
509  DGG_data_t *data,
510  const void *solver_ptr );
511 
512 int DGG_buildMir( char *isint,
513  DGG_constraint_t *base,
514  DGG_constraint_t **cut_out );
515 
516 int DGG_build2step( double alpha,
517  char *isint,
518  DGG_constraint_t *base,
519  DGG_constraint_t **cut_out );
520 
522  char *isint,
523  double *x,
524  DGG_list_t *list,
525  DGG_data_t *data,
526  DGG_constraint_t *orig_base );
527 
529  char *isint,
530  double *x,
531  double *rc,
532  DGG_list_t *list,
533  DGG_data_t *data,
534  DGG_constraint_t *orig_base );
535 
536 /******************* CUT INFORMATION ******************************************/
537 
538 double DGG_cutLHS(DGG_constraint_t *c, double *x);
540 
541 /******************* TEST / DEBUGGING ROUTINES ********************************/
542 
544 
546 int DGG_is2stepValid(double alpha, double bht);
547 
548 int DGG_cutsOffPoint(double *x, DGG_constraint_t *cut);
549 
550 //#############################################################################
556 void CglTwomirUnitTest(const OsiSolverInterface * siP,
557  const std::string mpdDir);
558 
559 
560 #endif
561 
562 
virtual std::string generateCpp(FILE *fp)
Create C++ lines to get to current state.
int DGG_getTableauConstraint(int index, const void *solver_ptr, DGG_data_t *data, DGG_constraint_t *tabrow, const int *colIsBasic, const int *rowIsBasic, CoinFactorization &factorization, int mode)
void DGG_scaleConstraint(DGG_constraint_t *c, int t)
double * rc
Definition: CglTwomir.hpp:57
int a_max_
q_max - last value of t to use for 2-Step tMIR inequalities
Definition: CglTwomir.hpp:215
int getTmin() const
Get.
Definition: CglTwomir.hpp:125
int t_max_
t_min - first value of t to use for tMIR inequalities
Definition: CglTwomir.hpp:212
int DGG_generateTabRowCuts(DGG_list_t *list, DGG_data_t *data, const void *solver_ptr)
CglTwomir()
Default constructor.
int * ctype
Definition: CglTwomir.hpp:28
int getQmin() const
Definition: CglTwomir.hpp:127
void DGG_freeConstraint(DGG_constraint_t *c)
DGG_constraint_t ** c
Definition: CglTwomir.hpp:27
void setAway(double value)
Set away.
bool do_mir_
Definition: CglTwomir.hpp:206
int getTmax() const
Definition: CglTwomir.hpp:126
virtual CglCutGenerator * clone() const
Clone.
void setMirScale(int tmin, int tmax)
Set.
Definition: CglTwomir.hpp:115
Information about where the cut generator is invoked from.
Definition: CglTreeInfo.hpp:15
int getIfFormulation() const
Definition: CglTwomir.hpp:135
int getIfTwomir() const
Definition: CglTwomir.hpp:133
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
double awayAtRoot_
Only investigate if more than this away from integrality (at root)
Definition: CglTwomir.hpp:203
void DGG_list_init(DGG_list_t *l)
int max_elements
Definition: CglTwomir.hpp:39
int DGG_unTransformConstraint(DGG_data_t *data, DGG_constraint_t *constraint)
double away_
Only investigate if more than this away from integrality.
Definition: CglTwomir.hpp:201
OsiSolverInterface * originalSolver() const
Returns original solver.
Definition: CglTwomir.hpp:160
The default COIN simplex (basis-oriented) warm start class.
int DGG_generateFormulationCuts(DGG_list_t *list, DGG_data_t *data, const void *solver_ptr, int nrows, CoinThreadRandom &generator)
int getIfTableau() const
Definition: CglTwomir.hpp:134
DGG_constraint_t * DGG_getSlackExpression(const void *solver_ptr, DGG_data_t *data, int row_index)
int DGG_addMirToList(DGG_constraint_t *base, char *isint, double *x, DGG_list_t *list, DGG_data_t *data, DGG_constraint_t *orig_base)
bool do_2mir_
Definition: CglTwomir.hpp:207
virtual bool needsOptimalBasis() const
Return true if needs optimal basis to do cuts (will return true)
double getAwayAtRoot() const
Get away at root.
std::string probname_
Problem name.
Definition: CglTwomir.hpp:100
cutParams cparams
Definition: CglTwomir.hpp:60
Abstract Base Class for describing an interface to a solver.
int max_elements_root_
Maximum number of elements in cut.
Definition: CglTwomir.hpp:217
bool do_form_
Definition: CglTwomir.hpp:209
int DGG_cutsOffPoint(double *x, DGG_constraint_t *cut)
int getAmax() const
Definition: CglTwomir.hpp:129
CoinThreadRandom randomNumberGenerator_
Threadsafe random number generator.
Definition: CglTwomir.hpp:197
virtual ~CglTwomir()
Destructor.
double * lb
Definition: CglTwomir.hpp:54
int twomirType() const
Return type.
Definition: CglTwomir.hpp:166
int DGG_is2stepValid(double alpha, double bht)
void DGG_list_free(DGG_list_t *l)
Cut Generator Base Class.
int DGG_freeData(DGG_data_t *data)
int q_min_
t_max - last value of t to use for tMIR inequalities
Definition: CglTwomir.hpp:213
int DGG_generateCutsFromBase(DGG_constraint_t *base, DGG_list_t *list, DGG_data_t *data, const void *solver_ptr)
CglTwomir & operator=(const CglTwomir &rhs)
Assignment operator.
virtual int maximumLengthOfCutInTree() const
Return maximum length of cut in tree.
Definition: CglTwomir.hpp:151
int DGG_nicefyConstraint(const void *solver_ptr, DGG_data_t *data, DGG_constraint_t *cut)
void setAMax(int a)
Definition: CglTwomir.hpp:117
void setCutTypes(bool mir, bool twomir, bool tab, bool form)
Definition: CglTwomir.hpp:120
double * alpha
Definition: CglTwomir.hpp:29
int DGG_substituteSlacks(const void *solver_ptr, DGG_data_t *data, DGG_constraint_t *cut)
int q_max_
q_min - first value of t to use for 2-Step tMIR inequalities
Definition: CglTwomir.hpp:214
double getAway() const
Get away.
double frac_part(double value)
int DGG_build2step(double alpha, char *isint, DGG_constraint_t *base, DGG_constraint_t **cut_out)
double gomory_threshold
Definition: CglTwomir.hpp:44
double DGG_cutLHS(DGG_constraint_t *c, double *x)
void CglTwomirUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglTwomir class.
void setFormulationRows(int n)
Definition: CglTwomir.hpp:122
void setTwomirType(int type)
Set type - 0 normal, 1 add original matrix one, 2 replace.
Definition: CglTwomir.hpp:163
int DGG_add2stepToList(DGG_constraint_t *base, char *isint, double *x, double *rc, DGG_list_t *list, DGG_data_t *data, DGG_constraint_t *orig_base)
int * info
Definition: CglTwomir.hpp:53
int getQmax() const
Definition: CglTwomir.hpp:128
friend void CglTwomirUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglTwomir class.
int DGG_getFormulaConstraint(int row_idx, const void *solver_ptr, DGG_data_t *data, DGG_constraint_t *row)
Twostep MIR Cut Generator Class.
Definition: CglTwomir.hpp:91
int DGG_generateFormulationCutsFromBase(DGG_constraint_t *base, double slack, DGG_list_t *list, DGG_data_t *data, const void *solver_ptr, CoinThreadRandom &generator)
int twomirType_
Type - 0 normal, 1 add original matrix one, 2 replace.
Definition: CglTwomir.hpp:205
int DGG_isCutDesirable(DGG_constraint_t *c, DGG_data_t *d)
This deals with Factorization and Updates.
DGG_constraint_t * DGG_copyConstraint(DGG_constraint_t *c)
DGG_constraint_t * DGG_newConstraint(int max_arrays)
void setMaxElementsRoot(int n)
Definition: CglTwomir.hpp:119
double * coeff
Definition: CglTwomir.hpp:18
int DGG_isConstraintViolated(DGG_data_t *d, DGG_constraint_t *c)
int getMaxElements() const
Definition: CglTwomir.hpp:130
int DGG_isBaseTrivial(DGG_data_t *d, DGG_constraint_t *c)
double * x
Definition: CglTwomir.hpp:56
DGG_data_t * DGG_getData(const void *solver_ptr)
void setMaxElements(int n)
Definition: CglTwomir.hpp:118
int getIfMir() const
Definition: CglTwomir.hpp:132
int DGG_is_even(double vht, double bht, int tau, int q)
int getMaxElementsRoot() const
Definition: CglTwomir.hpp:131
int DGG_list_addcut(DGG_list_t *l, DGG_constraint_t *cut, int ctype, double alpha)
void DGG_list_delcut(DGG_list_t *l, int i)
void setAwayAtRoot(double value)
Set away at root.
double * ub
Definition: CglTwomir.hpp:55
int DGG_buildMir(char *isint, DGG_constraint_t *base, DGG_constraint_t **cut_out)
void setTwomirScale(int qmin, int qmax)
Definition: CglTwomir.hpp:116
int DGG_is_a_multiple_of_b(double a, double b)
void passInOriginalSolver(OsiSolverInterface *solver)
Pass in a copy of original solver (clone it)
int form_nrows_
Maximum number of elements in cut at root.
Definition: CglTwomir.hpp:218
int max_elements_
a_max - maximum value of bhat/alpha
Definition: CglTwomir.hpp:216
OsiSolverInterface * originalSolver_
Original solver.
Definition: CglTwomir.hpp:199
virtual void refreshSolver(OsiSolverInterface *solver)
This can be used to refresh any inforamtion.
double * opt_x
Definition: CglTwomir.hpp:58
int nbasic_row
Definition: CglTwomir.hpp:49
Class for thread specific random numbers.
bool do_tab_
Definition: CglTwomir.hpp:208
int DGG_transformConstraint(DGG_data_t *data, double **x_out, double **rc_out, char **isint_out, DGG_constraint_t *constraint)
virtual void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo())
Generate Two step MIR cuts either from the tableau rows or from the formulation rows.