00001
00002
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 "OsiPresolve.hpp"
00013 #include "CglCutGenerator.hpp"
00014
00015
00016
00034 class CglPreProcess {
00035
00036 public:
00037
00039
00040
00049 OsiSolverInterface * preProcess(OsiSolverInterface & model,
00050 bool makeEquality=false, int numberPasses=5);
00062 OsiSolverInterface * preProcessNonDefault(OsiSolverInterface & model,
00063 int makeEquality=0, int numberPasses=5);
00065 void postProcess(OsiSolverInterface &model);
00073 int tightenPrimalBounds(OsiSolverInterface & model,double factor=0.0);
00080 OsiSolverInterface * someFixed(OsiSolverInterface & model,
00081 double fractionToKeep=0.25,
00082 bool fixContinuousAsWell=false,
00083 char * keep=NULL) const;
00085
00086
00087
00102 void setCutoff(double value) ;
00103
00105 double getCutoff() const;
00107 inline OsiSolverInterface * originalModel() const
00108 { return originalModel_;};
00110 inline OsiSolverInterface * startModel() const
00111 { return startModel_;};
00113 inline OsiSolverInterface * modelAtPass(int iPass) const
00114 { if (iPass>=0&&iPass<numberSolvers_) return model_[iPass];};
00116 inline OsiSolverInterface * modifiedModel(int iPass) const
00117 { if (iPass>=0&&iPass<numberSolvers_) return modifiedModel_[iPass];};
00119 inline OsiPresolve * presolve(int iPass) const
00120 { if (iPass>=0&&iPass<numberSolvers_) return presolve_[iPass];};
00123 const int * originalColumns() const;
00126 const int * originalRows() const;
00128 inline int numberSOS() const
00129 { return numberSOS_;};
00131 inline const int * typeSOS() const
00132 { return typeSOS_;};
00134 inline const int * startSOS() const
00135 { return startSOS_;};
00137 inline const int * whichSOS() const
00138 { return whichSOS_;};
00140 inline const double * weightSOS() const
00141 { return weightSOS_;};
00143
00145
00146
00147 inline int numberCutGenerators() const
00148 { return numberCutGenerators_;};
00150 inline CglCutGenerator ** cutGenerators() const
00151 { return generator_;};
00153 inline CglCutGenerator * cutGenerator(int i) const
00154 { return generator_[i];};
00157 void addCutGenerator(CglCutGenerator * generator);
00159
00169 void setApplicationData (void * appData);
00170
00172 void * getApplicationData() const;
00174
00175
00176
00179
00180 void passInMessageHandler(CoinMessageHandler * handler);
00182 void newLanguage(CoinMessages::Language language);
00183 inline void setLanguage(CoinMessages::Language language)
00184 {newLanguage(language);};
00186 inline CoinMessageHandler * messageHandler() const
00187 {return handler_;};
00189 inline CoinMessages messages()
00190 {return messages_;};
00192 inline CoinMessages * messagesPointer()
00193 {return &messages_;};
00195
00196
00197
00199
00200
00201 CglPreProcess();
00202
00204 CglPreProcess(const CglPreProcess & rhs);
00205
00207 CglPreProcess & operator=(const CglPreProcess& rhs);
00208
00210 ~CglPreProcess ();
00211
00213 void gutsOfDestructor();
00215 private:
00216
00218
00219
00223 OsiSolverInterface * modified(OsiSolverInterface * model,
00224 bool constraints,
00225 int & numberChanges,
00226 int iBigPass);
00228 void createOriginalIndices() const;
00230
00231
00232
00233 private:
00235
00236
00238 OsiSolverInterface * originalModel_;
00240 OsiSolverInterface * startModel_;
00242 int numberSolvers_;
00244 OsiSolverInterface ** model_;
00246 OsiSolverInterface ** modifiedModel_;
00248 OsiPresolve ** presolve_;
00249
00251 CoinMessageHandler * handler_;
00252
00258 bool defaultHandler_;
00259
00261 CoinMessages messages_;
00262
00264 void * appData_;
00266 mutable int * originalColumn_;
00268 mutable int * originalRow_;
00270 int numberCutGenerators_;
00272 CglCutGenerator ** generator_;
00274 int numberSOS_;
00276 int * typeSOS_;
00278 int * startSOS_;
00280 int * whichSOS_;
00282 double * weightSOS_;
00284 };
00285
00286 #endif