AbcHeuristic.h
Go to the documentation of this file.
1 /*===========================================================================*
2  * This file is part of the Abstract Library for Parallel Search (ALPS). *
3  * *
4  * ALPS is distributed under the Eclipse Public License as part of the *
5  * COIN-OR repository (http://www.coin-or.org). *
6  * *
7  * Authors: *
8  * *
9  * Yan Xu, Lehigh University *
10  * Ted Ralphs, Lehigh University *
11  * *
12  * Conceptual Design: *
13  * *
14  * Yan Xu, Lehigh University *
15  * Ted Ralphs, Lehigh University *
16  * Laszlo Ladanyi, IBM T.J. Watson Research Center *
17  * Matthew Saltzman, Clemson University *
18  * *
19  * *
20  * Copyright (C) 2001-2013, Lehigh University, Yan Xu, and Ted Ralphs. *
21  *===========================================================================*/
22 
23 //#############################################################################
24 // This file is modified from SbbHeuristic.hpp
25 //#############################################################################
26 
27 #ifndef AbcHeuristic_h_
28 #define AbcHeuristic_h_
29 
30 #include <string>
31 #include <vector>
32 #include "CoinPackedMatrix.hpp"
33 #include "OsiCuts.hpp"
34 
35 class OsiSolverInterface;
36 class AbcModel;
37 
38 //#############################################################################
39 
41 class AbcHeuristic {
42 public:
43  // Default Constructor
44  AbcHeuristic ();
45 
46  // Constructor with model - assumed before cuts
47  AbcHeuristic (AbcModel & model);
48 
49  virtual ~AbcHeuristic();
50 
52  virtual void setModel(AbcModel * model);
53 
55  virtual AbcHeuristic * clone() const=0;
56 
62  virtual int solution(double & objectiveValue,
63  double * newSolution)=0;
64 
72  virtual int solution(double & objectiveValue,
73  double * newSolution,
74  OsiCuts & cs) {return 0;}
75 
76 protected:
77 
80 private:
81 
83  AbcHeuristic & operator=(const AbcHeuristic& rhs);
84 
85 };
86 
90 class AbcRounding : public AbcHeuristic {
91 public:
92 
93  // Default Constructor
94  AbcRounding ();
95 
96  // Constructor with model - assumed before cuts
97  AbcRounding (AbcModel & model);
98 
99  // Copy constructor
100  AbcRounding ( const AbcRounding &);
101 
102  // Destructor
103  ~AbcRounding ();
104 
106  virtual AbcHeuristic * clone() const;
107 
109  virtual void setModel(AbcModel * model);
110 
116  virtual int solution(double & objectiveValue,
117  double * newSolution);
118 
119 
121  void setSeed(int value)
122  { seed_ = value;}
123 
124 protected:
125  // Data
126 
127  // Original matrix by column
129 
130  // Original matrix by
132 
133  // Seed for random stuff
134  int seed_;
135 
136 private:
138  AbcRounding & operator=(const AbcRounding& rhs);
139 };
140 
141 
142 #endif
143 
virtual int solution(double &objectiveValue, double *newSolution)=0
returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets sol...
virtual ~AbcHeuristic()
virtual AbcHeuristic * clone() const
Clone.
AbcRounding & operator=(const AbcRounding &rhs)
Illegal Assignment operator.
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets sol...
virtual void setModel(AbcModel *model)
update model (This is needed if cliques update matrix etc)
Sparse Matrix Base Class.
Heuristic base class.
Definition: AbcHeuristic.h:41
CoinPackedMatrix matrix_
Definition: AbcHeuristic.h:128
Collections of row cuts and column cuts.
Definition: OsiCuts.hpp:19
AbcModel * model_
Model.
Definition: AbcHeuristic.h:79
Abstract Base Class for describing an interface to a solver.
virtual AbcHeuristic * clone() const =0
Clone.
CoinPackedMatrix matrixByRow_
Definition: AbcHeuristic.h:131
Rounding class.
Definition: AbcHeuristic.h:90
AbcHeuristic & operator=(const AbcHeuristic &rhs)
Illegal Assignment operator.
virtual int solution(double &objectiveValue, double *newSolution, OsiCuts &cs)
returns 0 if no solution, 1 if valid solution, -1 if just returning an estimate of best possible solu...
Definition: AbcHeuristic.h:72
virtual void setModel(AbcModel *model)
update model (This is needed if cliques update matrix etc)
void setSeed(int value)
Set seed.
Definition: AbcHeuristic.h:121
Model class for ALPS Branch and Cut.
Definition: AbcModel.h:55