source: trunk/Samples/CbcHeuristicUser.hpp @ 21

Last change on this file since 21 was 21, checked in by forrest, 17 years ago

Getting rid of B.hpp

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