Cbc  trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CbcHeuristicLocal.hpp
Go to the documentation of this file.
00001 /* $Id$ */
00002 // Copyright (C) 2002, International Business Machines
00003 // Corporation and others.  All Rights Reserved.
00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
00005 
00006 #ifndef CbcHeuristicLocal_H
00007 #define CbcHeuristicLocal_H
00008 
00009 #include "CbcHeuristic.hpp"
00013 class CbcHeuristicLocal : public CbcHeuristic {
00014 public:
00015 
00016     // Default Constructor
00017     CbcHeuristicLocal ();
00018 
00019     /* Constructor with model - assumed before cuts
00020        Initial version does not do Lps
00021     */
00022     CbcHeuristicLocal (CbcModel & model);
00023 
00024     // Copy constructor
00025     CbcHeuristicLocal ( const CbcHeuristicLocal &);
00026 
00027     // Destructor
00028     ~CbcHeuristicLocal ();
00029 
00031     virtual CbcHeuristic * clone() const;
00032 
00034     CbcHeuristicLocal & operator=(const CbcHeuristicLocal& rhs);
00035 
00037     virtual void generateCpp( FILE * fp) ;
00038 
00040     virtual void resetModel(CbcModel * model);
00041 
00043     virtual void setModel(CbcModel * model);
00044 
00045     using CbcHeuristic::solution ;
00057     virtual int solution(double & objectiveValue,
00058                          double * newSolution);
00060     int solutionFix(double & objectiveValue,
00061                     double * newSolution,
00062                     const int * keep);
00063 
00065     inline void setSearchType(int value) {
00066         swap_ = value;
00067     }
00069     inline int * used() const {
00070         return used_;
00071     }
00072 
00073 protected:
00074     // Data
00075 
00076     // Original matrix by column
00077     CoinPackedMatrix matrix_;
00078 
00079     // Number of solutions so we only do after new solution
00080     int numberSolutions_;
00081     // Type of search 0=normal, 1=BAB
00082     int swap_;
00084     int * used_;
00085 };
00086 
00089 class CbcHeuristicFPump;
00090 class CbcHeuristicProximity : public CbcHeuristic {
00091 public:
00092 
00093     // Default Constructor
00094     CbcHeuristicProximity ();
00095 
00096     /* Constructor with model - assumed before cuts
00097     */
00098     CbcHeuristicProximity (CbcModel & model);
00099 
00100     // Copy constructor
00101     CbcHeuristicProximity ( const CbcHeuristicProximity &);
00102 
00103     // Destructor
00104     ~CbcHeuristicProximity ();
00105 
00107     virtual CbcHeuristic * clone() const;
00108 
00110     CbcHeuristicProximity & operator=(const CbcHeuristicProximity& rhs);
00111 
00113     virtual void generateCpp( FILE * fp) ;
00114 
00116     virtual void resetModel(CbcModel * model);
00117 
00119     virtual void setModel(CbcModel * model);
00120 
00121     using CbcHeuristic::solution ;
00125     virtual int solution(double & objectiveValue,
00126                          double * newSolution);
00127 
00129     inline int * used() const {
00130         return used_;
00131     }
00132 
00133 protected:
00134     // Data
00135     // Copy of Feasibility pump
00136     CbcHeuristicFPump * feasibilityPump_;
00137     // Number of solutions so we only do after new solution
00138     int numberSolutions_;
00140     int * used_;
00141 };
00142 
00143 
00150 class CbcHeuristicNaive : public CbcHeuristic {
00151 public:
00152 
00153     // Default Constructor
00154     CbcHeuristicNaive ();
00155 
00156     /* Constructor with model - assumed before cuts
00157        Initial version does not do Lps
00158     */
00159     CbcHeuristicNaive (CbcModel & model);
00160 
00161     // Copy constructor
00162     CbcHeuristicNaive ( const CbcHeuristicNaive &);
00163 
00164     // Destructor
00165     ~CbcHeuristicNaive ();
00166 
00168     virtual CbcHeuristic * clone() const;
00169 
00171     CbcHeuristicNaive & operator=(const CbcHeuristicNaive& rhs);
00172 
00174     virtual void generateCpp( FILE * fp) ;
00175 
00177     virtual void resetModel(CbcModel * model);
00178 
00180     virtual void setModel(CbcModel * model);
00181 
00182     using CbcHeuristic::solution ;
00186     virtual int solution(double & objectiveValue,
00187                          double * newSolution);
00188 
00190     inline void setLargeValue(double value) {
00191         large_ = value;
00192     }
00194     inline double largeValue() const {
00195         return large_;
00196     }
00197 
00198 protected:
00201     double large_;
00202 };
00203 
00207 class CbcHeuristicCrossover : public CbcHeuristic {
00208 public:
00209 
00210     // Default Constructor
00211     CbcHeuristicCrossover ();
00212 
00213     /* Constructor with model - assumed before cuts
00214        Initial version does not do Lps
00215     */
00216     CbcHeuristicCrossover (CbcModel & model);
00217 
00218     // Copy constructor
00219     CbcHeuristicCrossover ( const CbcHeuristicCrossover &);
00220 
00221     // Destructor
00222     ~CbcHeuristicCrossover ();
00223 
00225     virtual CbcHeuristic * clone() const;
00226 
00228     CbcHeuristicCrossover & operator=(const CbcHeuristicCrossover& rhs);
00229 
00231     virtual void generateCpp( FILE * fp) ;
00232 
00234     virtual void resetModel(CbcModel * model);
00235 
00237     virtual void setModel(CbcModel * model);
00238 
00239     using CbcHeuristic::solution ;
00245     virtual int solution(double & objectiveValue,
00246                          double * newSolution);
00247 
00249     inline void setNumberSolutions(int value) {
00250         if (value > 0 && value <= 10)
00251             useNumber_ = value;
00252     }
00253 
00254 protected:
00255     // Data
00257     std::vector <double> attempts_;
00259     double random_[10];
00261     int numberSolutions_;
00263     int useNumber_;
00264 };
00265 
00266 #endif
00267 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines