/home/coin/SVN-release/Cbc-2.4.1/Cbc/src/CbcHeuristicDive.hpp

Go to the documentation of this file.
00001 /* $Id: CbcHeuristicDive.hpp 1252 2009-10-20 09:22:24Z stefan $ */
00002 // Copyright (C) 2008, International Business Machines
00003 // Corporation and others.  All Rights Reserved.
00004 #ifndef CbcHeuristicDive_H
00005 #define CbcHeuristicDive_H
00006 
00007 #include "CbcHeuristic.hpp"
00008 struct PseudoReducedCost {
00009   int var;
00010   double pseudoRedCost;
00011 };
00012 
00013 
00017 class CbcHeuristicDive : public CbcHeuristic {
00018 public:
00019 
00020   // Default Constructor 
00021   CbcHeuristicDive ();
00022 
00023   // Constructor with model - assumed before cuts
00024   CbcHeuristicDive (CbcModel & model);
00025   
00026   // Copy constructor 
00027   CbcHeuristicDive ( const CbcHeuristicDive &);
00028    
00029   // Destructor 
00030   ~CbcHeuristicDive ();
00031 
00033   virtual CbcHeuristicDive * clone() const = 0;
00034   
00036   CbcHeuristicDive & operator=(const CbcHeuristicDive& rhs);
00037 
00039   virtual void generateCpp( FILE * ) {}
00040 
00042   void generateCpp( FILE * fp,const char * heuristic);
00043 
00045   virtual void resetModel(CbcModel * model);
00046 
00048   virtual void setModel(CbcModel * model);
00049   
00050   //  REMLOVE using CbcHeuristic::solution ;
00057   virtual int solution(double & objectiveValue,
00058                        double * newSolution);
00059 
00061   virtual void validate();
00062 
00064   void selectBinaryVariables();
00065 
00067   void setPercentageToFix(double value)
00068   { percentageToFix_ = value; }
00069 
00071   void setMaxIterations(int value)
00072   { maxIterations_ = value; }
00073 
00075   void setMaxSimplexIterations(int value)
00076   { maxSimplexIterations_ = value; }
00077 
00079   void setMaxSimplexIterationsAtRoot(int value)
00080   { maxSimplexIterationsAtRoot_ = value; }
00081 
00083   void setMaxTime(double value)
00084   { maxTime_ = value; }
00085 
00087   virtual bool canHeuristicRun();
00088 
00095   virtual bool selectVariableToBranch(OsiSolverInterface* solver,
00096                                       const double* newSolution,
00097                                       int& bestColumn,
00098                                       int& bestRound) = 0;
00101   virtual void initializeData() {}
00102 
00104   int reducedCostFix (OsiSolverInterface* solver);
00106   virtual int fixOtherVariables(OsiSolverInterface * solver,
00107                                 const double * solution,
00108                                 PseudoReducedCost * candidate,
00109                                 const double * random);
00110 
00111 protected:
00112   // Data
00113 
00114   // Original matrix by column
00115   CoinPackedMatrix matrix_;
00116 
00117   // Original matrix by 
00118   CoinPackedMatrix matrixByRow_;
00119 
00120   // Down locks
00121   unsigned short * downLocks_;
00122 
00123   // Up locks
00124   unsigned short * upLocks_;
00125 
00127   double * downArray_;
00128 
00130   double * upArray_;
00131 
00132   // Indexes of binary variables with 0 objective coefficient
00133   // and in variable bound constraints
00134   std::vector<int> binVarIndex_;
00135 
00136   // Indexes of variable bound rows for each binary variable
00137   std::vector<int> vbRowIndex_;
00138 
00139   // Percentage of integer variables to fix at bounds
00140   double percentageToFix_;
00141 
00142   // Maximum number of major iterations
00143   int maxIterations_;
00144 
00145   // Maximum number of simplex iterations
00146   int maxSimplexIterations_;
00147 
00148   // Maximum number of simplex iterations at root node
00149   int maxSimplexIterationsAtRoot_;
00150 
00151   // Maximum time allowed
00152   double maxTime_;
00153 
00154 };
00155 #endif

Generated on Thu Apr 8 03:02:03 2010 by  doxygen 1.4.7