Cgl 0.60.3
Loading...
Searching...
No Matches
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 1303 2015-08-14 15:49:52Z 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
22namespace LAP
23{
24
27{
28public:
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 }
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 }
112private:
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
Class collecting parameters for all cut generators.
Definition CglParam.hpp:22
Class to validate or reject a cut.
double minViolation_
minimum violation for accepting a cut
const char * failureString(int code) const
void setRhsScale(double v)
static const char * rejections_[DummyEnd]
Strings explaining reason for rejections.
double maxFillIn_
max percentage of given formulation fillIn should be accepted for cut fillin.
void setMinViolation(double value)
int numRejected(RejectionsReasons code) const
void setMaxRatio(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.
bool scale_
Do we do scaling?
int cleanCut(OsiRowCut &aCut, const double *solCut, const OsiSolverInterface &si, const CglParam &par, const double *colLower, const double *colUpper)
Clean an OsiCut.
RejectionsReasons
Reasons for rejecting a cut.
@ BigDynamic
Dynamic of coefficinet is too important.
@ SmallViolation
Violation of the cut is too small.
@ DenseCut
cut is too dense
@ EmptyCut
After cleaning cut has become empty.
@ SmallCoefficient
There is a small coefficient we can not get rid off.
std::vector< int > numRejected_
Number of cut rejected for each of the reasons.
double rhsScale_
Scale of right-hand-side.
double maxRatio_
max ratio between smallest and biggest coefficient
int operator()(OsiRowCut &aCut, const double *solCut, const OsiSolverInterface &si, const CglParam &par, const double *colLower, const double *colUpper)
Call the cut cleaner.
const char * failureString(RejectionsReasons code) const
void setMaxFillIn(double value)
int numRejected(int code) const
Validator(double maxFillIn=1., double maxRatio=1e8, double minViolation=0, bool scale=false, double rhsScale=1)
Constructor with default values.
Performs one round of Lift & Project using CglLandPSimplex to build cuts.
Definition CglLandP.hpp:25
void scale(OsiRowCut &cut)
scale the cut passed as argument