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 void passInProhibited(const char * prohibited,int numberColumns);
00145 inline const char * prohibited()
00146 { return prohibited_;};
00148
00150
00151
00152 inline int numberCutGenerators() const
00153 { return numberCutGenerators_;};
00155 inline CglCutGenerator ** cutGenerators() const
00156 { return generator_;};
00158 inline CglCutGenerator * cutGenerator(int i) const
00159 { return generator_[i];};
00162 void addCutGenerator(CglCutGenerator * generator);
00164
00174 void setApplicationData (void * appData);
00175
00177 void * getApplicationData() const;
00179
00180
00181
00184
00185 void passInMessageHandler(CoinMessageHandler * handler);
00187 void newLanguage(CoinMessages::Language language);
00188 inline void setLanguage(CoinMessages::Language language)
00189 {newLanguage(language);};
00191 inline CoinMessageHandler * messageHandler() const
00192 {return handler_;};
00194 inline CoinMessages messages()
00195 {return messages_;};
00197 inline CoinMessages * messagesPointer()
00198 {return &messages_;};
00200
00201
00202
00204
00205
00206 CglPreProcess();
00207
00209 CglPreProcess(const CglPreProcess & rhs);
00210
00212 CglPreProcess & operator=(const CglPreProcess& rhs);
00213
00215 ~CglPreProcess ();
00216
00218 void gutsOfDestructor();
00220 private:
00221
00223
00224
00228 OsiSolverInterface * modified(OsiSolverInterface * model,
00229 bool constraints,
00230 int & numberChanges,
00231 int iBigPass);
00233 void createOriginalIndices() const;
00235
00236
00237
00238 private:
00240
00241
00243 OsiSolverInterface * originalModel_;
00245 OsiSolverInterface * startModel_;
00247 int numberSolvers_;
00249 OsiSolverInterface ** model_;
00251 OsiSolverInterface ** modifiedModel_;
00253 OsiPresolve ** presolve_;
00254
00256 CoinMessageHandler * handler_;
00257
00263 bool defaultHandler_;
00264
00266 CoinMessages messages_;
00267
00269 void * appData_;
00271 mutable int * originalColumn_;
00273 mutable int * originalRow_;
00275 int numberCutGenerators_;
00277 CglCutGenerator ** generator_;
00279 int numberSOS_;
00281 int * typeSOS_;
00283 int * startSOS_;
00285 int * whichSOS_;
00287 double * weightSOS_;
00289 int numberProhibited_;
00291 char * prohibited_;
00293 };
00294
00295 #endif