/home/coin/SVN-release/Cbc-2.4.1/Cbc/src/CbcHeuristicLocal.hpp

Go to the documentation of this file.
00001 /* $Id: CbcHeuristicLocal.hpp 1271 2009-11-05 15:57:25Z forrest $ */
00002 // Copyright (C) 2002, International Business Machines
00003 // Corporation and others.  All Rights Reserved.
00004 #ifndef CbcHeuristicLocal_H
00005 #define CbcHeuristicLocal_H
00006 
00007 #include "CbcHeuristic.hpp"
00011 class CbcHeuristicLocal : public CbcHeuristic {
00012 public:
00013 
00014   // Default Constructor 
00015   CbcHeuristicLocal ();
00016 
00017   /* Constructor with model - assumed before cuts
00018      Initial version does not do Lps
00019   */
00020   CbcHeuristicLocal (CbcModel & model);
00021   
00022   // Copy constructor 
00023   CbcHeuristicLocal ( const CbcHeuristicLocal &);
00024    
00025   // Destructor 
00026   ~CbcHeuristicLocal ();
00027   
00029   virtual CbcHeuristic * clone() const;
00030 
00032   CbcHeuristicLocal & operator=(const CbcHeuristicLocal& rhs);
00033 
00035   virtual void generateCpp( FILE * fp) ;
00036 
00038   virtual void resetModel(CbcModel * model);
00039 
00041   virtual void setModel(CbcModel * model);
00042   
00043   using CbcHeuristic::solution ;
00055   virtual int solution(double & objectiveValue,
00056                        double * newSolution);
00058   int solutionFix(double & objectiveValue,
00059                   double * newSolution,
00060                   const int * keep);
00061 
00063   inline void setSearchType(int value)
00064   { swap_=value;}
00066   inline int * used() const
00067   { return used_;}
00068 
00069 protected:
00070   // Data
00071 
00072   // Original matrix by column
00073   CoinPackedMatrix matrix_;
00074 
00075   // Number of solutions so we only do after new solution
00076   int numberSolutions_;
00077   // Type of search 0=normal, 1=BAB
00078   int swap_;
00080   int * used_;
00081 };
00082 
00083 
00090 class CbcHeuristicNaive : public CbcHeuristic {
00091 public:
00092 
00093   // Default Constructor 
00094   CbcHeuristicNaive ();
00095 
00096   /* Constructor with model - assumed before cuts
00097      Initial version does not do Lps
00098   */
00099   CbcHeuristicNaive (CbcModel & model);
00100   
00101   // Copy constructor 
00102   CbcHeuristicNaive ( const CbcHeuristicNaive &);
00103    
00104   // Destructor 
00105   ~CbcHeuristicNaive ();
00106   
00108   virtual CbcHeuristic * clone() const;
00109 
00111   CbcHeuristicNaive & operator=(const CbcHeuristicNaive& rhs);
00112 
00114   virtual void generateCpp( FILE * fp) ;
00115 
00117   virtual void resetModel(CbcModel * model);
00118 
00120   virtual void setModel(CbcModel * model);
00121   
00122   using CbcHeuristic::solution ;
00126   virtual int solution(double & objectiveValue,
00127                        double * newSolution);
00128 
00130   inline void setLargeValue(double value)
00131   { large_=value;}
00133   inline double largeValue() const
00134   { return large_;}
00135 
00136 protected:
00139   double large_;
00140 };
00141 
00145 class CbcHeuristicCrossover : public CbcHeuristic {
00146 public:
00147 
00148   // Default Constructor 
00149   CbcHeuristicCrossover ();
00150 
00151   /* Constructor with model - assumed before cuts
00152      Initial version does not do Lps
00153   */
00154   CbcHeuristicCrossover (CbcModel & model);
00155   
00156   // Copy constructor 
00157   CbcHeuristicCrossover ( const CbcHeuristicCrossover &);
00158    
00159   // Destructor 
00160   ~CbcHeuristicCrossover ();
00161   
00163   virtual CbcHeuristic * clone() const;
00164 
00166   CbcHeuristicCrossover & operator=(const CbcHeuristicCrossover& rhs);
00167 
00169   virtual void generateCpp( FILE * fp) ;
00170 
00172   virtual void resetModel(CbcModel * model);
00173 
00175   virtual void setModel(CbcModel * model);
00176   
00177   using CbcHeuristic::solution ;
00183   virtual int solution(double & objectiveValue,
00184                        double * newSolution);
00185 
00187   inline void setNumberSolutions(int value)
00188   { 
00189     if (value>0&&value<=10)
00190       useNumber_=value;
00191   }
00192 
00193 protected:
00194   // Data
00196   std::vector <double> attempts_;
00198   double random_[10];
00200   int numberSolutions_;
00202   int useNumber_;
00203 };
00204 
00205 #endif

Generated on Thu Apr 8 03:02:03 2010 by  doxygen 1.4.7