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 NoneAccepted=0 ,
00028 SmallViolation ,
00029 SmallCoefficient ,
00030 BigDynamic ,
00031 DenseCut,
00032 EmptyCut,
00033 DummyEnd
00034 };
00035
00037 Validator(double maxFillIn = 1.,
00038 double maxRatio = 1e8,
00039 double minViolation = 0,
00040 bool scale = false,
00041 double rhsScale = 1);
00042
00044 int cleanCut(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par,
00045 const double * colLower, const double * colUpper) const;
00047 int cleanCut2(OsiRowCut & aCut, const double * solCut, const OsiSolverInterface &si, const CglParam & par,
00048 const double * colLower, const double * colUpper) const;
00050 int operator()(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par,
00051 const double * colLower, const double * colUpper) const {
00052 return cleanCut(aCut, solCut, si, par, colLower, colUpper);
00053 }
00056 void setMaxFillIn(double value) {
00057 maxFillIn_ = value;
00058 }
00059 void setMaxRatio(double value) {
00060 maxRatio_ = value;
00061 }
00062 void setMinViolation(double value) {
00063 minViolation_ = value;
00064 }
00065
00066 void setRhsScale(double v){
00067 rhsScale_ = v;
00068 }
00072 double getMaxFillIn() {
00073 return maxFillIn_;
00074 }
00075 double getMaxRatio() {
00076 return maxRatio_;
00077 }
00078 double getMinViolation() {
00079 return minViolation_;
00080 }
00083 const std::string& failureString(RejectionsReasons code) const {
00084 return rejections_[(int) code];
00085 }
00086 const std::string& failureString(int code) const {
00087 return rejections_[ code];
00088 }
00089 int numRejected(RejectionsReasons code)const {
00090 return numRejected_[(int) code];
00091 }
00092 int numRejected(int code)const {
00093 return numRejected_[ code];
00094 }
00095 private:
00096 static void fillRejectionReasons();
00098 double maxFillIn_;
00100 double maxRatio_;
00102 double minViolation_;
00104 bool scale_;
00106 double rhsScale_;
00108 static std::vector<std::string> rejections_;
00110 mutable std::vector<int> numRejected_;
00111 };
00112
00113 }
00114 #endif