Cbc  2.9.9
 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 1119 2013-04-06 20:24:18Z 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 /* internal representation of +infinity */
300 #define UB_MAX DBL_MAX
301 
302 /* used to define how fractional a basic-integer variable must be
303  before choosing to use it to generate a TMIR cut on.
304  OSI's default is 1.0e-7 */
305 #define DGG_GOMORY_THRESH 0.005
306 
307 #define DGG_RHS_THRESH 0.005
308 
309 /* used for comparing variables to their upper bounds.
310  OSI's default is 1.0e-7.
311  We set it to 1.0e6 because e-7 seems too sensitive.
312  In fact, with e-7 the problem dsbmip.mps complains. */
313 #define DGG_BOUND_THRESH 1.0e-6
314 
315 /* used for comparing the lhs (activity) value of a tableau row
316  with the rhs. This is only used for debugging purposes. */
317 #define DGG_EQUALITY_THRESH 1.0e-5
318 
319 /* used for comparing a variable's lower bound to 0.0
320  and determining if we need to shift the variable */
321 #define DGG_SHIFT_THRESH 1.0e-6
322 
323 /* used for determing how far from an integer is still an integer.
324  This value is used for comparing coefficients to integers.
325  OSI's default is 1.0e-10. */
326 #define DGG_INTEGRALITY_THRESH 1.0e-10
327 
328 /* the min value that a coeff can have in the tableau row
329  before being set to zero. */
330 #define CBC_CHECK_CUT
331 #ifndef CBC_CHECK_CUT
332 #define DGG_MIN_TABLEAU_COEFFICIENT 1.0e-8
333 #else
334 #define DGG_MIN_TABLEAU_COEFFICIENT 1.0e-12
335 #endif
336 
337 /* smallest value rho is allowed to have for a simple 2-step MIR
338  (ie: not an extended two-step MIR) */
339 #define DGG_MIN_RHO 1.0e-7
340 #define DGG_MIN_ALPHA 1.0e-7
341 
342 /* when a slack is null: used to check if a cut is satisfied or not. */
343 #define DGG_NULL_SLACK 1.0e-5
344 
345 /* nicefy constants */
346 #define DGG_NICEFY_MIN_ABSVALUE 1.0e-13
347 #define DGG_NICEFY_MIN_FIX 1.0e-7
348 #define DGG_NICEFY_MAX_PADDING 1.0e-6
349 #define DGG_NICEFY_MAX_RATIO 1.0e9
350 
351 
352 /******************** ERROR-CATCHING MACROS ***********************************/
353 #if DGG_TRACE_ERRORS > 0
354 
355 #define __DGG_PRINT_LOC__(F) fprintf(((F==0)?stdout:F), " in %s (%s:%d)\n", __func__, __FILE__, __LINE__)
356 
357 #define DGG_THROW(A,REST...) {\
358  fprintf(stdout, ##REST); \
359  __DGG_PRINT_LOC__(stdout); \
360  return (A);}
361 
362 #define DGG_IF_EXIT(A,B,REST...) {\
363  if(A) {\
364  fprintf(stdout, ##REST); \
365  __DGG_PRINT_LOC__(stdout); \
366  exit(B);}}
367 
368 #define DGG_CHECKRVAL(A,B) {\
369  if(A) {\
370  __DGG_PRINT_LOC__(stdout); \
371  return B; } }
372 
373 #define DGG_CHECKRVAL1(A,B) {\
374  if(A) {\
375  __DGG_PRINT_LOC__(stdout); \
376  rval = B; goto CLEANUP; } }
377 
378 #define DGG_WARNING(A, REST...) {\
379  if(A) {\
380  fprintf(stdout, ##REST); \
381  __DGG_PRINT_LOC__(stdout); \
382  }}
383 
384 #define DGG_TEST(A,B,REST...) {\
385  if(A) DGG_THROW(B,##REST) }
386 
387 #define DGG_TEST2(A,B,C,REST) {DGG_TEST(A,B,C,REST) }
388 #define DGG_TEST3(A,B,C,D,REST) {DGG_TEST(A,B,C,D,REST) }
389 
390 #else
391 
392 #define DGG_IF_EXIT(A,B,REST) {if(A) {fprintf(stdout, REST);exit(B);}}
393 
394 #define DGG_THROW(A,B) return(A)
395 
396 #define DGG_CHECKRVAL(A,B) { if(A) return(B); }
397 #define DGG_CHECKRVAL1(A,B){ if(A) { rval = B; goto CLEANUP; } }
398 
399 #define DGG_TEST(A,B,REST) { if(A) return(B);}
400 #define DGG_TEST2(A,B,REST,C) { DGG_TEST(A,B,REST) }
401 #define DGG_TEST3(A,B,REST,C,D) { DGG_TEST(A,B,REST) }
402 
403 #endif
404 
405 /******************** SIMPLE MACROS AND FUNCTIONS *****************************/
406 
407 #define DGG_MIN(a,b) ( (a<b)?a:b )
408 #define DGG_MAX(a,b) ( (a>b)?a:b )
409 #define KREM(vht,alpha,tau) (DGG_MIN( ceil(vht / alpha), tau ) - 1)
410 #define LMIN(vht, d, bht) (DGG_MIN( floor(d*bht/bht), d))
411 #define ABOV(v) (v - floor(v))
412 #define QINT(vht,bht,tau) ( (int)floor( (vht*(tau-1))/bht ) )
413 #define V2I(bht,tau,i) ( ((i+1)*bht / tau) )
414 
415 int DGG_is_even(double vht, double bht, int tau, int q);
416 double frac_part(double value);
417 int DGG_is_a_multiple_of_b(double a, double b);
418 
419 
420 /* free function for DGG_data_t. Frees internal arrays and data structure */
421 int DGG_freeData( DGG_data_t *data );
422 
423 /******************** CONSTRAINT ADTs *****************************************/
424 DGG_constraint_t* DGG_newConstraint(int max_arrays);
427 void DGG_scaleConstraint(DGG_constraint_t *c, int t);
428 
429 /******************** CONFIGURATION *******************************************/
430 void DGG_list_init (DGG_list_t *l);
431 int DGG_list_addcut (DGG_list_t *l, DGG_constraint_t *cut, int ctype, double alpha);
432 void DGG_list_delcut (DGG_list_t *l, int i);
433 void DGG_list_free(DGG_list_t *l);
434 
435 /******************* SOLVER SPECIFIC METHODS **********************************/
436 DGG_data_t *DGG_getData(const void *solver_ptr);
437 
438 /******************* CONSTRAINT MANIPULATION **********************************/
439 
440 /* DGG_transformConstraint: manipulates a constraint in the following way:
441 
442 packs everything in output
443 
444 1 - variables at their upper bounds are substituted for their
445 complements. This is done by adjusting the coefficients and
446 the right hand side (simple substitution).
447 
448 2 - variables with non-zero lower bounds are shifted. */
449 
451  double **x_out,
452  double **rc_out,
453  char **isint_out,
454  DGG_constraint_t *constraint );
455 
456 /* DGG_unTransformConstraint :
457 
458 1 - Undoes step (1) of DGG_transformConstraint
459 2 - Undoes step (2) of DGG_transformConstraint */
460 
462  DGG_constraint_t *constraint );
463 
464 /* substitutes each slack variable by the structural variables which
465  define it. This function, hence, changes the constraint 'cut'. */
466 
467 int DGG_substituteSlacks( const void *solver_ptr,
468  DGG_data_t *data,
470 
471 int DGG_nicefyConstraint( const void *solver_ptr,
472  DGG_data_t *data,
474 
475 /******************* CUT GENERATION *******************************************/
476 int DGG_getFormulaConstraint( int row_idx,
477  const void *solver_ptr,
478  DGG_data_t *data,
479  DGG_constraint_t* row );
480 
481 int DGG_getTableauConstraint( int index,
482  const void *solver_ptr,
483  DGG_data_t *data,
484  DGG_constraint_t* tabrow,
485  const int * colIsBasic,
486  const int * rowIsBasic,
487  CoinFactorization & factorization,
488  int mode );
489 
490 DGG_constraint_t* DGG_getSlackExpression(const void *solver_ptr, DGG_data_t* data, int row_index);
491 
493  DGG_data_t *data,
494  const void *solver_ptr );
495 
497  DGG_data_t *data,
498  const void *solver_ptr,
499  int nrows,
500  CoinThreadRandom & generator);
501 
502 
504  double slack,
505  DGG_list_t *list,
506  DGG_data_t *data,
507  const void *solver_ptr,
508  CoinThreadRandom & generator);
509 
511  DGG_list_t *list,
512  DGG_data_t *data,
513  const void *solver_ptr );
514 
515 int DGG_buildMir( char *isint,
516  DGG_constraint_t *base,
517  DGG_constraint_t **cut_out );
518 
519 int DGG_build2step( double alpha,
520  char *isint,
521  DGG_constraint_t *base,
522  DGG_constraint_t **cut_out );
523 
525  char *isint,
526  double *x,
527  DGG_list_t *list,
528  DGG_data_t *data,
529  DGG_constraint_t *orig_base );
530 
532  char *isint,
533  double *x,
534  double *rc,
535  DGG_list_t *list,
536  DGG_data_t *data,
537  DGG_constraint_t *orig_base );
538 
539 /******************* CUT INFORMATION ******************************************/
540 
541 double DGG_cutLHS(DGG_constraint_t *c, double *x);
543 
544 /******************* TEST / DEBUGGING ROUTINES ********************************/
545 
547 
549 int DGG_is2stepValid(double alpha, double bht);
550 
551 int DGG_cutsOffPoint(double *x, DGG_constraint_t *cut);
552 
553 //#############################################################################
559 void CglTwomirUnitTest(const OsiSolverInterface * siP,
560  const std::string mpdDir);
561 
562 
563 #endif
564 
565 
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.