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

- File List
- File Members

# /home/coin/SVN-release/Alps-1.2.1/Cgl/src/CglPreProcess/CglPreProcess.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2005, International Business Machines
    00002 // Corporation and others.  All Rights Reserved.
    00003 #ifndef CglPreProcess_H
    00004 #define CglPreProcess_H
    00005
    00006 #include <string>
    00007 #include <vector>
    00008
    00009 #include "CoinFinite.hpp"
    00010 #include "CoinMessageHandler.hpp"
    00011 #include "OsiSolverInterface.hpp"
    00012 #include "CglStored.hpp"
    00013 #include "OsiPresolve.hpp"
    00014 #include "CglCutGenerator.hpp"
    00015
    00016 //#############################################################################
    00017
    00035 class CglPreProcess  {
    00036
    00037 public:
    00038
    00040
    00041
    00050   OsiSolverInterface * preProcess(OsiSolverInterface & model,
    00051                                   bool makeEquality=false, int numberPasses=5);
    00063   OsiSolverInterface * preProcessNonDefault(OsiSolverInterface & model,
    00064                                   int makeEquality=0, int numberPasses=5,
    00065                                             int tuning=0);
    00067   void postProcess(OsiSolverInterface &model);
    00075   int tightenPrimalBounds(OsiSolverInterface & model,double factor=0.0);
    00082   OsiSolverInterface * someFixed(OsiSolverInterface & model,
    00083                                  double fractionToKeep=0.25,
    00084                                  bool fixContinuousAsWell=false,
    00085                                  char * keep=NULL) const;
    00090   OsiSolverInterface * cliqueIt(OsiSolverInterface & model,
    00091                                 double cliquesNeeded=0.0) const;
    00093   int reducedCostFix(OsiSolverInterface & model);
    00095
    00096   //---------------------------------------------------------------------------
    00097
    00112   void setCutoff(double value) ;
    00113
    00115   double getCutoff() const;
    00117   inline OsiSolverInterface * originalModel() const
    00118   { return originalModel_;}
    00120   inline OsiSolverInterface * startModel() const
    00121   { return startModel_;}
    00123   inline OsiSolverInterface * modelAtPass(int iPass) const
    00124   { if (iPass>=0&&iPass<numberSolvers_) return model_[iPass]; else return NULL;}
    00126   inline OsiSolverInterface * modifiedModel(int iPass) const
    00127   { if (iPass>=0&&iPass<numberSolvers_) return modifiedModel_[iPass]; else return NULL;}
    00129   inline OsiPresolve * presolve(int iPass) const
    00130   { if (iPass>=0&&iPass<numberSolvers_) return presolve_[iPass]; else return NULL;}
    00133   const int * originalColumns() const;
    00136   const int * originalRows() const;
    00138   inline int numberSOS() const
    00139   { return numberSOS_;}
    00141   inline const int * typeSOS() const
    00142   { return typeSOS_;}
    00144   inline const int * startSOS() const
    00145   { return startSOS_;}
    00147   inline const int * whichSOS() const
    00148   { return whichSOS_;}
    00150   inline const double * weightSOS() const
    00151   { return weightSOS_;}
    00153   void passInProhibited(const char * prohibited,int numberColumns);
    00155   inline const char * prohibited()
    00156   { return prohibited_;}
    00158   inline int numberIterationsPre() const
    00159   { return numberIterationsPre_;}
    00161   inline int numberIterationsPost() const
    00162   { return numberIterationsPost_;}
    00169   void passInRowTypes(const char * rowTypes,int numberRows);
    00176   inline const char * rowTypes()
    00177   { return rowType_;}
    00179   inline const CglStored & cuts() const
    00180   { return cuts_;}
    00182   inline const CglStored * cutsPointer() const
    00183   { return &cuts_;}
    00185   void update(const OsiPresolve * pinfo,const OsiSolverInterface * solver);
    00187   inline void setOptions(int value)
    00188   { options_=value;}
    00190
    00192
    00193
    00194   inline int numberCutGenerators() const
    00195   { return numberCutGenerators_;}
    00197   inline CglCutGenerator ** cutGenerators() const
    00198   { return generator_;}
    00200   inline CglCutGenerator * cutGenerator(int i) const
    00201   { return generator_[i];}
    00204   void addCutGenerator(CglCutGenerator * generator);
    00206
    00216     void setApplicationData (void * appData);
    00217
    00219     void * getApplicationData() const;
    00221
    00222   //---------------------------------------------------------------------------
    00223
    00226
    00227   void passInMessageHandler(CoinMessageHandler * handler);
    00229   void newLanguage(CoinMessages::Language language);
    00230   inline void setLanguage(CoinMessages::Language language)
    00231   {newLanguage(language);}
    00233   inline CoinMessageHandler * messageHandler() const
    00234   {return handler_;}
    00236   inline CoinMessages messages()
    00237   {return messages_;}
    00239   inline CoinMessages * messagesPointer()
    00240   {return &messages_;}
    00242   //---------------------------------------------------------------------------
    00243
    00244
    00246
    00247
    00248   CglPreProcess();
    00249
    00251   CglPreProcess(const CglPreProcess & rhs);
    00252
    00254   CglPreProcess & operator=(const CglPreProcess& rhs);
    00255
    00257   ~CglPreProcess ();
    00258
    00260   void gutsOfDestructor();
    00262 private:
    00263
    00265
    00266
    00270   OsiSolverInterface * modified(OsiSolverInterface * model,
    00271                                 bool constraints,
    00272                                 int & numberChanges,
    00273                                 int iBigPass,
    00274                                 int numberPasses);
    00276   void createOriginalIndices() const;
    00278   void makeInteger();
    00280
    00281 //---------------------------------------------------------------------------
    00282
    00283 private:
    00285
    00286
    00288   OsiSolverInterface * originalModel_;
    00290   OsiSolverInterface * startModel_;
    00292   int numberSolvers_;
    00294   OsiSolverInterface ** model_;
    00296   OsiSolverInterface ** modifiedModel_;
    00298   OsiPresolve ** presolve_;
    00299
    00301   CoinMessageHandler * handler_;
    00302
    00308   bool defaultHandler_;
    00309
    00311   CoinMessages messages_;
    00312
    00314   void * appData_;
    00316   mutable int * originalColumn_;
    00318   mutable int * originalRow_;
    00320   int numberCutGenerators_;
    00322   CglCutGenerator ** generator_;
    00324   int numberSOS_;
    00326   int * typeSOS_;
    00328   int * startSOS_;
    00330   int * whichSOS_;
    00332   double * weightSOS_;
    00334   int numberProhibited_;
    00336   int numberIterationsPre_;
    00338   int numberIterationsPost_;
    00340   char * prohibited_;
    00342   int numberRowType_;
    00346   int options_;
    00353   char * rowType_;
    00355   CglStored cuts_;
    00357 };
    00359 class CglBK  {
    00360
    00361 public:
    00362
    00364
    00365
    00366   void bronKerbosch();
    00368   OsiSolverInterface * newSolver(const OsiSolverInterface & model);
    00370
    00371   //---------------------------------------------------------------------------
    00372
    00382
    00383
    00384   //---------------------------------------------------------------------------
    00385
    00386
    00388
    00389
    00390   CglBK();
    00391
    00393   CglBK(const OsiSolverInterface & model, const char * rowType,
    00394         int numberElements);
    00395
    00397   CglBK(const CglBK & rhs);
    00398
    00400   CglBK & operator=(const CglBK& rhs);
    00401
    00403   ~CglBK ();
    00404
    00406
    00407 //---------------------------------------------------------------------------
    00408
    00409 private:
    00411
    00412
    00413   int * candidates_;
    00415   char * mark_;
    00417   int * start_;
    00419   int * otherColumn_;
    00421   int * originalRow_;
    00423   int * dominated_;
    00425   CoinPackedMatrix * cliqueMatrix_;
    00427   const char * rowType_;
    00429   int numberColumns_;
    00431   int numberRows_;
    00433   int numberPossible_;
    00435   int numberCandidates_;
    00437   int firstNot_;
    00439   int numberIn_;
    00441   int left_;
    00442   int lastColumn_;
    00444 };
    00445
    00446 #endif