00001
00002
00003
00004 #ifndef CbcTreeLocal_H
00005 #define CbcTreeLocal_H
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "CbcTree.hpp"
00033 #include "CbcNode.hpp"
00034 #include "OsiRowCut.hpp"
00035 class CbcModel;
00036
00037
00038 class CbcTreeLocal : public CbcTree {
00039
00040 public:
00041
00042
00043 CbcTreeLocal ();
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 CbcTreeLocal (CbcModel * model,const double * solution ,int range=10,
00059 int typeCuts=0,int maxDiversification=0,
00060 int timeLimit=1000000, int nodeLimit=1000000,bool refine=true);
00061
00062 CbcTreeLocal ( const CbcTreeLocal & rhs);
00063
00064
00065 CbcTreeLocal & operator=(const CbcTreeLocal & rhs);
00066
00067 virtual ~CbcTreeLocal();
00068
00070 virtual CbcTree * clone() const;
00072 virtual void generateCpp( FILE * fp) ;
00073
00076
00078 virtual CbcNode * top() const;
00079
00081 virtual void push(CbcNode * x);
00082
00084 virtual void pop() ;
00085
00087
00089
00091 int createCut(const double * solution, OsiRowCut & cut);
00092
00094 virtual bool empty() ;
00095
00097 virtual void endSearch() ;
00099 void reverseCut(int state, double bias=0.0);
00101 void deleteCut(OsiRowCut & cut);
00103 void passInSolution(const double * solution, double solutionValue);
00104
00105 inline int range() const
00106 { return range_;}
00107
00108 inline void setRange(int value)
00109 { range_ = value;}
00110
00111 inline int typeCuts() const
00112 { return typeCuts_;}
00113
00114 inline void setTypeCuts(int value)
00115 { typeCuts_ = value;}
00116
00117 inline int maxDiversification() const
00118 { return maxDiversification_;}
00119
00120 inline void setMaxDiversification(int value)
00121 { maxDiversification_ = value;}
00122
00123 inline int timeLimit() const
00124 { return timeLimit_;}
00125
00126 inline void setTimeLimit(int value)
00127 { timeLimit_ = value;}
00128
00129 inline int nodeLimit() const
00130 { return nodeLimit_;}
00131
00132 inline void setNodeLimit(int value)
00133 { nodeLimit_ = value;}
00134
00135 inline bool refine() const
00136 { return refine_;}
00137
00138 inline void setRefine(bool yesNo)
00139 { refine_ = yesNo;}
00140
00142 private:
00143
00144 CbcNode * localNode_;
00145
00146 double * bestSolution_;
00147
00148 double * savedSolution_;
00149
00150 int saveNumberSolutions_;
00151
00152 OsiRowCut cut_;
00153
00154 OsiRowCut fixedCut_;
00155
00156 CbcModel * model_;
00157
00158 double * originalLower_;
00159
00160 double * originalUpper_;
00161
00162 int range_;
00163
00164 int typeCuts_;
00165
00166 int maxDiversification_;
00167
00168 int diversification_;
00169
00170 bool nextStrong_;
00171
00172 double rhs_;
00173
00174 double savedGap_;
00175
00176 double bestCutoff_;
00177
00178 int timeLimit_;
00179
00180 int startTime_;
00181
00182 int nodeLimit_;
00183
00184 int startNode_;
00185
00186 int searchType_;
00187
00188 bool refine_;
00189
00190 };
00191
00192 class CbcTreeVariable : public CbcTree {
00193
00194 public:
00195
00196
00197 CbcTreeVariable ();
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212 CbcTreeVariable (CbcModel * model,const double * solution ,int range=10,
00213 int typeCuts=0,int maxDiversification=0,
00214 int timeLimit=1000000, int nodeLimit=1000000,bool refine=true);
00215
00216 CbcTreeVariable ( const CbcTreeVariable & rhs);
00217
00218
00219 CbcTreeVariable & operator=(const CbcTreeVariable & rhs);
00220
00221 virtual ~CbcTreeVariable();
00222
00224 virtual CbcTree * clone() const;
00226 virtual void generateCpp( FILE * fp) ;
00227
00230
00232 virtual CbcNode * top() const;
00233
00235 virtual void push(CbcNode * x);
00236
00238 virtual void pop() ;
00239
00241
00243
00245 int createCut(const double * solution, OsiRowCut & cut);
00246
00248 virtual bool empty() ;
00249
00251 virtual void endSearch() ;
00253 void reverseCut(int state, double bias=0.0);
00255 void deleteCut(OsiRowCut & cut);
00257 void passInSolution(const double * solution, double solutionValue);
00258
00259 inline int range() const
00260 { return range_;}
00261
00262 inline void setRange(int value)
00263 { range_ = value;}
00264
00265 inline int typeCuts() const
00266 { return typeCuts_;}
00267
00268 inline void setTypeCuts(int value)
00269 { typeCuts_ = value;}
00270
00271 inline int maxDiversification() const
00272 { return maxDiversification_;}
00273
00274 inline void setMaxDiversification(int value)
00275 { maxDiversification_ = value;}
00276
00277 inline int timeLimit() const
00278 { return timeLimit_;}
00279
00280 inline void setTimeLimit(int value)
00281 { timeLimit_ = value;}
00282
00283 inline int nodeLimit() const
00284 { return nodeLimit_;}
00285
00286 inline void setNodeLimit(int value)
00287 { nodeLimit_ = value;}
00288
00289 inline bool refine() const
00290 { return refine_;}
00291
00292 inline void setRefine(bool yesNo)
00293 { refine_ = yesNo;}
00294
00296 private:
00297
00298 CbcNode * localNode_;
00299
00300 double * bestSolution_;
00301
00302 double * savedSolution_;
00303
00304 int saveNumberSolutions_;
00305
00306 OsiRowCut cut_;
00307
00308 OsiRowCut fixedCut_;
00309
00310 CbcModel * model_;
00311
00312 double * originalLower_;
00313
00314 double * originalUpper_;
00315
00316 int range_;
00317
00318 int typeCuts_;
00319
00320 int maxDiversification_;
00321
00322 int diversification_;
00323
00324 bool nextStrong_;
00325
00326 double rhs_;
00327
00328 double savedGap_;
00329
00330 double bestCutoff_;
00331
00332 int timeLimit_;
00333
00334 int startTime_;
00335
00336 int nodeLimit_;
00337
00338 int startNode_;
00339
00340 int searchType_;
00341
00342 bool refine_;
00343
00344 };
00345 #endif
00346