• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/build/buildd/coinor-cbc-2.5.0/debian/tmp/usr/include/coin/CbcCompareDefault.hpp

Go to the documentation of this file.
00001 //Edwin 11/25/09 carved out of CbcCompareActual
00002 #ifndef CbcCompareDefault_H
00003 #define CbcCompareDefault_H
00004 
00005 
00006 //#############################################################################
00007 /*  These are alternative strategies for node traversal.
00008     They can take data etc for fine tuning
00009 
00010     At present the node list is stored as a heap and the "test"
00011     comparison function returns true if node y is better than node x.
00012 
00013 */
00014 #include "CbcNode.hpp"
00015 #include "CbcCompareBase.hpp"
00016 #include "CbcCompare.hpp"
00017 
00018 class CbcModel;
00019 
00020 /* This is an example of a more complex rule with data
00021    It is default after first solution
00022    If weight is 0.0 then it is computed to hit first solution
00023    less 5%
00024 */
00025 class CbcCompareDefault  : public CbcCompareBase {
00026 public:
00028     CbcCompareDefault () ;
00030     CbcCompareDefault (double weight);
00031 
00033     CbcCompareDefault ( const CbcCompareDefault &rhs);
00034 
00036     CbcCompareDefault & operator=( const CbcCompareDefault& rhs);
00037 
00039     virtual CbcCompareBase * clone() const;
00041     virtual void generateCpp( FILE * fp);
00042 
00043     ~CbcCompareDefault() ;
00044     /* This returns true if weighted value of node y is less than
00045        weighted value of node x */
00046     virtual bool test (CbcNode * x, CbcNode * y) ;
00047 
00048     using CbcCompareBase::newSolution ;
00051     virtual void newSolution(CbcModel * model,
00052                              double objectiveAtContinuous,
00053                              int numberInfeasibilitiesAtContinuous) ;
00056     virtual bool every1000Nodes(CbcModel * model, int numberNodes);
00057 
00058     /* if weight == -1.0 then fewest infeasibilities (before solution)
00059        if -2.0 then do breadth first just for first 1000 nodes
00060        if -3.0 then depth first before solution
00061     */
00062     inline double getWeight() const {
00063         return weight_;
00064     }
00065     inline void setWeight(double weight) {
00066         weight_ = weight;
00067     }
00069     inline double getCutoff() const {
00070         return cutoff_;
00071     }
00072     inline void setCutoff(double cutoff) {
00073         cutoff_ = cutoff;
00074     }
00076     inline double getBestPossible() const {
00077         return bestPossible_;
00078     }
00079     inline void setBestPossible(double bestPossible) {
00080         bestPossible_ = bestPossible;
00081     }
00083     inline void setBreadthDepth(int value) {
00084         breadthDepth_ = value;
00085     }
00087     void startDive(CbcModel * model);
00089     void cleanDive();
00090 protected:
00092     double weight_;
00094     double saveWeight_;
00096     double cutoff_;
00098     double bestPossible_;
00100     int numberSolutions_;
00102     int treeSize_;
00104     int breadthDepth_;
00106     int startNodeNumber_;
00108     int afterNodeNumber_;
00109 };
00110 
00111 #endif //CbcCompareDefault_H
00112 

Generated on Sat Oct 23 2010 23:46:55 by  doxygen 1.7.1