/home/coin/SVN-release/Bcp-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;
00087   int reducedCostFix(OsiSolverInterface & model);
00089 
00090   //---------------------------------------------------------------------------
00091 
00106   void setCutoff(double value) ;
00107 
00109   double getCutoff() const;
00111   inline OsiSolverInterface * originalModel() const
00112   { return originalModel_;}
00114   inline OsiSolverInterface * startModel() const
00115   { return startModel_;}
00117   inline OsiSolverInterface * modelAtPass(int iPass) const
00118   { if (iPass>=0&&iPass<numberSolvers_) return model_[iPass]; else return NULL;}
00120   inline OsiSolverInterface * modifiedModel(int iPass) const
00121   { if (iPass>=0&&iPass<numberSolvers_) return modifiedModel_[iPass]; else return NULL;}
00123   inline OsiPresolve * presolve(int iPass) const
00124   { if (iPass>=0&&iPass<numberSolvers_) return presolve_[iPass]; else return NULL;}
00127   const int * originalColumns() const;
00130   const int * originalRows() const;
00132   inline int numberSOS() const
00133   { return numberSOS_;}
00135   inline const int * typeSOS() const
00136   { return typeSOS_;}
00138   inline const int * startSOS() const
00139   { return startSOS_;}
00141   inline const int * whichSOS() const
00142   { return whichSOS_;}
00144   inline const double * weightSOS() const
00145   { return weightSOS_;}
00147   void passInProhibited(const char * prohibited,int numberColumns);
00149   inline const char * prohibited()
00150   { return prohibited_;}
00152   inline int numberIterationsPre() const
00153   { return numberIterationsPre_;}
00155   inline int numberIterationsPost() const
00156   { return numberIterationsPost_;}
00163   void passInRowTypes(const char * rowTypes,int numberRows);
00170   inline const char * rowTypes()
00171   { return rowType_;}
00173   inline const CglStored & cuts() const
00174   { return cuts_;}
00176   inline const CglStored * cutsPointer() const
00177   { return &cuts_;}
00179   void update(const OsiPresolve * pinfo,const OsiSolverInterface * solver);
00181 
00183 
00184 
00185   inline int numberCutGenerators() const
00186   { return numberCutGenerators_;}
00188   inline CglCutGenerator ** cutGenerators() const
00189   { return generator_;}
00191   inline CglCutGenerator * cutGenerator(int i) const
00192   { return generator_[i];}
00195   void addCutGenerator(CglCutGenerator * generator);
00197     
00207     void setApplicationData (void * appData);
00208 
00210     void * getApplicationData() const;
00212   
00213   //---------------------------------------------------------------------------
00214 
00217 
00218   void passInMessageHandler(CoinMessageHandler * handler);
00220   void newLanguage(CoinMessages::Language language);
00221   inline void setLanguage(CoinMessages::Language language)
00222   {newLanguage(language);}
00224   inline CoinMessageHandler * messageHandler() const
00225   {return handler_;}
00227   inline CoinMessages messages() 
00228   {return messages_;}
00230   inline CoinMessages * messagesPointer() 
00231   {return &messages_;}
00233   //---------------------------------------------------------------------------
00234 
00235 
00237 
00238 
00239   CglPreProcess(); 
00240   
00242   CglPreProcess(const CglPreProcess & rhs);
00243   
00245   CglPreProcess & operator=(const CglPreProcess& rhs);
00246 
00248   ~CglPreProcess ();
00249   
00251   void gutsOfDestructor();
00253 private:
00254 
00256 
00257 
00261   OsiSolverInterface * modified(OsiSolverInterface * model,
00262                                 bool constraints,
00263                                 int & numberChanges,
00264                                 int iBigPass,
00265                                 int numberPasses);
00267   void createOriginalIndices() const;
00269   void makeInteger();
00271 
00272 //---------------------------------------------------------------------------
00273 
00274 private:
00276 
00277 
00279   OsiSolverInterface * originalModel_;
00281   OsiSolverInterface * startModel_;
00283   int numberSolvers_;
00285   OsiSolverInterface ** model_;
00287   OsiSolverInterface ** modifiedModel_;
00289   OsiPresolve ** presolve_;
00290 
00292   CoinMessageHandler * handler_;
00293 
00299   bool defaultHandler_;
00300 
00302   CoinMessages messages_;
00303 
00305   void * appData_;
00307   mutable int * originalColumn_;
00309   mutable int * originalRow_;
00311   int numberCutGenerators_;
00313   CglCutGenerator ** generator_;
00315   int numberSOS_;
00317   int * typeSOS_;
00319   int * startSOS_;
00321   int * whichSOS_;
00323   double * weightSOS_;
00325   int numberProhibited_;
00327   int numberIterationsPre_;
00329   int numberIterationsPost_;
00331   char * prohibited_;
00333   int numberRowType_;
00340   char * rowType_;
00342   CglStored cuts_;
00344 };
00345 
00346 #endif

Generated on Thu Jan 15 03:00:59 2009 for coin-Bcp by  doxygen 1.4.7