/build/buildd/coinor-cbc-2.5.0/debian/tmp/usr/include/coin/CbcHeuristicLocal.hpp
Go to the documentation of this file.
00001 /* $Id: CbcHeuristicLocal.hpp 1432 2010-02-07 19:33:53Z bjarni $ */
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;
00065     }
00067     inline int * used() const {
00068         return used_;
00069     }
00070 
00071 protected:
00072     // Data
00073 
00074     // Original matrix by column
00075     CoinPackedMatrix matrix_;
00076 
00077     // Number of solutions so we only do after new solution
00078     int numberSolutions_;
00079     // Type of search 0=normal, 1=BAB
00080     int swap_;
00082     int * used_;
00083 };
00084 
00085 
00092 class CbcHeuristicNaive : public CbcHeuristic {
00093 public:
00094 
00095     // Default Constructor
00096     CbcHeuristicNaive ();
00097 
00098     /* Constructor with model - assumed before cuts
00099        Initial version does not do Lps
00100     */
00101     CbcHeuristicNaive (CbcModel & model);
00102 
00103     // Copy constructor
00104     CbcHeuristicNaive ( const CbcHeuristicNaive &);
00105 
00106     // Destructor
00107     ~CbcHeuristicNaive ();
00108 
00110     virtual CbcHeuristic * clone() const;
00111 
00113     CbcHeuristicNaive & operator=(const CbcHeuristicNaive& rhs);
00114 
00116     virtual void generateCpp( FILE * fp) ;
00117 
00119     virtual void resetModel(CbcModel * model);
00120 
00122     virtual void setModel(CbcModel * model);
00123 
00124     using CbcHeuristic::solution ;
00128     virtual int solution(double & objectiveValue,
00129                          double * newSolution);
00130 
00132     inline void setLargeValue(double value) {
00133         large_ = value;
00134     }
00136     inline double largeValue() const {
00137         return large_;
00138     }
00139 
00140 protected:
00143     double large_;
00144 };
00145 
00149 class CbcHeuristicCrossover : public CbcHeuristic {
00150 public:
00151 
00152     // Default Constructor
00153     CbcHeuristicCrossover ();
00154 
00155     /* Constructor with model - assumed before cuts
00156        Initial version does not do Lps
00157     */
00158     CbcHeuristicCrossover (CbcModel & model);
00159 
00160     // Copy constructor
00161     CbcHeuristicCrossover ( const CbcHeuristicCrossover &);
00162 
00163     // Destructor
00164     ~CbcHeuristicCrossover ();
00165 
00167     virtual CbcHeuristic * clone() const;
00168 
00170     CbcHeuristicCrossover & operator=(const CbcHeuristicCrossover& rhs);
00171 
00173     virtual void generateCpp( FILE * fp) ;
00174 
00176     virtual void resetModel(CbcModel * model);
00177 
00179     virtual void setModel(CbcModel * model);
00180 
00181     using CbcHeuristic::solution ;
00187     virtual int solution(double & objectiveValue,
00188                          double * newSolution);
00189 
00191     inline void setNumberSolutions(int value) {
00192         if (value > 0 && value <= 10)
00193             useNumber_ = value;
00194     }
00195 
00196 protected:
00197     // Data
00199     std::vector <double> attempts_;
00201     double random_[10];
00203     int numberSolutions_;
00205     int useNumber_;
00206 };
00207 
00208 #endif
00209