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,
00064 int tuning=0);
00066 void postProcess(OsiSolverInterface &model);
00074 int tightenPrimalBounds(OsiSolverInterface & model,double factor=0.0);
00081 OsiSolverInterface * someFixed(OsiSolverInterface & model,
00082 double fractionToKeep=0.25,
00083 bool fixContinuousAsWell=false,
00084 char * keep=NULL) const;
00086 int reducedCostFix(OsiSolverInterface & model);
00088
00089
00090
00105 void setCutoff(double value) ;
00106
00108 double getCutoff() const;
00110 inline OsiSolverInterface * originalModel() const
00111 { return originalModel_;}
00113 inline OsiSolverInterface * startModel() const
00114 { return startModel_;}
00116 inline OsiSolverInterface * modelAtPass(int iPass) const
00117 { if (iPass>=0&&iPass<numberSolvers_) return model_[iPass]; else return NULL;}
00119 inline OsiSolverInterface * modifiedModel(int iPass) const
00120 { if (iPass>=0&&iPass<numberSolvers_) return modifiedModel_[iPass]; else return NULL;}
00122 inline OsiPresolve * presolve(int iPass) const
00123 { if (iPass>=0&&iPass<numberSolvers_) return presolve_[iPass]; else return NULL;}
00126 const int * originalColumns() const;
00129 const int * originalRows() const;
00131 inline int numberSOS() const
00132 { return numberSOS_;}
00134 inline const int * typeSOS() const
00135 { return typeSOS_;}
00137 inline const int * startSOS() const
00138 { return startSOS_;}
00140 inline const int * whichSOS() const
00141 { return whichSOS_;}
00143 inline const double * weightSOS() const
00144 { return weightSOS_;}
00146 void passInProhibited(const char * prohibited,int numberColumns);
00148 inline const char * prohibited()
00149 { return prohibited_;}
00151
00153
00154
00155 inline int numberCutGenerators() const
00156 { return numberCutGenerators_;}
00158 inline CglCutGenerator ** cutGenerators() const
00159 { return generator_;}
00161 inline CglCutGenerator * cutGenerator(int i) const
00162 { return generator_[i];}
00165 void addCutGenerator(CglCutGenerator * generator);
00167
00177 void setApplicationData (void * appData);
00178
00180 void * getApplicationData() const;
00182
00183
00184
00187
00188 void passInMessageHandler(CoinMessageHandler * handler);
00190 void newLanguage(CoinMessages::Language language);
00191 inline void setLanguage(CoinMessages::Language language)
00192 {newLanguage(language);}
00194 inline CoinMessageHandler * messageHandler() const
00195 {return handler_;}
00197 inline CoinMessages messages()
00198 {return messages_;}
00200 inline CoinMessages * messagesPointer()
00201 {return &messages_;}
00203
00204
00205
00207
00208
00209 CglPreProcess();
00210
00212 CglPreProcess(const CglPreProcess & rhs);
00213
00215 CglPreProcess & operator=(const CglPreProcess& rhs);
00216
00218 ~CglPreProcess ();
00219
00221 void gutsOfDestructor();
00223 private:
00224
00226
00227
00231 OsiSolverInterface * modified(OsiSolverInterface * model,
00232 bool constraints,
00233 int & numberChanges,
00234 int iBigPass,
00235 int numberPasses);
00237 void createOriginalIndices() const;
00239 void makeInteger();
00241
00242
00243
00244 private:
00246
00247
00249 OsiSolverInterface * originalModel_;
00251 OsiSolverInterface * startModel_;
00253 int numberSolvers_;
00255 OsiSolverInterface ** model_;
00257 OsiSolverInterface ** modifiedModel_;
00259 OsiPresolve ** presolve_;
00260
00262 CoinMessageHandler * handler_;
00263
00269 bool defaultHandler_;
00270
00272 CoinMessages messages_;
00273
00275 void * appData_;
00277 mutable int * originalColumn_;
00279 mutable int * originalRow_;
00281 int numberCutGenerators_;
00283 CglCutGenerator ** generator_;
00285 int numberSOS_;
00287 int * typeSOS_;
00289 int * startSOS_;
00291 int * whichSOS_;
00293 double * weightSOS_;
00295 int numberProhibited_;
00297 char * prohibited_;
00299 };
00300
00301 #endif