coin-Cgl
CglPreProcess.hpp
Go to the documentation of this file.
1 // Copyright (C) 2005, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 #ifndef CglPreProcess_H
4 #define CglPreProcess_H
5 
6 #include <string>
7 #include <vector>
8 
9 #include "CoinFinite.hpp"
10 #include "CoinMessageHandler.hpp"
11 #include "OsiSolverInterface.hpp"
12 #include "CglStored.hpp"
13 #include "OsiPresolve.hpp"
14 #include "CglCutGenerator.hpp"
15 
16 //#############################################################################
17 
36 
37 public:
38 
40 
41 
50  OsiSolverInterface * preProcess(OsiSolverInterface & model,
51  bool makeEquality=false, int numberPasses=5);
63  OsiSolverInterface * preProcessNonDefault(OsiSolverInterface & model,
64  int makeEquality=0, int numberPasses=5,
65  int tuning=0);
67  void postProcess(OsiSolverInterface &model);
75  int tightenPrimalBounds(OsiSolverInterface & model,double factor=0.0);
82  OsiSolverInterface * someFixed(OsiSolverInterface & model,
83  double fractionToKeep=0.25,
84  bool fixContinuousAsWell=false,
85  char * keep=NULL) const;
87  int reducedCostFix(OsiSolverInterface & model);
89 
90  //---------------------------------------------------------------------------
91 
106  void setCutoff(double value) ;
107 
109  double getCutoff() const;
111  inline OsiSolverInterface * originalModel() const
112  { return originalModel_;}
114  inline OsiSolverInterface * startModel() const
115  { return startModel_;}
117  inline OsiSolverInterface * modelAtPass(int iPass) const
118  { if (iPass>=0&&iPass<numberSolvers_) return model_[iPass]; else return NULL;}
120  inline OsiSolverInterface * modifiedModel(int iPass) const
121  { if (iPass>=0&&iPass<numberSolvers_) return modifiedModel_[iPass]; else return NULL;}
123  inline OsiPresolve * presolve(int iPass) const
124  { if (iPass>=0&&iPass<numberSolvers_) return presolve_[iPass]; else return NULL;}
127  const int * originalColumns() const;
130  const int * originalRows() const;
132  inline int numberSOS() const
133  { return numberSOS_;}
135  inline const int * typeSOS() const
136  { return typeSOS_;}
138  inline const int * startSOS() const
139  { return startSOS_;}
141  inline const int * whichSOS() const
142  { return whichSOS_;}
144  inline const double * weightSOS() const
145  { return weightSOS_;}
147  void passInProhibited(const char * prohibited,int numberColumns);
149  inline const char * prohibited()
150  { return prohibited_;}
152  inline int numberIterationsPre() const
153  { return numberIterationsPre_;}
155  inline int numberIterationsPost() const
156  { return numberIterationsPost_;}
163  void passInRowTypes(const char * rowTypes,int numberRows);
170  inline const char * rowTypes()
171  { return rowType_;}
173  inline const CglStored & cuts() const
174  { return cuts_;}
176  inline const CglStored * cutsPointer() const
177  { return &cuts_;}
179  void update(const OsiPresolve * pinfo,const OsiSolverInterface * solver);
181  inline void setOptions(int value)
182  { options_=value;}
184 
186 
187  inline int numberCutGenerators() const
189  { return numberCutGenerators_;}
191  inline CglCutGenerator ** cutGenerators() const
192  { return generator_;}
194  inline CglCutGenerator * cutGenerator(int i) const
195  { return generator_[i];}
198  void addCutGenerator(CglCutGenerator * generator);
200 
210  void setApplicationData (void * appData);
211 
213  void * getApplicationData() const;
215 
216  //---------------------------------------------------------------------------
217 
220  void passInMessageHandler(CoinMessageHandler * handler);
223  void newLanguage(CoinMessages::Language language);
224  inline void setLanguage(CoinMessages::Language language)
225  {newLanguage(language);}
227  inline CoinMessageHandler * messageHandler() const
228  {return handler_;}
230  inline CoinMessages messages()
231  {return messages_;}
233  inline CoinMessages * messagesPointer()
234  {return &messages_;}
236  //---------------------------------------------------------------------------
237 
238 
240 
241  CglPreProcess();
243 
245  CglPreProcess(const CglPreProcess & rhs);
246 
248  CglPreProcess & operator=(const CglPreProcess& rhs);
249 
251  ~CglPreProcess ();
252 
254  void gutsOfDestructor();
256 private:
257 
259 
260 
264  OsiSolverInterface * modified(OsiSolverInterface * model,
265  bool constraints,
266  int & numberChanges,
267  int iBigPass,
268  int numberPasses);
270  void createOriginalIndices() const;
272  void makeInteger();
274 
275 //---------------------------------------------------------------------------
276 
277 private:
279 
280 
282  OsiSolverInterface * originalModel_;
284  OsiSolverInterface * startModel_;
288  OsiSolverInterface ** model_;
290  OsiSolverInterface ** modifiedModel_;
292  OsiPresolve ** presolve_;
293 
295  CoinMessageHandler * handler_;
296 
303 
305  CoinMessages messages_;
306 
308  void * appData_;
310  mutable int * originalColumn_;
312  mutable int * originalRow_;
320  int * typeSOS_;
322  int * startSOS_;
324  int * whichSOS_;
326  double * weightSOS_;
334  char * prohibited_;
340  int options_;
347  char * rowType_;
351 };
352 
353 #endif