Cbc trunk
CbcHeuristicFPump.hpp
Go to the documentation of this file.
00001 /* $Id$ */
00002 // Copyright (C) 2004, 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 CbcHeuristicFeasibilityPump_H
00007 #define CbcHeuristicFeasibilityPump_H
00008 
00009 #include "CbcHeuristic.hpp"
00010 #include "OsiClpSolverInterface.hpp"
00011 
00015 class CbcHeuristicFPump : public CbcHeuristic {
00016 public:
00017 
00018     // Default Constructor
00019     CbcHeuristicFPump ();
00020 
00021     // Constructor with model - assumed before cuts
00022     CbcHeuristicFPump (CbcModel & model,
00023                        double downValue = 0.5, bool roundExpensive = false);
00024 
00025     // Copy constructor
00026     CbcHeuristicFPump ( const CbcHeuristicFPump &);
00027 
00028     // Destructor
00029     ~CbcHeuristicFPump ();
00030 
00032     CbcHeuristicFPump & operator=(const CbcHeuristicFPump& rhs);
00034     virtual CbcHeuristic * clone() const;
00036     virtual void generateCpp( FILE * fp) ;
00037 
00039     virtual void resetModel(CbcModel * model);
00040 
00042     virtual void setModel(CbcModel * model);
00043 
00044     using CbcHeuristic::solution ;
00065     virtual int solution(double & objectiveValue,
00066                          double * newSolution);
00067 
00069     void setMaximumTime(double value);
00071     inline double maximumTime() const {
00072         return maximumTime_;
00073     }
00075     inline void setFakeCutoff(double value) {
00076         fakeCutoff_ = value;
00077     }
00079     inline double fakeCutoff() const {
00080         return fakeCutoff_;
00081     }
00083     inline void setAbsoluteIncrement(double value) {
00084         absoluteIncrement_ = value;
00085     }
00087     inline double absoluteIncrement() const {
00088         return absoluteIncrement_;
00089     }
00091     inline void setRelativeIncrement(double value) {
00092         relativeIncrement_ = value;
00093     }
00095     inline double relativeIncrement() const {
00096         return relativeIncrement_;
00097     }
00099     inline void setDefaultRounding(double value) {
00100         defaultRounding_ = value;
00101     }
00103     inline double defaultRounding() const {
00104         return defaultRounding_;
00105     }
00107     inline void setInitialWeight(double value) {
00108         initialWeight_ = value;
00109     }
00111     inline double initialWeight() const {
00112         return initialWeight_;
00113     }
00115     inline void setWeightFactor(double value) {
00116         weightFactor_ = value;
00117     }
00119     inline double weightFactor() const {
00120         return weightFactor_;
00121     }
00123     inline void setArtificialCost(double value) {
00124         artificialCost_ = value;
00125     }
00127     inline double artificialCost() const {
00128         return artificialCost_;
00129     }
00131     inline double iterationRatio() const {
00132         return iterationRatio_;
00133     }
00135     inline void setIterationRatio(double value) {
00136         iterationRatio_ = value;
00137     }
00139     inline void setMaximumPasses(int value) {
00140         maximumPasses_ = value;
00141     }
00143     inline int maximumPasses() const {
00144         return maximumPasses_;
00145     }
00147     inline void setMaximumRetries(int value) {
00148         maximumRetries_ = value;
00149     }
00151     inline int maximumRetries() const {
00152         return maximumRetries_;
00153     }
00175     inline void setAccumulate(int value) {
00176         accumulate_ = value;
00177     }
00179     inline int accumulate() const {
00180         return accumulate_;
00181     }
00187     inline void setFixOnReducedCosts(int value) {
00188         fixOnReducedCosts_ = value;
00189     }
00191     inline int fixOnReducedCosts() const {
00192         return fixOnReducedCosts_;
00193     }
00198     inline void setReducedCostMultiplier(double value) {
00199         reducedCostMultiplier_ = value;
00200     }
00202     inline double reducedCostMultiplier() const {
00203         return reducedCostMultiplier_;
00204     }
00205 
00206 protected:
00207     // Data
00209     double startTime_;
00211     double maximumTime_;
00215     double fakeCutoff_;
00217     double absoluteIncrement_;
00219     double relativeIncrement_;
00221     double defaultRounding_;
00223     double initialWeight_;
00225     double weightFactor_;
00227     double artificialCost_;
00230     double iterationRatio_;
00235     double reducedCostMultiplier_;
00237     int maximumPasses_;
00241     int maximumRetries_;
00252     int accumulate_;
00258     int fixOnReducedCosts_;
00260     bool roundExpensive_;
00261 
00262 private:
00267     int rounds(OsiSolverInterface * solver, double * solution,
00268                /*const double * objective, */
00269                int numberIntegers, const int * integerVariable,
00270                /*char * pumpPrint,*/int passNumber,
00271                /*bool roundExpensive=false,*/
00272                double downValue = 0.5, int *flip = 0);
00273     /* note for eagle eyed readers.
00274        when_ can now be exotic -
00275        <=10 normal
00276     */
00277 };
00278 
00279 # ifdef COIN_HAS_CLP
00280 
00281 class CbcDisasterHandler : public OsiClpDisasterHandler {
00282 public:
00286 #ifdef JJF_ZERO
00287 
00288     virtual void intoSimplex();
00290     virtual bool check() const ;
00292     virtual void saveInfo();
00293 #endif
00294 
00295     virtual int typeOfDisaster();
00297 
00298 
00303     CbcDisasterHandler(CbcModel * model = NULL);
00305     virtual ~CbcDisasterHandler();
00306     // Copy
00307     CbcDisasterHandler(const CbcDisasterHandler&);
00308     // Assignment
00309     CbcDisasterHandler& operator=(const CbcDisasterHandler&);
00311     virtual ClpDisasterHandler * clone() const;
00312 
00314 
00319     void setCbcModel(CbcModel * model);
00321     inline CbcModel * cbcModel() const {
00322         return cbcModel_;
00323     }
00324 
00326 
00327 
00328 protected:
00332 
00333     CbcModel * cbcModel_;
00334 
00336 };
00337 #endif
00338 
00339 #endif
00340 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines