From 9fd2976931c088dc523974afb901e96bad20f73c Mon Sep 17 00:00:00 2001 From: Harpreet Date: Thu, 4 Aug 2016 15:25:44 +0530 Subject: initial add --- build/Bonmin/include/coin/CglLandPValidator.hpp | 130 ++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 build/Bonmin/include/coin/CglLandPValidator.hpp (limited to 'build/Bonmin/include/coin/CglLandPValidator.hpp') diff --git a/build/Bonmin/include/coin/CglLandPValidator.hpp b/build/Bonmin/include/coin/CglLandPValidator.hpp new file mode 100644 index 0000000..b9e363d --- /dev/null +++ b/build/Bonmin/include/coin/CglLandPValidator.hpp @@ -0,0 +1,130 @@ +// 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: CglLandPValidator.hpp 1302 2015-08-14 15:48:32Z stefan $ +// +// 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 + +/** constants describing rejection codes*/ +//[5] = {"Accepted", "violation too small", "small coefficient too small", "big dynamic","too dense"} + + +namespace LAP +{ + +/** Class to validate or reject a cut */ +class Validator +{ +public: + /** Reasons for rejecting a cut */ + enum RejectionsReasons + { + NoneAccepted=0 /**Cut was accepted*/, + SmallViolation /** Violation of the cut is too small */, + SmallCoefficient /** There is a small coefficient we can not get rid off.*/, + BigDynamic /** Dynamic of coefficinet is too important. */, + DenseCut/**cut is too dense */, + EmptyCut/**After cleaning cut has become empty*/, + DummyEnd/** dummy*/ + }; + + /** Constructor with default values */ + Validator(double maxFillIn = 1., + double maxRatio = 1e8, + double minViolation = 0, + bool scale = false, + double rhsScale = 1); + + /** Clean an OsiCut */ + int cleanCut(OsiRowCut & aCut, const double * solCut,const OsiSolverInterface &si, const CglParam & par, + const double * colLower, const double * colUpper); + /** Clean an OsiCut by another method */ + int cleanCut2(OsiRowCut & aCut, const double * solCut, const OsiSolverInterface &si, const CglParam & par, + const double * colLower, const double * colUpper); + /** Call the cut cleaner */ + 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); + } + /** @name set functions */ + /** @{ */ + void setMaxFillIn(double value) + { + maxFillIn_ = value; + } + void setMaxRatio(double value) + { + maxRatio_ = value; + } + void setMinViolation(double value) + { + minViolation_ = value; + } + + void setRhsScale(double v) + { + rhsScale_ = v; + } + /** @} */ + /** @name get functions */ + /** @{ */ + double getMaxFillIn() + { + return maxFillIn_; + } + double getMaxRatio() + { + return maxRatio_; + } + double getMinViolation() + { + return minViolation_; + } + /** @} */ + + const char* failureString(RejectionsReasons code) const + { + return rejections_[static_cast (code)]; + } + const char* failureString(int code) const + { + return rejections_[ code]; + } + int numRejected(RejectionsReasons code)const + { + return numRejected_[static_cast (code)]; + } + int numRejected(int code)const + { + return numRejected_[ code]; + } +private: + /** max percentage of given formulation fillIn should be accepted for cut fillin.*/ + double maxFillIn_; + /** max ratio between smallest and biggest coefficient */ + double maxRatio_; + /** minimum violation for accepting a cut */ + double minViolation_; + /** Do we do scaling? */ + bool scale_; + /** Scale of right-hand-side.*/ + double rhsScale_; + /** Strings explaining reason for rejections */ + static const char* rejections_[DummyEnd]; + /** Number of cut rejected for each of the reasons.*/ + std::vector numRejected_; +}; + +}/* Ends namespace LAP.*/ +#endif -- cgit