- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
23 } DGG_constraint_t;
24
25 typedef struct{
26 int n;
27 DGG_constraint_t **c;
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;
39 int max_elements;
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
60 cutParams cparams;
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;}
119 void setMaxElementsRoot (int n) {max_elements_root_ = 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_;}
131 int getMaxElementsRoot() const {return max_elements_root_;}
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
157 void passInOriginalSolver(OsiSolverInterface * solver);
160 inline OsiSolverInterface * originalSolver() const
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
196 CoinThreadRandom randomNumberGenerator_;
199 OsiSolverInterface * originalSolver_;
201 double away_;
203 double awayAtRoot_;
205 int twomirType_;
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_;
216 int max_elements_;
217 int max_elements_root_;
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);
425 void DGG_freeConstraint(DGG_constraint_t *c);
426 DGG_constraint_t *DGG_copyConstraint(DGG_constraint_t *c);
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
450 int DGG_transformConstraint( DGG_data_t *data,
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
461 int DGG_unTransformConstraint( DGG_data_t *data,
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,
469 DGG_constraint_t *cut );
470
471 int DGG_nicefyConstraint( const void *solver_ptr,
472 DGG_data_t *data,
473 DGG_constraint_t *cut);
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
492 int DGG_generateTabRowCuts( DGG_list_t *list,
493 DGG_data_t *data,
494 const void *solver_ptr );
495
496 int DGG_generateFormulationCuts( DGG_list_t *list,
497 DGG_data_t *data,
498 const void *solver_ptr,
499 int nrows,
500 CoinThreadRandom & generator);
501
502
503 int DGG_generateFormulationCutsFromBase( DGG_constraint_t *base,
504 double slack,
505 DGG_list_t *list,
506 DGG_data_t *data,
507 const void *solver_ptr,
508 CoinThreadRandom & generator);
509
510 int DGG_generateCutsFromBase( DGG_constraint_t *base,
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
524 int DGG_addMirToList ( DGG_constraint_t *base,
525 char *isint,
526 double *x,
527 DGG_list_t *list,
528 DGG_data_t *data,
529 DGG_constraint_t *orig_base );
530
531 int DGG_add2stepToList ( DGG_constraint_t *base,
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);
542 int DGG_isCutDesirable(DGG_constraint_t *c, DGG_data_t *d);
543
544 /******************* TEST / DEBUGGING ROUTINES ********************************/
545
546 int DGG_isConstraintViolated(DGG_data_t *d, DGG_constraint_t *c);
547
548 int DGG_isBaseTrivial(DGG_data_t *d, DGG_constraint_t* c);
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
CglTwomir::max_elements_
int max_elements_
a_max - maximum value of bhat/alpha
Definition: CglTwomir.hpp:216
CglTwomir::operator=
CglTwomir & operator=(const CglTwomir &rhs)
Assignment operator.
cutParams::a_max
int a_max
Definition: CglTwomir.hpp:38
DGG_data_t::gomory_threshold
double gomory_threshold
Definition: CglTwomir.hpp:44
CglTwomir::getQmin
int getQmin() const
Set.
Definition: CglTwomir.hpp:127
CglTwomir::getQmax
int getQmax() const
Set.
Definition: CglTwomir.hpp:128
DGG_constraint_t::sense
char sense
Definition: CglTwomir.hpp:21
DGG_data_t::cparams
cutParams cparams
Definition: CglTwomir.hpp:60
CglTwomir::t_max_
int t_max_
t_min - first value of t to use for tMIR inequalities
Definition: CglTwomir.hpp:212
CglTwomir::originalSolver
OsiSolverInterface * originalSolver() const
Returns original solver.
Definition: CglTwomir.hpp:160
DGG_is_a_multiple_of_b
int DGG_is_a_multiple_of_b(double a, double b)
CglTwomir::do_tab_
bool do_tab_
Threadsafe random number generator.
Definition: CglTwomir.hpp:208
CglTwomir::originalSolver_
OsiSolverInterface * originalSolver_
Original solver.
Definition: CglTwomir.hpp:199
DGG_list_addcut
int DGG_list_addcut(DGG_list_t *l, DGG_constraint_t *cut, int ctype, double alpha)
CglTwomir::needsOptimalBasis
virtual bool needsOptimalBasis() const
Return true if needs optimal basis to do cuts (will return true)
DGG_getData
DGG_data_t * DGG_getData(const void *solver_ptr)
cutParams::t_min
int t_min
Definition: CglTwomir.hpp:36
DGG_list_t::ctype
int * ctype
Definition: CglTwomir.hpp:28
CglTwomir::setAwayAtRoot
void setAwayAtRoot(double value)
Set away at root.
CglTwomir::awayAtRoot_
double awayAtRoot_
Only investigate if more than this away from integrality (at root)
Definition: CglTwomir.hpp:203
CglTwomir::setTwomirType
void setTwomirType(int type)
Set type - 0 normal, 1 add original matrix one, 2 replace.
Definition: CglTwomir.hpp:163
frac_part
double frac_part(double value)
DGG_data_t::ub
double * ub
Definition: CglTwomir.hpp:55
DGG_build2step
int DGG_build2step(double alpha, char *isint, DGG_constraint_t *base, DGG_constraint_t **cut_out)
CglTwomir::max_elements_root_
int max_elements_root_
Maximum number of elements in cut.
Definition: CglTwomir.hpp:217
CglTwomir::setTwomirScale
void setTwomirScale(int qmin, int qmax)
Set.
Definition: CglTwomir.hpp:116
DGG_is2stepValid
int DGG_is2stepValid(double alpha, double bht)
DGG_data_t::rc
double * rc
Definition: CglTwomir.hpp:57
DGG_list_t::alpha
double * alpha
Definition: CglTwomir.hpp:29
DGG_constraint_t::max_nz
int max_nz
Definition: CglTwomir.hpp:17
DGG_transformConstraint
int DGG_transformConstraint(DGG_data_t *data, double **x_out, double **rc_out, char **isint_out, DGG_constraint_t *constraint)
DGG_data_t::nrow
int nrow
Definition: CglTwomir.hpp:45
CglTwomir::randomNumberGenerator_
CoinThreadRandom randomNumberGenerator_
Threadsafe random number generator.
Definition: CglTwomir.hpp:197
DGG_data_t::x
double * x
Definition: CglTwomir.hpp:56
CglTwomir::getIfTableau
int getIfTableau() const
Set.
Definition: CglTwomir.hpp:134
DGG_cutsOffPoint
int DGG_cutsOffPoint(double *x, DGG_constraint_t *cut)
DGG_is_even
int DGG_is_even(double vht, double bht, int tau, int q)
CglTwomir::q_max_
int q_max_
q_min - first value of t to use for 2-Step tMIR inequalities
Definition: CglTwomir.hpp:214
DGG_list_delcut
void DGG_list_delcut(DGG_list_t *l, int i)
OsiCuts
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
CglTwomir::generateCuts
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.
DGG_data_t::nbasic_row
int nbasic_row
Definition: CglTwomir.hpp:49
DGG_constraint_t
Definition: CglTwomir.hpp:13
CglTwomir::refreshSolver
virtual void refreshSolver(OsiSolverInterface *solver)
This can be used to refresh any inforamtion.
CglTwomir::do_form_
bool do_form_
Threadsafe random number generator.
Definition: CglTwomir.hpp:209
CglTwomir::q_min_
int q_min_
t_max - last value of t to use for tMIR inequalities
Definition: CglTwomir.hpp:213
CglTwomir::getAway
double getAway() const
Get away.
cutParams::t_max
int t_max
Definition: CglTwomir.hpp:37
DGG_generateFormulationCutsFromBase
int DGG_generateFormulationCutsFromBase(DGG_constraint_t *base, double slack, DGG_list_t *list, DGG_data_t *data, const void *solver_ptr, CoinThreadRandom &generator)
DGG_list_t
Definition: CglTwomir.hpp:25
CglTwomir::CglTwomir
CglTwomir()
Default constructor.
DGG_addMirToList
int DGG_addMirToList(DGG_constraint_t *base, char *isint, double *x, DGG_list_t *list, DGG_data_t *data, DGG_constraint_t *orig_base)
DGG_scaleConstraint
void DGG_scaleConstraint(DGG_constraint_t *c, int t)
CglTwomir::setCutTypes
void setCutTypes(bool mir, bool twomir, bool tab, bool form)
Set.
Definition: CglTwomir.hpp:120
DGG_list_t::c
DGG_constraint_t ** c
Definition: CglTwomir.hpp:27
CglTwomir::getMaxElements
int getMaxElements() const
Set.
Definition: CglTwomir.hpp:130
DGG_add2stepToList
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)
CglTwomir::getMaxElementsRoot
int getMaxElementsRoot() const
Set.
Definition: CglTwomir.hpp:131
CglTwomir::form_nrows_
int form_nrows_
Maximum number of elements in cut at root.
Definition: CglTwomir.hpp:218
CglCutGenerator.hpp
CglTwomir::a_max_
int a_max_
q_max - last value of t to use for 2-Step tMIR inequalities
Definition: CglTwomir.hpp:215
CglTwomir::passInOriginalSolver
void passInOriginalSolver(OsiSolverInterface *solver)
Pass in a copy of original solver (clone it)
CglTwomir::probname_
std::string probname_
Problem name.
Definition: CglTwomir.hpp:100
cutParams
Definition: CglTwomir.hpp:33
DGG_cutLHS
double DGG_cutLHS(DGG_constraint_t *c, double *x)
CglTwomir::setMaxElements
void setMaxElements(int n)
Set.
Definition: CglTwomir.hpp:118
cut
Definition: Cgl012cut.hpp:153
CglTwomir::getIfTwomir
int getIfTwomir() const
Set.
Definition: CglTwomir.hpp:133
CglTwomir::setMaxElementsRoot
void setMaxElementsRoot(int n)
Set.
Definition: CglTwomir.hpp:119
OsiSolverInterface
Abstract Base Class for describing an interface to a solver.
Definition: OsiSolverInterface.hpp:62
CglTwomir::do_mir_
bool do_mir_
Threadsafe random number generator.
Definition: CglTwomir.hpp:206
CglCutGenerator
Cut Generator Base Class.
Definition: CglCutGenerator.hpp:23
CglTwomir::getTmax
int getTmax() const
Set.
Definition: CglTwomir.hpp:126
CglTwomir::getAmax
int getAmax() const
Set.
Definition: CglTwomir.hpp:129
DGG_data_t::info
int * info
Definition: CglTwomir.hpp:53
DGG_newConstraint
DGG_constraint_t * DGG_newConstraint(int max_arrays)
CglTwomirUnitTest
void CglTwomirUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglTwomir class.
CglTwomir::away_
double away_
Only investigate if more than this away from integrality.
Definition: CglTwomir.hpp:201
DGG_data_t
Definition: CglTwomir.hpp:42
DGG_generateTabRowCuts
int DGG_generateTabRowCuts(DGG_list_t *list, DGG_data_t *data, const void *solver_ptr)
CglTwomir::~CglTwomir
virtual ~CglTwomir()
Destructor.
CglTwomir::getIfMir
int getIfMir() const
Set.
Definition: CglTwomir.hpp:132
DGG_getSlackExpression
DGG_constraint_t * DGG_getSlackExpression(const void *solver_ptr, DGG_data_t *data, int row_index)
DGG_constraint_t::index
int * index
Definition: CglTwomir.hpp:19
cutParams::q_min
int q_min
Definition: CglTwomir.hpp:34
DGG_constraint_t::coeff
double * coeff
Definition: CglTwomir.hpp:18
DGG_freeData
int DGG_freeData(DGG_data_t *data)
CglTwomir::getTmin
int getTmin() const
Get.
Definition: CglTwomir.hpp:125
DGG_list_t::n
int n
Definition: CglTwomir.hpp:26
CglTwomir::twomirType
int twomirType() const
Return type.
Definition: CglTwomir.hpp:166
DGG_isCutDesirable
int DGG_isCutDesirable(DGG_constraint_t *c, DGG_data_t *d)
DGG_unTransformConstraint
int DGG_unTransformConstraint(DGG_data_t *data, DGG_constraint_t *constraint)
CglTwomir::getAwayAtRoot
double getAwayAtRoot() const
Get away at root.
CglTwomir::generateCpp
virtual std::string generateCpp(FILE *fp)
Create C++ lines to get to current state.
DGG_generateCutsFromBase
int DGG_generateCutsFromBase(DGG_constraint_t *base, DGG_list_t *list, DGG_data_t *data, const void *solver_ptr)
CoinThreadRandom
Class for thread specific random numbers.
Definition: CoinHelperFunctions.hpp:953
CglTwomir::setAMax
void setAMax(int a)
Set.
Definition: CglTwomir.hpp:117
DGG_constraint_t::rhs
double rhs
Definition: CglTwomir.hpp:20
DGG_freeConstraint
void DGG_freeConstraint(DGG_constraint_t *c)
CglTwomir::getIfFormulation
int getIfFormulation() const
Set.
Definition: CglTwomir.hpp:135
CoinFactorization.hpp
CglTwomir::twomirType_
int twomirType_
Type - 0 normal, 1 add original matrix one, 2 replace.
Definition: CglTwomir.hpp:205
DGG_list_init
void DGG_list_init(DGG_list_t *l)
DGG_isBaseTrivial
int DGG_isBaseTrivial(DGG_data_t *d, DGG_constraint_t *c)
cutParams::q_max
int q_max
Definition: CglTwomir.hpp:35
cutParams::max_elements
int max_elements
Definition: CglTwomir.hpp:39
DGG_copyConstraint
DGG_constraint_t * DGG_copyConstraint(DGG_constraint_t *c)
DGG_substituteSlacks
int DGG_substituteSlacks(const void *solver_ptr, DGG_data_t *data, DGG_constraint_t *cut)
CglTwomir::clone
virtual CglCutGenerator * clone() const
Clone.
CoinFactorization
This deals with Factorization and Updates.
Definition: CoinFactorization.hpp:50
CglTwomir::t_min_
int t_min_
Threadsafe random number generator.
Definition: CglTwomir.hpp:211
DGG_generateFormulationCuts
int DGG_generateFormulationCuts(DGG_list_t *list, DGG_data_t *data, const void *solver_ptr, int nrows, CoinThreadRandom &generator)
CglTwomir::setAway
void setAway(double value)
Set away.
DGG_data_t::lb
double * lb
Definition: CglTwomir.hpp:54
DGG_nicefyConstraint
int DGG_nicefyConstraint(const void *solver_ptr, DGG_data_t *data, DGG_constraint_t *cut)
DGG_getFormulaConstraint
int DGG_getFormulaConstraint(int row_idx, const void *solver_ptr, DGG_data_t *data, DGG_constraint_t *row)
DGG_constraint_t::nz
int nz
Definition: CglTwomir.hpp:16
CglTwomir::CglTwomirUnitTest
friend void CglTwomirUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglTwomir class.
CglTreeInfo
Information about where the cut generator is invoked from.
Definition: CglTreeInfo.hpp:15
DGG_getTableauConstraint
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)
DGG_data_t::opt_x
double * opt_x
Definition: CglTwomir.hpp:58
CglTwomir::maximumLengthOfCutInTree
virtual int maximumLengthOfCutInTree() const
Return maximum length of cut in tree.
Definition: CglTwomir.hpp:151
CglTwomir::do_2mir_
bool do_2mir_
Threadsafe random number generator.
Definition: CglTwomir.hpp:207
CglTwomir::setFormulationRows
void setFormulationRows(int n)
Set.
Definition: CglTwomir.hpp:122
CoinWarmStartBasis
The default COIN simplex (basis-oriented) warm start class.
Definition: CoinWarmStartBasis.hpp:40
CglTwomir::setMirScale
void setMirScale(int tmin, int tmax)
Set.
Definition: CglTwomir.hpp:115
DGG_buildMir
int DGG_buildMir(char *isint, DGG_constraint_t *base, DGG_constraint_t **cut_out)
DGG_isConstraintViolated
int DGG_isConstraintViolated(DGG_data_t *d, DGG_constraint_t *c)
CglTwomir
Twostep MIR Cut Generator Class.
Definition: CglTwomir.hpp:91
DGG_list_free
void DGG_list_free(DGG_list_t *l)