- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# /home/coin/svn-release/Alps-1.4.6/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 // $Id$
    00008 //
    00009 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00010 //---------------------------------------------------------------------------
    00011 #ifndef CglLandP_H
    00012 #define CglLandP_H
    00013
    00014 #include "CglLandPValidator.hpp"
    00015 #include "CglCutGenerator.hpp"
    00016 #include "CglParam.hpp"
    00017
    00018 #include <iostream>
    00019 class CoinWarmStartBasis;
    00024 namespace LAP
    00025 {
    00026 enum LapMessagesTypes
    00027 {
    00028     BEGIN_ROUND,
    00029     END_ROUND,
    00030     DURING_SEP,
    00031     CUT_REJECTED,
    00032     CUT_FAILED,
    00033     CUT_GAP,
    00034     LAP_CUT_FAILED_DO_MIG,
    00035     LAP_MESSAGES_DUMMY_END
    00036 };
    00038 class LapMessages : public CoinMessages
    00039 {
    00040 public:
    00042     LapMessages( );
    00044     virtual ~LapMessages() {}
    00045 };
    00046 class CglLandPSimplex;
    00047 }
    00048
    00049 class CglLandP : public CglCutGenerator
    00050 {
    00051     friend void CglLandPUnitTest(OsiSolverInterface *si, const std::string & mpsDir);
    00052
    00053     friend class LAP::CglLandPSimplex;
    00054     friend class CftCglp;
    00055
    00056 public:
    00057
    00058     enum SelectionRules
    00059     {
    00060         mostNegativeRc ,
    00061         bestPivot ,
    00062         initialReducedCosts
    00063     };
    00064
    00065     enum ExtraCutsMode
    00066     {
    00067         none,
    00068         AtOptimalBasis ,
    00069         WhenEnteringBasis ,
    00070         AllViolatedMigs
    00071     };
    00072
    00074     enum SeparationSpaces
    00075     {
    00076         Fractional=0 ,
    00077         Fractional_rc,
    00078         Full
    00079     };
    00080
    00082     enum Normalization
    00083     {
    00084         Unweighted = 0,
    00085         WeightRHS,
    00086         WeightLHS,
    00087         WeightBoth
    00088     };
    00089
    00090     enum LHSnorm
    00091     {
    00092         L1 = 0,
    00093         L2,
    00094         SupportSize,
    00095         Infinity,
    00096         Average,
    00097         Uniform
    00098     };
    00100     enum RhsWeightType
    00101     {
    00102         Fixed = 0 ,
    00103         Dynamic
    00104     };
    00107     class Parameters : public CglParam
    00108     {
    00109     public:
    00111         Parameters();
    00113         Parameters(const Parameters &other);
    00115         Parameters & operator=(const Parameters &other);
    00118
    00121         int pivotLimit;
    00124         int pivotLimitInTree;
    00126         int maxCutPerRound;
    00128         int failedPivotLimit;
    00131         int degeneratePivotLimit;
    00133         int extraCutsLimit;
    00137
    00138         double pivotTol;
    00140         double away;
    00142         mutable double timeLimit;
    00144         double singleCutTimeLimit;
    00146         double rhsWeight;
    00148
    00151
    00152         bool useTableauRow;
    00154         bool modularize;
    00156         bool strengthen;
    00158         bool countMistakenRc;
    00160         SeparationSpaces sepSpace;
    00162         bool perturb;
    00164         Normalization normalization;
    00166         RhsWeightType rhsWeightType;
    00168         LHSnorm lhs_norm;
    00170         ExtraCutsMode generateExtraCuts;
    00172         SelectionRules pivotSelection;
    00174     };
    00175
    00176
    00178     CglLandP(const CglLandP::Parameters &params = CglLandP::Parameters(),
    00179              const LAP::Validator &validator = LAP::Validator());
    00181     ~CglLandP();
    00183     CglLandP(const CglLandP &source);
    00185     CglLandP& operator=(const CglLandP &rhs);
    00187     CglCutGenerator * clone() const;
    00188
    00191
    00192     virtual void generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
    00193                               const CglTreeInfo info = CglTreeInfo()) const;
    00194
    00196
    00197     virtual bool needsOptimalBasis() const
    00198     {
    00199         return true;
    00200     }
    00201
    00202     LAP::Validator & validator()
    00203     {
    00204         return validator_;
    00205     }
    00213     void setLogLevel(int level)
    00214     {
    00215         handler_->setLogLevel(level);
    00216     }
    00217
    00218     class NoBasisError : public CoinError
    00219     {
    00220     public:
    00221         NoBasisError(): CoinError("No basis available","LandP","") {}
    00222     };
    00223
    00224     class SimplexInterfaceError : public CoinError
    00225     {
    00226     public:
    00227         SimplexInterfaceError(): CoinError("Invalid conversion to simplex interface", "CglLandP","CglLandP") {}
    00228     };
    00229     Parameters & parameter()
    00230     {
    00231         return params_;
    00232     }
    00233 private:
    00234
    00235
    00236     void scanExtraCuts(OsiCuts& cs, const double * colsol) const;
    00237
    00238     Parameters params_;
    00239
    00241     struct CachedData
    00242     {
    00243         CachedData(int nBasics = 0 , int nNonBasics = 0);
    00244         CachedData(const CachedData & source);
    00245
    00246         CachedData& operator=(const CachedData &source);
    00248         void getData(const OsiSolverInterface &si);
    00249
    00250         void clean();
    00251
    00252         ~CachedData();
    00254         int * basics_;
    00256         int *nonBasics_;
    00258         int nBasics_;
    00260         int nNonBasics_;
    00262         CoinWarmStartBasis * basis_;
    00264         double * colsol_;
    00266         double * slacks_;
    00268         bool * integers_;
    00269     };
    00272     int getSortedFractionals(CoinPackedVector &xFrac,
    00273                              const CachedData & data,
    00274                              const CglLandP::Parameters& params) const;
    00277     void getSortedFractionalIndices(std::vector<int>& indices,
    00278                                     const CachedData &data,
    00279                                     const CglLandP::Parameters & params) const;
    00281     mutable CachedData cached_;
    00283     CoinMessageHandler * handler_;
    00285     CoinMessages messages_;
    00287     LAP::Validator validator_;
    00289     mutable int numrows_;
    00291     mutable int numcols_;
    00293     mutable double * originalColLower_;
    00295     mutable double * originalColUpper_;
    00297     mutable bool canLift_;
    00299     mutable OsiCuts extraCuts_;
    00300 };
    00301 void CglLandPUnitTest(OsiSolverInterface *si, const std::string & mpsDir);
    00302
    00303 #endif
    00304