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

- File List
- File Members

# /home/coin/svn-release/Blis-0.93.2/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 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00004
    00005 #ifndef CglPreProcess_H
    00006 #define CglPreProcess_H
    00007
    00008 #include <string>
    00009 #include <vector>
    00010
    00011 #include "CoinMessageHandler.hpp"
    00012 #include "OsiSolverInterface.hpp"
    00013 #include "CglStored.hpp"
    00014 #include "OsiPresolve.hpp"
    00015 #include "CglCutGenerator.hpp"
    00016
    00017 //#############################################################################
    00018
    00036 class CglPreProcess  {
    00037
    00038 public:
    00039
    00041
    00042
    00051   OsiSolverInterface * preProcess(OsiSolverInterface & model,
    00052                                   bool makeEquality=false, int numberPasses=5);
    00064   OsiSolverInterface * preProcessNonDefault(OsiSolverInterface & model,
    00065                                   int makeEquality=0, int numberPasses=5,
    00066                                             int tuning=0);
    00068   void postProcess(OsiSolverInterface &model);
    00076   int tightenPrimalBounds(OsiSolverInterface & model,double factor=0.0);
    00083   OsiSolverInterface * someFixed(OsiSolverInterface & model,
    00084                                  double fractionToKeep=0.25,
    00085                                  bool fixContinuousAsWell=false,
    00086                                  char * keep=NULL) const;
    00091   OsiSolverInterface * cliqueIt(OsiSolverInterface & model,
    00092                                 double cliquesNeeded=0.0) const;
    00094   int reducedCostFix(OsiSolverInterface & model);
    00096
    00097   //---------------------------------------------------------------------------
    00098
    00113   void setCutoff(double value) ;
    00114
    00116   double getCutoff() const;
    00118   inline OsiSolverInterface * originalModel() const
    00119   { return originalModel_;}
    00121   inline OsiSolverInterface * startModel() const
    00122   { return startModel_;}
    00124   inline OsiSolverInterface * modelAtPass(int iPass) const
    00125   { if (iPass>=0&&iPass<numberSolvers_) return model_[iPass]; else return NULL;}
    00127   inline OsiSolverInterface * modifiedModel(int iPass) const
    00128   { if (iPass>=0&&iPass<numberSolvers_) return modifiedModel_[iPass]; else return NULL;}
    00130   inline OsiPresolve * presolve(int iPass) const
    00131   { if (iPass>=0&&iPass<numberSolvers_) return presolve_[iPass]; else return NULL;}
    00134   const int * originalColumns() const;
    00137   const int * originalRows() const;
    00139   inline int numberSOS() const
    00140   { return numberSOS_;}
    00142   inline const int * typeSOS() const
    00143   { return typeSOS_;}
    00145   inline const int * startSOS() const
    00146   { return startSOS_;}
    00148   inline const int * whichSOS() const
    00149   { return whichSOS_;}
    00151   inline const double * weightSOS() const
    00152   { return weightSOS_;}
    00154   void passInProhibited(const char * prohibited,int numberColumns);
    00156   inline const char * prohibited()
    00157   { return prohibited_;}
    00159   inline int numberIterationsPre() const
    00160   { return numberIterationsPre_;}
    00162   inline int numberIterationsPost() const
    00163   { return numberIterationsPost_;}
    00170   void passInRowTypes(const char * rowTypes,int numberRows);
    00177   inline const char * rowTypes()
    00178   { return rowType_;}
    00180   inline const CglStored & cuts() const
    00181   { return cuts_;}
    00183   inline const CglStored * cutsPointer() const
    00184   { return &cuts_;}
    00186   void update(const OsiPresolve * pinfo,const OsiSolverInterface * solver);
    00188   inline void setOptions(int value)
    00189   { options_=value;}
    00191
    00193
    00194
    00195   inline int numberCutGenerators() const
    00196   { return numberCutGenerators_;}
    00198   inline CglCutGenerator ** cutGenerators() const
    00199   { return generator_;}
    00201   inline CglCutGenerator * cutGenerator(int i) const
    00202   { return generator_[i];}
    00205   void addCutGenerator(CglCutGenerator * generator);
    00207
    00217     void setApplicationData (void * appData);
    00218
    00220     void * getApplicationData() const;
    00222
    00223   //---------------------------------------------------------------------------
    00224
    00227
    00228   void passInMessageHandler(CoinMessageHandler * handler);
    00230   void newLanguage(CoinMessages::Language language);
    00231   inline void setLanguage(CoinMessages::Language language)
    00232   {newLanguage(language);}
    00234   inline CoinMessageHandler * messageHandler() const
    00235   {return handler_;}
    00237   inline CoinMessages messages()
    00238   {return messages_;}
    00240   inline CoinMessages * messagesPointer()
    00241   {return &messages_;}
    00243   //---------------------------------------------------------------------------
    00244
    00245
    00247
    00248
    00249   CglPreProcess();
    00250
    00252   CglPreProcess(const CglPreProcess & rhs);
    00253
    00255   CglPreProcess & operator=(const CglPreProcess& rhs);
    00256
    00258   ~CglPreProcess ();
    00259
    00261   void gutsOfDestructor();
    00263 private:
    00264
    00266
    00267
    00271   OsiSolverInterface * modified(OsiSolverInterface * model,
    00272                                 bool constraints,
    00273                                 int & numberChanges,
    00274                                 int iBigPass,
    00275                                 int numberPasses);
    00277   void createOriginalIndices() const;
    00279   void makeInteger();
    00281
    00282 //---------------------------------------------------------------------------
    00283
    00284 private:
    00286
    00287
    00289   OsiSolverInterface * originalModel_;
    00291   OsiSolverInterface * startModel_;
    00293   int numberSolvers_;
    00295   OsiSolverInterface ** model_;
    00297   OsiSolverInterface ** modifiedModel_;
    00299   OsiPresolve ** presolve_;
    00300
    00302   CoinMessageHandler * handler_;
    00303
    00309   bool defaultHandler_;
    00310
    00312   CoinMessages messages_;
    00313
    00315   void * appData_;
    00317   mutable int * originalColumn_;
    00319   mutable int * originalRow_;
    00321   int numberCutGenerators_;
    00323   CglCutGenerator ** generator_;
    00325   int numberSOS_;
    00327   int * typeSOS_;
    00329   int * startSOS_;
    00331   int * whichSOS_;
    00333   double * weightSOS_;
    00335   int numberProhibited_;
    00337   int numberIterationsPre_;
    00339   int numberIterationsPost_;
    00341   char * prohibited_;
    00343   int numberRowType_;
    00350   int options_;
    00357   char * rowType_;
    00359   CglStored cuts_;
    00361 };
    00363 class CglBK  {
    00364
    00365 public:
    00366
    00368
    00369
    00370   void bronKerbosch();
    00372   OsiSolverInterface * newSolver(const OsiSolverInterface & model);
    00374
    00375   //---------------------------------------------------------------------------
    00376
    00386
    00387
    00388   //---------------------------------------------------------------------------
    00389
    00390
    00392
    00393
    00394   CglBK();
    00395
    00397   CglBK(const OsiSolverInterface & model, const char * rowType,
    00398         int numberElements);
    00399
    00401   CglBK(const CglBK & rhs);
    00402
    00404   CglBK & operator=(const CglBK& rhs);
    00405
    00407   ~CglBK ();
    00408
    00410
    00411 //---------------------------------------------------------------------------
    00412
    00413 private:
    00415
    00416
    00417   int * candidates_;
    00419   char * mark_;
    00421   int * start_;
    00423   int * otherColumn_;
    00425   int * originalRow_;
    00427   int * dominated_;
    00429   CoinPackedMatrix * cliqueMatrix_;
    00431   const char * rowType_;
    00433   int numberColumns_;
    00435   int numberRows_;
    00437   int numberPossible_;
    00439   int numberCandidates_;
    00441   int firstNot_;
    00443   int numberIn_;
    00445   int left_;
    00446   int lastColumn_;
    00448 };
    00449
    00450 #endif