/home/coin/SVN-release/Alps-1.2.2/Cgl/src/CglLandP/CglLandP.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2005-2009, Pierre Bonami and others.  All Rights Reserved.
00002 // Author:   Pierre Bonami
00003 //           Tepper School of Business
00004 //           Carnegie Mellon University, Pittsburgh, PA 15213
00005 // Date:     07/21/05
00006 //---------------------------------------------------------------------------
00007 #ifndef CglLandP_H
00008 #define CglLandP_H
00009 
00010 #include "CglLandPValidator.hpp"
00011 #include "CglCutGenerator.hpp"
00012 #include "CglParam.hpp"
00013 
00014 #include <iostream>
00015 class CoinWarmStartBasis;
00020 namespace LAP
00021 {
00022 enum LapMessagesTypes
00023 {
00024     BEGIN_ROUND,
00025     END_ROUND,
00026     DURING_SEP,
00027     CUT_REJECTED,
00028     CUT_FAILED,
00029     CUT_GAP,
00030     LAP_CUT_FAILED_DO_MIG,
00031     LAP_MESSAGES_DUMMY_END
00032 };
00034 class LapMessages : public CoinMessages
00035 {
00036 public:
00038     LapMessages( );
00040     virtual ~LapMessages() {}
00041 };
00042 class CglLandPSimplex;
00043 }
00044 
00045 class CglLandP : public CglCutGenerator
00046 {
00047     friend void CglLandPUnitTest(OsiSolverInterface *si, const std::string & mpsDir);
00048 
00049     friend class LAP::CglLandPSimplex;
00050     friend class CftCglp;
00051 
00052 public:
00053 
00054     enum SelectionRules
00055     {
00056         mostNegativeRc ,
00057         bestPivot ,
00058         initialReducedCosts
00059     };
00060 
00061     enum ExtraCutsMode
00062     {
00063         none,
00064         AtOptimalBasis ,
00065         WhenEnteringBasis ,
00066         AllViolatedMigs
00067     };
00068 
00070     enum SeparationSpaces
00071     {
00072         Fractional=0 ,
00073         Fractional_rc,
00074         Full 
00075     };
00076 
00078     enum Normalization
00079     {
00080         Unweighted = 0,
00081         WeightRHS,
00082         WeightLHS,
00083         WeightBoth
00084     };
00085 
00086     enum LHSnorm
00087     {
00088         L1 = 0,
00089         L2,
00090         SupportSize,
00091         Infinity,
00092         Average,
00093         Uniform
00094     };
00096     enum RhsWeightType
00097     {
00098         Fixed = 0 ,
00099         Dynamic 
00100     };
00103     class Parameters : public CglParam
00104     {
00105     public:
00107         Parameters();
00109         Parameters(const Parameters &other);
00111         Parameters & operator=(const Parameters &other);
00114 
00117         int pivotLimit;
00120         int pivotLimitInTree;
00122         int maxCutPerRound;
00124         int failedPivotLimit;
00127         int degeneratePivotLimit;
00129         int extraCutsLimit;
00133 
00134         double pivotTol;
00136         double away;
00138         mutable double timeLimit;
00140         double singleCutTimeLimit;
00142         double rhsWeight;
00144 
00147 
00148         bool useTableauRow;
00150         bool modularize;
00152         bool strengthen;
00154         bool countMistakenRc;
00156         SeparationSpaces sepSpace;
00158         bool perturb;
00160         Normalization normalization;
00162         RhsWeightType rhsWeightType;
00164         LHSnorm lhs_norm;
00166         ExtraCutsMode generateExtraCuts;
00168         SelectionRules pivotSelection;
00170     };
00171 
00172 
00174     CglLandP(const CglLandP::Parameters &params = CglLandP::Parameters(),
00175              const LAP::Validator &validator = LAP::Validator());
00177     ~CglLandP();
00179     CglLandP(const CglLandP &source);
00181     CglLandP& operator=(const CglLandP &rhs);
00183     CglCutGenerator * clone() const;
00184 
00187 
00188     virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
00189                               const CglTreeInfo info = CglTreeInfo()) const;
00190 
00192 
00193     virtual bool needsOptimalBasis() const
00194     {
00195         return true;
00196     }
00197 
00198     LAP::Validator & validator()
00199     {
00200         return validator_;
00201     }
00209     void setLogLevel(int level)
00210     {
00211         handler_->setLogLevel(level);
00212     }
00213 
00214     class NoBasisError : public CoinError
00215     {
00216     public:
00217         NoBasisError(): CoinError("No basis available","LandP","") {}
00218     };
00219 
00220     class SimplexInterfaceError : public CoinError
00221     {
00222     public:
00223         SimplexInterfaceError(): CoinError("Invalid conversion to simplex interface", "CglLandP","CglLandP") {}
00224     };
00225     Parameters & parameter()
00226     {
00227         return params_;
00228     }
00229 private:
00230 
00231 
00232     void scanExtraCuts(OsiCuts& cs, const double * colsol) const;
00233 
00234     Parameters params_;
00235 
00237     struct CachedData
00238     {
00239         CachedData(int nBasics = 0 , int nNonBasics = 0);
00240         CachedData(const CachedData & source);
00241 
00242         CachedData& operator=(const CachedData &source);
00244         void getData(const OsiSolverInterface &si);
00245 
00246         void clean();
00247 
00248         ~CachedData();
00250         int * basics_;
00252         int *nonBasics_;
00254         int nBasics_;
00256         int nNonBasics_;
00258         CoinWarmStartBasis * basis_;
00260         double * colsol_;
00262         double * slacks_;
00264         bool * integers_;
00265     };
00268     int getSortedFractionals(CoinPackedVector &xFrac,
00269                              const CachedData & data,
00270                              const CglLandP::Parameters& params) const;
00273     void getSortedFractionalIndices(std::vector<int>& indices,
00274                                     const CachedData &data,
00275                                     const CglLandP::Parameters & params) const;
00277     mutable CachedData cached_;
00279     CoinMessageHandler * handler_;
00281     CoinMessages messages_;
00283     LAP::Validator validator_;
00285     mutable int numrows_;
00287     mutable int numcols_;
00289     mutable double * originalColLower_;
00291     mutable double * originalColUpper_;
00293     mutable bool canLift_;
00295     mutable OsiCuts extraCuts_;
00296 };
00297 void CglLandPUnitTest(OsiSolverInterface *si, const std::string & mpsDir);
00298 
00299 #endif
00300 

Generated on Fri Jan 7 03:09:09 2011 by  doxygen 1.4.7