Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: CglLandPValidator.hpp 1302 2015-08-14 15:48:32Z stefan $
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
void setMaxFillIn(double value)
double rhsScale_
Scale of right-hand-side.
std::vector< int > numRejected_
Number of cut rejected for each of the reasons.
const char * failureString(int code) const
int numRejected(RejectionsReasons code) const
Validator(double maxFillIn=1., double maxRatio=1e8, double minViolation=0, bool scale=false, double rhsScale=1)
Constructor with default values.
After cleaning cut has become empty.
void setMinViolation(double value)
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.
Abstract Base Class for describing an interface to a solver.
static const char * rejections_[DummyEnd]
Strings explaining reason for rejections.
There is a small coefficient we can not get rid off.
bool scale_
Do we do scaling?
int numRejected(int code) const
Class collecting parameters for all cut generators.
Definition: CglParam.hpp:22
double maxRatio_
max ratio between smallest and biggest coefficient
double minViolation_
minimum violation for accepting a cut
void scale(OsiRowCut &cut)
scale the cut passed as argument
const char * failureString(RejectionsReasons code) const
Row Cut Class.
Definition: OsiRowCut.hpp:29
RejectionsReasons
Reasons for rejecting a cut.
Violation of the cut is too small.
Dynamic of coefficinet is too important.
int cleanCut(OsiRowCut &aCut, const double *solCut, const OsiSolverInterface &si, const CglParam &par, const double *colLower, const double *colUpper)
Clean an OsiCut.
void setRhsScale(double v)
int operator()(OsiRowCut &aCut, const double *solCut, const OsiSolverInterface &si, const CglParam &par, const double *colLower, const double *colUpper)
Call the cut cleaner.
void setMaxRatio(double value)
Class to validate or reject a cut.
double maxFillIn_
max percentage of given formulation fillIn should be accepted for cut fillin.