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

Last change on this file since 885 was 765, checked in by andreasw, 12 years ago

merging changes from Bug Squashing Party Aug 2007 to regular trunk

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1// Copyright (C) 2002, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef CbcHeuristicLocal_H
4#define CbcHeuristicLocal_H
5
6#include "CbcHeuristic.hpp"
7/** LocalSearch class
8 */
9
10class CbcHeuristicLocal : public CbcHeuristic {
11public:
12
13  // Default Constructor
14  CbcHeuristicLocal ();
15
16  /* Constructor with model - assumed before cuts
17     Initial version does not do Lps
18  */
19  CbcHeuristicLocal (CbcModel & model);
20 
21  // Copy constructor
22  CbcHeuristicLocal ( const CbcHeuristicLocal &);
23   
24  // Destructor
25  ~CbcHeuristicLocal ();
26 
27  /// Clone
28  virtual CbcHeuristic * clone() const;
29
30  /// Assignment operator
31  CbcHeuristicLocal & operator=(const CbcHeuristicLocal& rhs);
32
33  /// Create C++ lines to get to current state
34  virtual void generateCpp( FILE * fp) ;
35
36  /// Resets stuff if model changes
37  virtual void resetModel(CbcModel * model);
38
39  /// update model (This is needed if cliques update matrix etc)
40  virtual void setModel(CbcModel * model);
41 
42  using CbcHeuristic::solution ;
43  /** returns 0 if no solution, 1 if valid solution.
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      First tries setting a variable to better value.  If feasible then
47      tries setting others.  If not feasible then tries swaps
48
49      ********
50
51      This first version does not do LP's and does swaps of two integer
52      variables.  Later versions could do Lps.
53  */
54  virtual int solution(double & objectiveValue,
55                       double * newSolution);
56  /// This version fixes stuff and does IP
57  int solutionFix(double & objectiveValue,
58                  double * newSolution,
59                  const int * keep);
60
61  /// Sets type of search
62  inline void setSearchType(int value)
63  { swap_=value;}
64  /// Used array so we can set
65  inline char * used() const
66  { return used_;}
67
68protected:
69  // Data
70
71  // Original matrix by column
72  CoinPackedMatrix matrix_;
73
74  // Number of solutions so we only do after new solution
75  int numberSolutions_;
76  // Type of search 0=normal, 1=BAB
77  int swap_;
78  /// Whether a variable has been in a solution
79  char * used_;
80};
81
82
83#endif
Note: See TracBrowser for help on using the repository browser.