/home/coin/SVN-release/CoinAll-1.1.0/Cbc/examples/CbcCompareUser.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2002, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 #ifndef CbcCompareUser_H
00004 #define CbcCompareUser_H
00005 
00006 #include "CbcNode.hpp"
00007 #include "CbcCompareBase.hpp"
00008 class CbcModel;
00009 /* This is an example of a more complex rule with data
00010    It is default after first solution
00011    If weight is 0.0 then it is computed to hit first solution
00012    less 2%
00013 */
00014 class CbcCompareUser  : public CbcCompareBase {
00015 public:
00016   // Default Constructor 
00017   CbcCompareUser () ;
00018   // Constructor with weight
00019   CbcCompareUser (double weight);
00020 
00021   // Copy constructor 
00022   CbcCompareUser ( const CbcCompareUser &rhs);
00023    
00024   // Assignment operator 
00025   CbcCompareUser & operator=( const CbcCompareUser& rhs);
00026 
00028   virtual CbcCompareBase * clone() const;
00029 
00030   ~CbcCompareUser() ;
00031   /* This returns true if weighted value of node y is less than
00032      weighted value of node x */
00033   virtual bool test (CbcNode * x, CbcNode * y) ;
00035   virtual bool alternateTest (CbcNode * x, CbcNode * y);
00036   // This allows method to change behavior as it is called
00037   // after each solution
00038   virtual void newSolution(CbcModel * model,
00039                            double objectiveAtContinuous,
00040                            int numberInfeasibilitiesAtContinuous) ;
00042   virtual bool fullScan() const;
00043   // This allows method to change behavior 
00044   // Return true if want tree re-sorted
00045   virtual bool every1000Nodes(CbcModel * model,int numberNodes);
00046 
00047   /* if weight == -1.0 then depth first (before solution)
00048      if -2.0 then do breadth first just for first 1000 nodes
00049   */
00050   inline double getWeight() const
00051   { return weight_;}
00052   inline void setWeight(double weight)
00053   { weight_ = weight;}
00054 protected:
00055   // Weight for each infeasibility
00056   double weight_;
00057   // Weight for each infeasibility - computed from solution
00058   double saveWeight_;
00059   // Number of solutions
00060   int numberSolutions_;
00061   // count
00062   mutable int count_;
00063   // Tree size (at last check)
00064   int treeSize_;
00065 };
00066 #endif

Generated on Sun Nov 14 14:06:30 2010 for Coin-All by  doxygen 1.4.7