# CbcHeuristicLocal.hpp

Go to the documentation of this file.

    00001 /* $Id: CbcHeuristicLocal.hpp 1573 2011-01-05 01:12:36Z lou $ */
    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
    00087
    00094 class CbcHeuristicNaive : public CbcHeuristic {
    00095 public:
    00096
    00097     // Default Constructor
    00098     CbcHeuristicNaive ();
    00099
    00100     /* Constructor with model - assumed before cuts
    00101        Initial version does not do Lps
    00102     */
    00103     CbcHeuristicNaive (CbcModel & model);
    00104
    00105     // Copy constructor
    00106     CbcHeuristicNaive ( const CbcHeuristicNaive &);
    00107
    00108     // Destructor
    00109     ~CbcHeuristicNaive ();
    00110
    00112     virtual CbcHeuristic * clone() const;
    00113
    00115     CbcHeuristicNaive & operator=(const CbcHeuristicNaive& rhs);
    00116
    00118     virtual void generateCpp( FILE * fp) ;
    00119
    00121     virtual void resetModel(CbcModel * model);
    00122
    00124     virtual void setModel(CbcModel * model);
    00125
    00126     using CbcHeuristic::solution ;
    00130     virtual int solution(double & objectiveValue,
    00131                          double * newSolution);
    00132
    00134     inline void setLargeValue(double value) {
    00135         large_ = value;
    00136     }
    00138     inline double largeValue() const {
    00139         return large_;
    00140     }
    00141
    00142 protected:
    00145     double large_;
    00146 };
    00147
    00151 class CbcHeuristicCrossover : public CbcHeuristic {
    00152 public:
    00153
    00154     // Default Constructor
    00155     CbcHeuristicCrossover ();
    00156
    00157     /* Constructor with model - assumed before cuts
    00158        Initial version does not do Lps
    00159     */
    00160     CbcHeuristicCrossover (CbcModel & model);
    00161
    00162     // Copy constructor
    00163     CbcHeuristicCrossover ( const CbcHeuristicCrossover &);
    00164
    00165     // Destructor
    00166     ~CbcHeuristicCrossover ();
    00167
    00169     virtual CbcHeuristic * clone() const;
    00170
    00172     CbcHeuristicCrossover & operator=(const CbcHeuristicCrossover& rhs);
    00173
    00175     virtual void generateCpp( FILE * fp) ;
    00176
    00178     virtual void resetModel(CbcModel * model);
    00179
    00181     virtual void setModel(CbcModel * model);
    00182
    00183     using CbcHeuristic::solution ;
    00189     virtual int solution(double & objectiveValue,
    00190                          double * newSolution);
    00191
    00193     inline void setNumberSolutions(int value) {
    00194         if (value > 0 && value <= 10)
    00195             useNumber_ = value;
    00196     }
    00197
    00198 protected:
    00199     // Data
    00201     std::vector <double> attempts_;
    00203     double random_[10];
    00205     int numberSolutions_;
    00207     int useNumber_;
    00208 };
    00209
    00210 #endif
    00211

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines