coin-Cgl
CglLandPValidator.hpp
Go to the documentation of this file.
1 // Copyright (C) 2005, 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 
8 #ifndef CglLandPValidator_H
9 #define CglLandPValidator_H
10 #include "OsiSolverInterface.hpp"
11 #include "CglParam.hpp"
12 #include <vector>
13 
15 //[5] = {"Accepted", "violation too small", "small coefficient too small", "big dynamic","too dense"}
16 
17 
18 namespace LAP
19 {
20 
22 class Validator
23 {
24 public:
34  };
35 
37  Validator(double maxFillIn = 1.,
38  double maxRatio = 1e8,
39  double minViolation = 0,
40  bool scale = false,
41  double rhsScale = 1);
42 
44  int cleanCut(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par,
45  const double * colLower, const double * colUpper) const;
47  int cleanCut2(OsiRowCut & aCut, const double * solCut, const OsiSolverInterface &si, const CglParam & par,
48  const double * colLower, const double * colUpper) const;
50  int operator()(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par,
51  const double * colLower, const double * colUpper) const {
52  return cleanCut(aCut, solCut, si, par, colLower, colUpper);
53  }
56  void setMaxFillIn(double value) {
57  maxFillIn_ = value;
58  }
59  void setMaxRatio(double value) {
60  maxRatio_ = value;
61  }
62  void setMinViolation(double value) {
63  minViolation_ = value;
64  }
65 
66  void setRhsScale(double v){
67  rhsScale_ = v;
68  }
72  double getMaxFillIn() {
73  return maxFillIn_;
74  }
75  double getMaxRatio() {
76  return maxRatio_;
77  }
78  double getMinViolation() {
79  return minViolation_;
80  }
83  const std::string& failureString(RejectionsReasons code) const {
84  return rejections_[(int) code];
85  }
86  const std::string& failureString(int code) const {
87  return rejections_[ code];
88  }
89  int numRejected(RejectionsReasons code)const {
90  return numRejected_[(int) code];
91  }
92  int numRejected(int code)const {
93  return numRejected_[ code];
94  }
95 private:
96  static void fillRejectionReasons();
98  double maxFillIn_;
100  double maxRatio_;
104  bool scale_;
106  double rhsScale_;
108  static std::vector<std::string> rejections_;
110  mutable std::vector<int> numRejected_;
111 };
112 
113 }/* Ends namespace LAP.*/
114 #endif