Loading...
Searching...
No Matches
CglGomory.hpp
Go to the documentation of this file.
// Copyright (C) 2002, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
#ifndef CglGomory_H
#define CglGomory_H
#include <string>
#include "CglCutGenerator.hpp"
class CoinWarmStartBasis;
class CglGomory : public CglCutGenerator {
friend void CglGomoryUnitTest(const OsiSolverInterface * siP,
const std::string mpdDir );
public:
virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
const CglTreeInfo info = CglTreeInfo());
int generateCuts( const OsiRowCutDebugger * debugger,
OsiCuts & cs,
const CoinPackedMatrix & columnCopy,
const CoinPackedMatrix & rowCopy,
const double * colsol,
const double * colLower, const double * colUpper,
const double * rowLower, const double * rowUpper,
const char * intVar ,
const CoinWarmStartBasis* warm,
const CglTreeInfo info = CglTreeInfo());
int generateCuts( const OsiRowCutDebugger * debugger,
OsiCuts & cs,
const CoinPackedMatrix & columnCopy,
const double * colsol,
const double * colLower, const double * colUpper,
const double * rowLower, const double * rowUpper,
const char * intVar ,
const CoinWarmStartBasis* warm,
const CglTreeInfo info = CglTreeInfo());
virtual bool needsOptimalBasis() const { return true; }
void passInOriginalSolver(OsiSolverInterface * solver);
inline OsiSolverInterface * originalSolver() const
{ return originalSolver_;}
inline void setGomoryType(int type)
{ gomoryType_=type;}
inline int gomoryType() const
{ return gomoryType_;}
void setLimit(int limit);
int getLimit() const;
void setLimitAtRoot(int limit);
int getLimitAtRoot() const;
virtual int maximumLengthOfCutInTree() const;
void setAway(double value);
double getAway() const;
void setAwayAtRoot(double value);
double getAwayAtRoot() const;
void setConditionNumberMultiplier(double value);
double getConditionNumberMultiplier() const;
void setLargestFactorMultiplier(double value);
double getLargestFactorMultiplier() const;
inline void useAlternativeFactorization(bool yes=true)
{ alternateFactorization_= (yes) ? 1 : 0;}
inline bool alternativeFactorization() const
{ return (alternateFactorization_!=0);}
CglGomory ();
CglGomory (
const CglGomory &);
virtual CglCutGenerator * clone() const;
CglGomory &
operator=(
const CglGomory& rhs);
virtual
~CglGomory ();
virtual std::string generateCpp( FILE * fp);
virtual void refreshSolver(OsiSolverInterface * solver);
private:
// Private member methods
// Private member data
double away_;
double awayAtRoot_;
double conditionNumberMultiplier_;
double largestFactorMultiplier_;
OsiSolverInterface * originalSolver_;
int limit_;
int limitAtRoot_;
int dynamicLimitInTree_;
int numberTimesStalled_;
int alternateFactorization_;
int gomoryType_; // note could add in cutoff as constraint
};
//#############################################################################
void CglGomoryUnitTest(const OsiSolverInterface * siP,
const std::string mpdDir );
#endif
CglCutGenerator.hpp
CglGomoryUnitTest
void CglGomoryUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglGomory class.
CglCutGenerator::CglCutGenerator
CglCutGenerator()
Default constructor.
CglGomory::getLargestFactorMultiplier
double getLargestFactorMultiplier() const
Get LargestFactorMultiplier.
CglGomory::CglGomory
CglGomory(const CglGomory &)
Copy constructor.
CglGomory::useAlternativeFactorization
void useAlternativeFactorization(bool yes=true)
Set/unset alternative factorization.
Definition CglGomory.hpp:129
CglGomory::awayAtRoot_
double awayAtRoot_
Only investigate if more than this away from integrality (at root).
Definition CglGomory.hpp:173
CglGomory::passInOriginalSolver
void passInOriginalSolver(OsiSolverInterface *solver)
Pass in a copy of original solver (clone it).
CglGomory::needsOptimalBasis
virtual bool needsOptimalBasis() const
Return true if needs optimal basis to do cuts (will return true).
Definition CglGomory.hpp:61
CglGomory::operator=
CglGomory & operator=(const CglGomory &rhs)
Assignment operator.
CglGomory::setLimit
void setLimit(int limit)
Set.
CglGomory::getLimit
int getLimit() const
Get.
CglGomory::refreshSolver
virtual void refreshSolver(OsiSolverInterface *solver)
This can be used to refresh any inforamtion.
CglGomory::setAwayAtRoot
void setAwayAtRoot(double value)
Set away at root.
CglGomory::away_
double away_
Only investigate if more than this away from integrality.
Definition CglGomory.hpp:171
CglGomory::CglGomoryUnitTest
friend void CglGomoryUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglGomory class.
CglGomory::setLargestFactorMultiplier
void setLargestFactorMultiplier(double value)
Set LargestFactorMultiplier.
CglGomory::limitAtRoot_
int limitAtRoot_
Limit - only generate if fewer than this in cut (at root).
Definition CglGomory.hpp:183
CglGomory::maximumLengthOfCutInTree
virtual int maximumLengthOfCutInTree() const
Return maximum length of cut in tree.
CglGomory::generateCuts
virtual void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo())
Generate Mixed Integer Gomory cuts for the model of the solver interface, si.
CglGomory::generateCpp
virtual std::string generateCpp(FILE *fp)
Create C++ lines to get to current state.
CglGomory::originalSolver
OsiSolverInterface * originalSolver() const
Returns original solver.
Definition CglGomory.hpp:69
CglGomory::numberTimesStalled_
int numberTimesStalled_
Number of times stalled.
Definition CglGomory.hpp:187
CglGomory::gomoryType
int gomoryType() const
Return type.
Definition CglGomory.hpp:75
CglGomory::getConditionNumberMultiplier
double getConditionNumberMultiplier() const
Get ConditionNumberMultiplier.
CglGomory::alternateFactorization_
int alternateFactorization_
nonzero to use alternative factorization
Definition CglGomory.hpp:189
CglGomory::setConditionNumberMultiplier
void setConditionNumberMultiplier(double value)
Set ConditionNumberMultiplier.
CglGomory::setLimitAtRoot
void setLimitAtRoot(int limit)
Set at root (if <normal then use normal).
CglGomory::getAwayAtRoot
double getAwayAtRoot() const
Get away at root.
CglGomory::clone
virtual CglCutGenerator * clone() const
Clone.
CglGomory::conditionNumberMultiplier_
double conditionNumberMultiplier_
Multiplier for conditionNumber cut relaxation.
Definition CglGomory.hpp:175
CglGomory::generateCuts
int generateCuts(const OsiRowCutDebugger *debugger, OsiCuts &cs, const CoinPackedMatrix &columnCopy, const double *colsol, const double *colLower, const double *colUpper, const double *rowLower, const double *rowUpper, const char *intVar, const CoinWarmStartBasis *warm, const CglTreeInfo info=CglTreeInfo())
Generates cuts given matrix and solution etc, returns number of cuts generated (no row copy passed in...
CglGomory::generateCuts
int generateCuts(const OsiRowCutDebugger *debugger, OsiCuts &cs, const CoinPackedMatrix &columnCopy, const CoinPackedMatrix &rowCopy, const double *colsol, const double *colLower, const double *colUpper, const double *rowLower, const double *rowUpper, const char *intVar, const CoinWarmStartBasis *warm, const CglTreeInfo info=CglTreeInfo())
Generates cuts given matrix and solution etc, returns number of cuts generated.
CglGomory::alternativeFactorization
bool alternativeFactorization() const
Get whether alternative factorization being used.
Definition CglGomory.hpp:132
CglGomory::getLimitAtRoot
int getLimitAtRoot() const
Get at root.
CglGomory::limit_
int limit_
Limit - only generate if fewer than this in cut.
Definition CglGomory.hpp:181
CglGomory::getAway
double getAway() const
Get away.
CglGomory::setGomoryType
void setGomoryType(int type)
Set type - 0 normal, 1 add original matrix one, 2 replace.
Definition CglGomory.hpp:72
CglGomory::gomoryType_
int gomoryType_
Type - 0 normal, 1 add original matrix one, 2 replace.
Definition CglGomory.hpp:191
CglGomory::setAway
void setAway(double value)
Set away.
CglGomory::~CglGomory
virtual ~CglGomory()
Destructor.
CglGomory::CglGomory
CglGomory()
Default constructor.
CglGomory::largestFactorMultiplier_
double largestFactorMultiplier_
Multiplier for largest factor cut relaxation.
Definition CglGomory.hpp:177
CglGomory::originalSolver_
OsiSolverInterface * originalSolver_
Original solver.
Definition CglGomory.hpp:179
CglGomory::dynamicLimitInTree_
int dynamicLimitInTree_
Dynamic limit in tree.
Definition CglGomory.hpp:185
CglTreeInfo
Information about where the cut generator is invoked from.
Definition CglTreeInfo.hpp:15