Cgl  0.60.7
CglLandPValidator.hpp
Go to the documentation of this file.
1 // Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved.
2 // Author: Pierre Bonami
3 // Tepper School of Business
4 // Carnegie Mellon University, Pittsburgh, PA 15213
5 // Date: 11/22/05
6 //
7 // $Id$
8 //
9 // This code is licensed under the terms of the Eclipse Public License (EPL).
10 //---------------------------------------------------------------------------
11 
12 #ifndef CglLandPValidator_H
13 #define CglLandPValidator_H
14 #include "OsiSolverInterface.hpp"
15 #include "CglParam.hpp"
16 #include <vector>
17 
19 //[5] = {"Accepted", "violation too small", "small coefficient too small", "big dynamic","too dense"}
20 
21 
22 namespace LAP
23 {
24 
26 class Validator
27 {
28 public:
31  {
39  };
40 
42  Validator(double maxFillIn = 1.,
43  double maxRatio = 1e8,
44  double minViolation = 0,
45  bool scale = false,
46  double rhsScale = 1);
47 
49  int cleanCut(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par,
50  const double * colLower, const double * colUpper);
52  int cleanCut2(OsiRowCut & aCut, const double * solCut, const OsiSolverInterface &si, const CglParam & par,
53  const double * colLower, const double * colUpper);
55  int operator()(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par,
56  const double * colLower, const double * colUpper)
57  {
58  return cleanCut(aCut, solCut, si, par, colLower, colUpper);
59  }
62  void setMaxFillIn(double value)
63  {
64  maxFillIn_ = value;
65  }
66  void setMaxRatio(double value)
67  {
68  maxRatio_ = value;
69  }
70  void setMinViolation(double value)
71  {
72  minViolation_ = value;
73  }
74 
75  void setRhsScale(double v)
76  {
77  rhsScale_ = v;
78  }
82  double getMaxFillIn()
83  {
84  return maxFillIn_;
85  }
86  double getMaxRatio()
87  {
88  return maxRatio_;
89  }
90  double getMinViolation()
91  {
92  return minViolation_;
93  }
96  const char* failureString(RejectionsReasons code) const
97  {
98  return rejections_[static_cast<int> (code)];
99  }
100  const char* failureString(int code) const
101  {
102  return rejections_[ code];
103  }
105  {
106  return numRejected_[static_cast<int> (code)];
107  }
108  int numRejected(int code)const
109  {
110  return numRejected_[ code];
111  }
112 private:
114  double maxFillIn_;
116  double maxRatio_;
120  //bool scale_;
122  double rhsScale_;
124  static const char* rejections_[DummyEnd];
126  std::vector<int> numRejected_;
127 };
128 
129 }/* Ends namespace LAP.*/
130 #endif
LAP::Validator::minViolation_
double minViolation_
minimum violation for accepting a cut
Definition: CglLandPValidator.hpp:118
CglParam
Class collecting parameters for all cut generators.
Definition: CglParam.hpp:22
LAP::Validator::maxRatio_
double maxRatio_
max ratio between smallest and biggest coefficient
Definition: CglLandPValidator.hpp:116
LAP::Validator::numRejected
int numRejected(RejectionsReasons code) const
Definition: CglLandPValidator.hpp:104
LAP::Validator::setRhsScale
void setRhsScale(double v)
Definition: CglLandPValidator.hpp:75
LAP::scale
void scale(OsiRowCut &cut)
scale the cut passed as argument
LAP::Validator::RejectionsReasons
RejectionsReasons
Reasons for rejecting a cut.
Definition: CglLandPValidator.hpp:30
LAP::Validator::cleanCut
int cleanCut(OsiRowCut &aCut, const double *solCut, const OsiSolverInterface &si, const CglParam &par, const double *colLower, const double *colUpper)
Clean an OsiCut.
LAP::Validator::operator()
int operator()(OsiRowCut &aCut, const double *solCut, const OsiSolverInterface &si, const CglParam &par, const double *colLower, const double *colUpper)
Call the cut cleaner.
Definition: CglLandPValidator.hpp:55
LAP::Validator::setMaxRatio
void setMaxRatio(double value)
Definition: CglLandPValidator.hpp:66
LAP::Validator::NoneAccepted
@ NoneAccepted
Definition: CglLandPValidator.hpp:32
LAP::Validator::maxFillIn_
double maxFillIn_
max percentage of given formulation fillIn should be accepted for cut fillin.
Definition: CglLandPValidator.hpp:114
LAP::Validator::rhsScale_
double rhsScale_
Do we do scaling?
Definition: CglLandPValidator.hpp:122
LAP::Validator::numRejected_
std::vector< int > numRejected_
Number of cut rejected for each of the reasons.
Definition: CglLandPValidator.hpp:126
LAP::Validator::setMaxFillIn
void setMaxFillIn(double value)
Definition: CglLandPValidator.hpp:62
CglParam.hpp
LAP::Validator::EmptyCut
@ EmptyCut
After cleaning cut has become empty.
Definition: CglLandPValidator.hpp:37
LAP::Validator::getMaxRatio
double getMaxRatio()
Definition: CglLandPValidator.hpp:86
LAP::Validator::failureString
const char * failureString(RejectionsReasons code) const
Definition: CglLandPValidator.hpp:96
LAP::Validator::Validator
Validator(double maxFillIn=1., double maxRatio=1e8, double minViolation=0, bool scale=false, double rhsScale=1)
Constructor with default values.
LAP::Validator::numRejected
int numRejected(int code) const
Definition: CglLandPValidator.hpp:108
LAP::Validator::DummyEnd
@ DummyEnd
dummy
Definition: CglLandPValidator.hpp:38
LAP::Validator::setMinViolation
void setMinViolation(double value)
Definition: CglLandPValidator.hpp:70
LAP::Validator::SmallCoefficient
@ SmallCoefficient
There is a small coefficient we can not get rid off.
Definition: CglLandPValidator.hpp:34
LAP::Validator::getMaxFillIn
double getMaxFillIn()
Definition: CglLandPValidator.hpp:82
LAP::Validator::SmallViolation
@ SmallViolation
Violation of the cut is too small.
Definition: CglLandPValidator.hpp:33
LAP::Validator::BigDynamic
@ BigDynamic
Dynamic of coefficinet is too important.
Definition: CglLandPValidator.hpp:35
LAP::Validator::failureString
const char * failureString(int code) const
Definition: CglLandPValidator.hpp:100
LAP::Validator::cleanCut2
int cleanCut2(OsiRowCut &aCut, const double *solCut, const OsiSolverInterface &si, const CglParam &par, const double *colLower, const double *colUpper)
Clean an OsiCut by another method.
LAP::Validator::DenseCut
@ DenseCut
cut is too dense
Definition: CglLandPValidator.hpp:36
LAP::Validator
Class to validate or reject a cut.
Definition: CglLandPValidator.hpp:26
LAP::Validator::rejections_
static const char * rejections_[DummyEnd]
Strings explaining reason for rejections.
Definition: CglLandPValidator.hpp:124
LAP::Validator::getMinViolation
double getMinViolation()
Definition: CglLandPValidator.hpp:90
LAP
Performs one round of Lift & Project using CglLandPSimplex to build cuts.
Definition: CglLandP.hpp:24