CbcHeuristicDive.hpp

Go to the documentation of this file.
00001 /* $Id: CbcHeuristicDive.hpp 1902 2013-04-10 16:58:16Z stefan $ */
00002 // Copyright (C) 2008, 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 CbcHeuristicDive_H
00007 #define CbcHeuristicDive_H
00008 
00009 #include "CbcHeuristic.hpp"
00010 class CbcSubProblem;
00011 class OsiRowCut;
00012 struct PseudoReducedCost {
00013     int var;
00014     double pseudoRedCost;
00015 };
00016 
00017 
00021 class CbcHeuristicDive : public CbcHeuristic {
00022 public:
00023 
00024     // Default Constructor
00025     CbcHeuristicDive ();
00026 
00027     // Constructor with model - assumed before cuts
00028     CbcHeuristicDive (CbcModel & model);
00029 
00030     // Copy constructor
00031     CbcHeuristicDive ( const CbcHeuristicDive &);
00032 
00033     // Destructor
00034     ~CbcHeuristicDive ();
00035 
00037     virtual CbcHeuristicDive * clone() const = 0;
00038 
00040     CbcHeuristicDive & operator=(const CbcHeuristicDive& rhs);
00041 
00043     virtual void generateCpp( FILE * ) {}
00044 
00046     void generateCpp( FILE * fp, const char * heuristic);
00047 
00049     virtual void resetModel(CbcModel * model);
00050 
00052     virtual void setModel(CbcModel * model);
00053 
00054     //  REMLOVE using CbcHeuristic::solution ;
00061     virtual int solution(double & objectiveValue,
00062                          double * newSolution);
00064   int solution(double & objectiveValue, int & numberNodes,
00065                  int & numberCuts, OsiRowCut ** cuts,
00066                  CbcSubProblem ** & nodes,
00067                  double * newSolution);
00073     int fathom(CbcModel * model, int & numberNodes,CbcSubProblem ** & nodes);
00074 
00076     virtual void validate();
00077 
00079     void selectBinaryVariables();
00080 
00082     void setPercentageToFix(double value) {
00083         percentageToFix_ = value;
00084     }
00085 
00087     void setMaxIterations(int value) {
00088         maxIterations_ = value;
00089     }
00090 
00092     void setMaxSimplexIterations(int value) {
00093         maxSimplexIterations_ = value;
00094     }
00096     inline int maxSimplexIterations() const {
00097         return maxSimplexIterations_;
00098     }
00099 
00101     void setMaxSimplexIterationsAtRoot(int value) {
00102         maxSimplexIterationsAtRoot_ = value;
00103     }
00104 
00106     void setMaxTime(double value) {
00107         maxTime_ = value;
00108     }
00109 
00111     virtual bool canHeuristicRun();
00112 
00119     virtual bool selectVariableToBranch(OsiSolverInterface* solver,
00120                                         const double* newSolution,
00121                                         int& bestColumn,
00122                                         int& bestRound) = 0;
00125     virtual void initializeData() {}
00126 
00128     int reducedCostFix (OsiSolverInterface* solver);
00130     virtual int fixOtherVariables(OsiSolverInterface * solver,
00131                                   const double * solution,
00132                                   PseudoReducedCost * candidate,
00133                                   const double * random);
00134 
00135 protected:
00136     // Data
00137 
00138     // Original matrix by column
00139     CoinPackedMatrix matrix_;
00140 
00141     // Original matrix by
00142     CoinPackedMatrix matrixByRow_;
00143 
00144     // Down locks
00145     unsigned short * downLocks_;
00146 
00147     // Up locks
00148     unsigned short * upLocks_;
00149 
00151     double * downArray_;
00152 
00154     double * upArray_;
00155 
00156     // Indexes of binary variables with 0 objective coefficient
00157     // and in variable bound constraints
00158     std::vector<int> binVarIndex_;
00159 
00160     // Indexes of variable bound rows for each binary variable
00161     std::vector<int> vbRowIndex_;
00162 
00163     // Percentage of integer variables to fix at bounds
00164     double percentageToFix_;
00165 
00166     // Maximum number of major iterations
00167     int maxIterations_;
00168 
00169     // Maximum number of simplex iterations
00170     int maxSimplexIterations_;
00171 
00172     // Maximum number of simplex iterations at root node
00173     int maxSimplexIterationsAtRoot_;
00174 
00175     // Maximum time allowed
00176     double maxTime_;
00177 
00178 };
00179 #endif
00180 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 17 Jul 2013 for Cbc by  doxygen 1.6.1