Alps  2.0.2
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  * Aykut Bulut, Lehigh University *
11  * Ted Ralphs, Lehigh University *
12  * *
13  * Conceptual Design: *
14  * *
15  * Yan Xu, Lehigh University *
16  * Ted Ralphs, Lehigh University *
17  * Laszlo Ladanyi, IBM T.J. Watson Research Center *
18  * Matthew Saltzman, Clemson University *
19  * *
20  * *
21  * Copyright (C) 2001-2019, Lehigh University, Yan Xu, Aykut Bulut, and *
22  * Ted Ralphs. *
23  * All Rights Reserved. *
24  *===========================================================================*/
25 
26 
27 //#############################################################################
28 // This file is modified from SbbHeuristic.hpp
29 //#############################################################################
30 
31 #ifndef AbcHeuristic_h_
32 #define AbcHeuristic_h_
33 
34 #include <string>
35 #include <vector>
36 #include "CoinPackedMatrix.hpp"
37 #include "OsiCuts.hpp"
38 
39 class OsiSolverInterface;
40 class AbcModel;
41 
42 //#############################################################################
43 
45 class AbcHeuristic {
46 public:
47  // Default Constructor
48  AbcHeuristic ();
49 
50  // Constructor with model - assumed before cuts
51  AbcHeuristic (AbcModel & model);
52 
53  virtual ~AbcHeuristic();
54 
56  virtual void setModel(AbcModel * model);
57 
59  virtual AbcHeuristic * clone() const=0;
60 
66  virtual int solution(double & objectiveValue,
67  double * newSolution)=0;
68 
76  virtual int solution(double & objectiveValue,
77  double * newSolution,
78  OsiCuts & cs) {return 0;}
79 
80 protected:
81 
83  AbcModel * model_;
84 private:
85 
87  AbcHeuristic & operator=(const AbcHeuristic& rhs);
88 
89 };
90 
94 class AbcRounding : public AbcHeuristic {
95 public:
96 
97  // Default Constructor
98  AbcRounding ();
99 
100  // Constructor with model - assumed before cuts
101  AbcRounding (AbcModel & model);
102 
103  // Copy constructor
104  AbcRounding ( const AbcRounding &);
105 
106  // Destructor
107  ~AbcRounding ();
108 
110  virtual AbcHeuristic * clone() const;
111 
113  virtual void setModel(AbcModel * model);
114 
120  virtual int solution(double & objectiveValue,
121  double * newSolution);
122 
123 
125  void setSeed(int value)
126  { seed_ = value;}
127 
128 protected:
129  // Data
130 
131  // Original matrix by column
132  CoinPackedMatrix matrix_;
133 
134  // Original matrix by
135  CoinPackedMatrix matrixByRow_;
136 
137  // Seed for random stuff
138  int seed_;
139 
140 private:
142  AbcRounding & operator=(const AbcRounding& rhs);
143 };
144 
145 
146 #endif
AbcRounding::clone
virtual AbcHeuristic * clone() const
Clone.
AbcHeuristic::solution
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:76
AbcRounding::setSeed
void setSeed(int value)
Set seed.
Definition: AbcHeuristic.h:125
AbcHeuristic::operator=
AbcHeuristic & operator=(const AbcHeuristic &rhs)
Illegal Assignment operator.
AbcHeuristic::setModel
virtual void setModel(AbcModel *model)
update model (This is needed if cliques update matrix etc)
AbcHeuristic::~AbcHeuristic
virtual ~AbcHeuristic()
AbcRounding::matrix_
CoinPackedMatrix matrix_
Definition: AbcHeuristic.h:132
AbcRounding::solution
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...
AbcRounding::~AbcRounding
~AbcRounding()
AbcHeuristic::AbcHeuristic
AbcHeuristic()
AbcHeuristic::clone
virtual AbcHeuristic * clone() const =0
Clone.
AbcHeuristic::solution
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...
AbcRounding::matrixByRow_
CoinPackedMatrix matrixByRow_
Definition: AbcHeuristic.h:135
AbcRounding::operator=
AbcRounding & operator=(const AbcRounding &rhs)
Illegal Assignment operator.
AbcRounding::setModel
virtual void setModel(AbcModel *model)
update model (This is needed if cliques update matrix etc)
AbcHeuristic
Heuristic base class.
Definition: AbcHeuristic.h:45
AbcModel
Model class for ALPS Branch and Cut.
Definition: AbcModel.h:59
AbcRounding
Rounding class.
Definition: AbcHeuristic.h:94
AbcRounding::seed_
int seed_
Definition: AbcHeuristic.h:138
AbcRounding::AbcRounding
AbcRounding()
AbcHeuristic::model_
AbcModel * model_
Model.
Definition: AbcHeuristic.h:83