# CbcHeuristicGreedy.hpp

Go to the documentation of this file.

    00001 /* $Id: CbcHeuristicGreedy.hpp 1675 2011-06-19 17:23:14Z stefan $ */
    00002 // Copyright (C) 2005, 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 CbcHeuristicGreedy_H
    00007 #define CbcHeuristicGreedy_H
    00008
    00009 #include "CbcHeuristic.hpp"
    00013 class CbcHeuristicGreedyCover : public CbcHeuristic {
    00014 public:
    00015
    00016     // Default Constructor
    00017     CbcHeuristicGreedyCover ();
    00018
    00019     /* Constructor with model - assumed before cuts
    00020        Initial version does not do Lps
    00021     */
    00022     CbcHeuristicGreedyCover (CbcModel & model);
    00023
    00024     // Copy constructor
    00025     CbcHeuristicGreedyCover ( const CbcHeuristicGreedyCover &);
    00026
    00027     // Destructor
    00028     ~CbcHeuristicGreedyCover ();
    00029
    00031     virtual CbcHeuristic * clone() const;
    00033     CbcHeuristicGreedyCover & operator=(const CbcHeuristicGreedyCover& rhs);
    00035     virtual void generateCpp( FILE * fp) ;
    00036
    00038     virtual void setModel(CbcModel * model);
    00039
    00040     using CbcHeuristic::solution ;
    00051     virtual int solution(double & objectiveValue,
    00052                          double * newSolution);
    00054     virtual void validate() ;
    00056     virtual void resetModel(CbcModel * model);
    00057     /* Algorithm
    00058        0 - use current upper bounds
    00059        1 - use original upper bounds
    00060        If 10 added perturb ratios more
    00061        if 100 added round up all >=0.5
    00062     */
    00063     inline int algorithm() const {
    00064         return algorithm_;
    00065     }
    00066     inline void setAlgorithm(int value) {
    00067         algorithm_ = value;
    00068     }
    00069     // Only do this many times
    00070     inline int numberTimes() const {
    00071         return numberTimes_;
    00072     }
    00073     inline void setNumberTimes(int value) {
    00074         numberTimes_ = value;
    00075     }
    00076
    00077 protected:
    00079     void gutsOfConstructor(CbcModel * model);
    00080     // Data
    00081
    00082     // Original matrix by column
    00083     CoinPackedMatrix matrix_;
    00084     // original number of rows
    00085     int originalNumberRows_;
    00086     /* Algorithm
    00087        0 - use current upper bounds
    00088        1 - use original upper bounds
    00089        If 10 added perturb ratios more
    00090     */
    00091     int algorithm_;
    00093     int numberTimes_;
    00094
    00095 };
    00096
    00097
    00098 class CbcHeuristicGreedyEquality : public CbcHeuristic {
    00099 public:
    00100
    00101     // Default Constructor
    00102     CbcHeuristicGreedyEquality ();
    00103
    00104     /* Constructor with model - assumed before cuts
    00105        Initial version does not do Lps
    00106     */
    00107     CbcHeuristicGreedyEquality (CbcModel & model);
    00108
    00109     // Copy constructor
    00110     CbcHeuristicGreedyEquality ( const CbcHeuristicGreedyEquality &);
    00111
    00112     // Destructor
    00113     ~CbcHeuristicGreedyEquality ();
    00114
    00116     virtual CbcHeuristic * clone() const;
    00118     CbcHeuristicGreedyEquality & operator=(const CbcHeuristicGreedyEquality& rhs);
    00120     virtual void generateCpp( FILE * fp) ;
    00121
    00123     virtual void setModel(CbcModel * model);
    00124
    00125     using CbcHeuristic::solution ;
    00136     virtual int solution(double & objectiveValue,
    00137                          double * newSolution);
    00139     virtual void validate() ;
    00141     virtual void resetModel(CbcModel * model);
    00142     /* Algorithm
    00143        0 - use current upper bounds
    00144        1 - use original upper bounds
    00145        If 10 added perturb ratios more
    00146        if 100 added round up all >=0.5
    00147     */
    00148     inline int algorithm() const {
    00149         return algorithm_;
    00150     }
    00151     inline void setAlgorithm(int value) {
    00152         algorithm_ = value;
    00153     }
    00154     // Fraction of rhs to cover before branch and cut
    00155     inline void setFraction(double value) {
    00156         fraction_ = value;
    00157     }
    00158     inline double fraction() const {
    00159         return fraction_;
    00160     }
    00161     // Only do this many times
    00162     inline int numberTimes() const {
    00163         return numberTimes_;
    00164     }
    00165     inline void setNumberTimes(int value) {
    00166         numberTimes_ = value;
    00167     }
    00168 protected:
    00170     void gutsOfConstructor(CbcModel * model);
    00171     // Data
    00172
    00173     // Original matrix by column
    00174     CoinPackedMatrix matrix_;
    00175     // Fraction of rhs to cover before branch and cut
    00176     double fraction_;
    00177     // original number of rows
    00178     int originalNumberRows_;
    00179     /* Algorithm
    00180        0 - use current upper bounds
    00181        1 - use original upper bounds
    00182        If 10 added perturb ratios more
    00183     */
    00184     int algorithm_;
    00186     int numberTimes_;
    00187
    00188 };
    00189
    00193 class CbcHeuristicGreedySOS : public CbcHeuristic {
    00194 public:
    00195
    00196     // Default Constructor
    00197     CbcHeuristicGreedySOS ();
    00198
    00199     /* Constructor with model - assumed before cuts
    00200        Initial version does not do Lps
    00201     */
    00202     CbcHeuristicGreedySOS (CbcModel & model);
    00203
    00204     // Copy constructor
    00205     CbcHeuristicGreedySOS ( const CbcHeuristicGreedySOS &);
    00206
    00207     // Destructor
    00208     ~CbcHeuristicGreedySOS ();
    00209
    00211     virtual CbcHeuristic * clone() const;
    00213     CbcHeuristicGreedySOS & operator=(const CbcHeuristicGreedySOS& rhs);
    00215     virtual void generateCpp( FILE * fp) ;
    00216
    00218     virtual void setModel(CbcModel * model);
    00219
    00220     using CbcHeuristic::solution ;
    00231     virtual int solution(double & objectiveValue,
    00232                          double * newSolution);
    00234     virtual void validate() ;
    00236     virtual void resetModel(CbcModel * model);
    00237     /* Algorithm
    00238        Bits
    00239        1 bit - use current model, otherwise original
    00240        2 - use current solution as starting point, otherwise pure greedy
    00241        4 - as 2 but use merit not merit/size
    00242        8 - use duals to modify greedy
    00243        16 - use duals on GUB/SOS in special way
    00244     */
    00245     inline int algorithm() const {
    00246         return algorithm_;
    00247     }
    00248     inline void setAlgorithm(int value) {
    00249         algorithm_ = value;
    00250     }
    00251     // Only do this many times
    00252     inline int numberTimes() const {
    00253         return numberTimes_;
    00254     }
    00255     inline void setNumberTimes(int value) {
    00256         numberTimes_ = value;
    00257     }
    00258
    00259 protected:
    00261     void gutsOfConstructor(CbcModel * model);
    00262     // Data
    00263
    00264     // Original RHS - if -1.0 then SOS otherwise <= value
    00265     double * originalRhs_;
    00266     // Original matrix by column
    00267     CoinPackedMatrix matrix_;
    00268     // original number of rows
    00269     int originalNumberRows_;
    00270     /* Algorithm
    00271     */
    00272     int algorithm_;
    00274     int numberTimes_;
    00275
    00276 };
    00277
    00278
    00279 #endif
    00280

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines