Loading...
Searching...
No Matches
CglLandPValidator.hpp
Go to the documentation of this file.
// Copyright (C) 2005-2009, Pierre Bonami and others. All Rights Reserved.
// Author: Pierre Bonami
// Tepper School of Business
// Carnegie Mellon University, Pittsburgh, PA 15213
// Date: 11/22/05
//
// $Id$
//
// This code is licensed under the terms of the Eclipse Public License (EPL).
//---------------------------------------------------------------------------
#ifndef CglLandPValidator_H
#define CglLandPValidator_H
#include "OsiSolverInterface.hpp"
#include "CglParam.hpp"
#include <vector>
//[5] = {"Accepted", "violation too small", "small coefficient too small", "big dynamic","too dense"}
namespace LAP
{
class Validator
{
public:
enum RejectionsReasons
{
NoneAccepted=0 ,
SmallViolation ,
SmallCoefficient ,
BigDynamic ,
DenseCut,
EmptyCut,
DummyEnd
};
Validator(double maxFillIn = 1.,
double maxRatio = 1e8,
double minViolation = 0,
bool scale = false,
double rhsScale = 1);
int cleanCut(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par,
const double * colLower, const double * colUpper);
int cleanCut2(OsiRowCut & aCut, const double * solCut, const OsiSolverInterface &si, const CglParam & par,
const double * colLower, const double * colUpper);
int operator()(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par,
const double * colLower, const double * colUpper)
{
return cleanCut(aCut, solCut, si, par, colLower, colUpper);
}
void setMaxFillIn(double value)
{
maxFillIn_ = value;
}
void setMaxRatio(double value)
{
maxRatio_ = value;
}
void setMinViolation(double value)
{
minViolation_ = value;
}
void setRhsScale(double v)
{
rhsScale_ = v;
}
double getMaxFillIn()
{
return maxFillIn_;
}
double getMaxRatio()
{
return maxRatio_;
}
double getMinViolation()
{
return minViolation_;
}
const char* failureString(RejectionsReasons code) const
{
return rejections_[static_cast<int> (code)];
}
const char* failureString(int code) const
{
return rejections_[ code];
}
int numRejected(RejectionsReasons code)const
{
return numRejected_[static_cast<int> (code)];
}
int numRejected(int code)const
{
return numRejected_[ code];
}
private:
double maxFillIn_;
double maxRatio_;
double minViolation_;
//bool scale_;
double rhsScale_;
static const char* rejections_[DummyEnd];
std::vector<int> numRejected_;
};
}/* Ends namespace LAP.*/
#endif
CglParam.hpp
CglParam
Class collecting parameters for all cut generators.
Definition CglParam.hpp:22
LAP::Validator::minViolation_
double minViolation_
minimum violation for accepting a cut
Definition CglLandPValidator.hpp:118
LAP::Validator::failureString
const char * failureString(int code) const
Definition CglLandPValidator.hpp:100
LAP::Validator::getMinViolation
double getMinViolation()
Definition CglLandPValidator.hpp:90
LAP::Validator::setRhsScale
void setRhsScale(double v)
Definition CglLandPValidator.hpp:75
LAP::Validator::rejections_
static const char * rejections_[DummyEnd]
Strings explaining reason for rejections.
Definition CglLandPValidator.hpp:124
LAP::Validator::maxFillIn_
double maxFillIn_
max percentage of given formulation fillIn should be accepted for cut fillin.
Definition CglLandPValidator.hpp:114
LAP::Validator::setMinViolation
void setMinViolation(double value)
Definition CglLandPValidator.hpp:70
LAP::Validator::numRejected
int numRejected(RejectionsReasons code) const
Definition CglLandPValidator.hpp:104
LAP::Validator::setMaxRatio
void setMaxRatio(double value)
Definition CglLandPValidator.hpp:66
LAP::Validator::cleanCut2
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.
LAP::Validator::cleanCut
int cleanCut(OsiRowCut &aCut, const double *solCut, const OsiSolverInterface &si, const CglParam &par, const double *colLower, const double *colUpper)
Clean an OsiCut.
LAP::Validator::RejectionsReasons
RejectionsReasons
Reasons for rejecting a cut.
Definition CglLandPValidator.hpp:31
LAP::Validator::BigDynamic
@ BigDynamic
Dynamic of coefficinet is too important.
Definition CglLandPValidator.hpp:35
LAP::Validator::DummyEnd
@ DummyEnd
dummy
Definition CglLandPValidator.hpp:38
LAP::Validator::NoneAccepted
@ NoneAccepted
Definition CglLandPValidator.hpp:32
LAP::Validator::SmallViolation
@ SmallViolation
Violation of the cut is too small.
Definition CglLandPValidator.hpp:33
LAP::Validator::DenseCut
@ DenseCut
cut is too dense
Definition CglLandPValidator.hpp:36
LAP::Validator::EmptyCut
@ EmptyCut
After cleaning cut has become empty.
Definition CglLandPValidator.hpp:37
LAP::Validator::SmallCoefficient
@ SmallCoefficient
There is a small coefficient we can not get rid off.
Definition CglLandPValidator.hpp:34
LAP::Validator::numRejected_
std::vector< int > numRejected_
Number of cut rejected for each of the reasons.
Definition CglLandPValidator.hpp:126
LAP::Validator::getMaxRatio
double getMaxRatio()
Definition CglLandPValidator.hpp:86
LAP::Validator::rhsScale_
double rhsScale_
Do we do scaling?
Definition CglLandPValidator.hpp:122
LAP::Validator::maxRatio_
double maxRatio_
max ratio between smallest and biggest coefficient
Definition CglLandPValidator.hpp:116
LAP::Validator::operator()
int operator()(OsiRowCut &aCut, const double *solCut, const OsiSolverInterface &si, const CglParam &par, const double *colLower, const double *colUpper)
Call the cut cleaner.
Definition CglLandPValidator.hpp:55
LAP::Validator::failureString
const char * failureString(RejectionsReasons code) const
Definition CglLandPValidator.hpp:96
LAP::Validator::setMaxFillIn
void setMaxFillIn(double value)
Definition CglLandPValidator.hpp:62
LAP::Validator::numRejected
int numRejected(int code) const
Definition CglLandPValidator.hpp:108
LAP::Validator::getMaxFillIn
double getMaxFillIn()
Definition CglLandPValidator.hpp:82
LAP::Validator::Validator
Validator(double maxFillIn=1., double maxRatio=1e8, double minViolation=0, bool scale=false, double rhsScale=1)
Constructor with default values.
LAP
Performs one round of Lift & Project using CglLandPSimplex to build cuts.
Definition CglLandP.hpp:25
LAP::scale
void scale(OsiRowCut &cut)
scale the cut passed as argument