source: branches/heur/Cbc/src/CbcHeuristicDiveVectorLength.hpp @ 885

Last change on this file since 885 was 868, checked in by forrest, 12 years ago

adding diving heuristics from Joao

File size: 2.2 KB
Line 
1// Copyright (C) 2008, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef CbcHeuristicDiveVectorLength_H
4#define CbcHeuristicDiveVectorLength_H
5
6#include "CbcHeuristic.hpp"
7
8/** DiveVectorLength class
9 */
10
11class CbcHeuristicDiveVectorLength : public CbcHeuristic {
12public:
13
14  // Default Constructor
15  CbcHeuristicDiveVectorLength ();
16
17  // Constructor with model - assumed before cuts
18  CbcHeuristicDiveVectorLength (CbcModel & model);
19 
20  // Copy constructor
21  CbcHeuristicDiveVectorLength ( const CbcHeuristicDiveVectorLength &);
22   
23  // Destructor
24  ~CbcHeuristicDiveVectorLength ();
25
26  /// Clone
27  virtual CbcHeuristicDiveVectorLength * clone() const;
28 
29  /// Assignment operator
30  CbcHeuristicDiveVectorLength & operator=(const CbcHeuristicDiveVectorLength& rhs);
31
32  /// Create C++ lines to get to current state
33  virtual void generateCpp( FILE * fp) ;
34
35  /// Resets stuff if model changes
36  virtual void resetModel(CbcModel * model);
37
38  /// update model (This is needed if cliques update matrix etc)
39  virtual void setModel(CbcModel * model);
40 
41  using CbcHeuristic::solution ;
42  /** returns 0 if no solution, 1 if valid solution
43      with better objective value than one passed in
44      Sets solution values if good, sets objective value (only if good)
45      This is called after cuts have been added - so can not add cuts
46      This does VectorLength Diving
47  */
48  virtual int solution(double & objectiveValue,
49                       double * newSolution);
50
51  /// Validate model i.e. sets when_ to 0 if necessary (may be NULL)
52  virtual void validate();
53
54  /// Set percentage of integer variables to fix at bounds
55  void setPercentageToFix(double value)
56  { percentageToFix_ = value; }
57
58  /// Set maximum number of iterations
59  void setMaxIterations(int value)
60  { maxIterations_ = value; }
61
62  /// Set maximum time allowed
63  void setMaxTime(double value)
64  { maxTime_ = value; }
65
66protected:
67  // Data
68
69  // Original matrix by column
70  CoinPackedMatrix matrix_;
71
72  // Down locks
73  unsigned short * downLocks_;
74
75  // Up locks
76  unsigned short * upLocks_;
77
78  // Percentage of integer variables to fix at bounds
79  double percentageToFix_;
80
81  // Maximum number of iterations
82  int maxIterations_;
83
84  // Maximum time allowed
85  double maxTime_;
86
87};
88
89#endif
Note: See TracBrowser for help on using the repository browser.