Changeset 607 for branches


Ignore:
Timestamp:
May 14, 2007 8:32:29 PM (12 years ago)
Author:
lou
Message:

Add names for heuristic, analogous to names for cut generators.

Location:
branches/devel/Cbc/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/devel/Cbc/src/CbcHeuristic.cpp

    r574 r607  
    2727   when_(2),
    2828   numberNodes_(200),
    29    fractionSmall_(1.0)
     29   fractionSmall_(1.0),
     30   heuristicName_("Unknown")
    3031{
    3132  // As CbcHeuristic virtual need to modify .cpp if above change
     
    3839  when_(2),
    3940  numberNodes_(200),
    40   fractionSmall_(1.0)
     41  fractionSmall_(1.0),
     42  heuristicName_("Unknown")
    4143{
    4244  // As CbcHeuristic virtual need to modify .cpp if above change
     
    4850  when_(rhs.when_),
    4951  numberNodes_(rhs.numberNodes_),
    50   fractionSmall_(rhs.fractionSmall_)
     52  fractionSmall_(rhs.fractionSmall_),
     53  heuristicName_(rhs.heuristicName_)
    5154{
    5255}
     
    6063    numberNodes_ = rhs.numberNodes_;
    6164    fractionSmall_ = rhs.fractionSmall_;
     65    heuristicName_ = rhs.heuristicName_ ;
    6266  }
    6367  return *this;
     
    8892  else
    8993    fprintf(fp,"4  %s.setFractionSmall(%g);\n",heuristic,fractionSmall_);
     94  if (heuristicName_ != "Unknown")
     95    fprintf(fp,"3  %s.setHeuristicName(\"%s\");\n",
     96            heuristic,heuristicName_.c_str()) ;
     97  else
     98    fprintf(fp,"4  %s.setHeuristicName(\"%s\");\n",
     99            heuristic,heuristicName_.c_str()) ;
    90100}
    91101// Destructor
  • branches/devel/Cbc/src/CbcHeuristic.hpp

    r502 r607  
    104104  virtual bool canDealWithOdd() const
    105105  { return false;};
     106  /// return name of heuristic
     107  inline const char *heuristicName() const
     108  { return heuristicName_.c_str();};
     109  /// set name of heuristic
     110  inline void setHeuristicName(const char *name)
     111  { heuristicName_ = name;};
    106112
    107113protected:
     
    115121  /// Fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound
    116122  double fractionSmall_;
     123  /// Name for printing
     124  std::string heuristicName_;
    117125 
    118126};
  • branches/devel/Cbc/src/CbcModel.cpp

    r587 r607  
    35843584// Add one heuristic
    35853585void
    3586 CbcModel::addHeuristic(CbcHeuristic * generator)
     3586CbcModel::addHeuristic(CbcHeuristic * generator, const char *name)
    35873587{
    35883588  CbcHeuristic ** temp = heuristic_;
     
    35903590  memcpy(heuristic_,temp,numberHeuristics_*sizeof(CbcHeuristic *));
    35913591  delete [] temp;
    3592   heuristic_[numberHeuristics_++]=generator->clone();
     3592  heuristic_[numberHeuristics_]=generator->clone();
     3593  if (name)
     3594  { heuristic_[numberHeuristics_]->setHeuristicName(name) ; }
     3595  numberHeuristics_++ ;
    35933596}
    35943597
  • branches/devel/Cbc/src/CbcModel.hpp

    r587 r607  
    12441244  /** \name Heuristics and priorities */
    12451245  //@{
    1246   /// Add one heuristic - up to user to delete
    1247   void addHeuristic(CbcHeuristic * generator);
     1246  /*! \brief Add one heuristic - up to user to delete
     1247
     1248    The name is just used for print messages.
     1249  */
     1250  void addHeuristic(CbcHeuristic * generator, const char *name = NULL);
    12481251  ///Get the specified heuristic
    12491252  inline CbcHeuristic * heuristic(int i) const
Note: See TracChangeset for help on using the changeset viewer.