00001
00002
00003
00004
00005
00006
00007
00008 #ifndef CglLandPValidator_H
00009 #define CglLandPValidator_H
00010 #include "OsiSolverInterface.hpp"
00011 #include "CglParam.hpp"
00012 #include <vector>
00013
00015
00016
00017
00018 namespace LAP
00019 {
00020
00022 class Validator
00023 {
00024 public:
00026 enum RejectionsReasons
00027 {
00028 NoneAccepted=0 ,
00029 SmallViolation ,
00030 SmallCoefficient ,
00031 BigDynamic ,
00032 DenseCut,
00033 EmptyCut,
00034 DummyEnd
00035 };
00036
00038 Validator(double maxFillIn = 1.,
00039 double maxRatio = 1e8,
00040 double minViolation = 0,
00041 bool scale = false,
00042 double rhsScale = 1);
00043
00045 int cleanCut(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par,
00046 const double * colLower, const double * colUpper) const;
00048 int cleanCut2(OsiRowCut & aCut, const double * solCut, const OsiSolverInterface &si, const CglParam & par,
00049 const double * colLower, const double * colUpper) const;
00051 int operator()(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par,
00052 const double * colLower, const double * colUpper) const
00053 {
00054 return cleanCut(aCut, solCut, si, par, colLower, colUpper);
00055 }
00058 void setMaxFillIn(double value)
00059 {
00060 maxFillIn_ = value;
00061 }
00062 void setMaxRatio(double value)
00063 {
00064 maxRatio_ = value;
00065 }
00066 void setMinViolation(double value)
00067 {
00068 minViolation_ = value;
00069 }
00070
00071 void setRhsScale(double v)
00072 {
00073 rhsScale_ = v;
00074 }
00078 double getMaxFillIn()
00079 {
00080 return maxFillIn_;
00081 }
00082 double getMaxRatio()
00083 {
00084 return maxRatio_;
00085 }
00086 double getMinViolation()
00087 {
00088 return minViolation_;
00089 }
00092 const std::string& failureString(RejectionsReasons code) const
00093 {
00094 return rejections_[static_cast<int> (code)];
00095 }
00096 const std::string& failureString(int code) const
00097 {
00098 return rejections_[ code];
00099 }
00100 int numRejected(RejectionsReasons code)const
00101 {
00102 return numRejected_[static_cast<int> (code)];
00103 }
00104 int numRejected(int code)const
00105 {
00106 return numRejected_[ code];
00107 }
00108 private:
00109 static void fillRejectionReasons();
00111 double maxFillIn_;
00113 double maxRatio_;
00115 double minViolation_;
00117 bool scale_;
00119 double rhsScale_;
00121 static std::vector<std::string> rejections_;
00123 mutable std::vector<int> numRejected_;
00124 };
00125
00126 }
00127 #endif