[go: up one dir, main page]

Menu

[49ee99]: / OptFrame / Move.hpp  Maximize  Restore  History

Download this file

63 lines (46 with data), 1.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef OPTFRAME_MOVE_HPP_
#define OPTFRAME_MOVE_HPP_
#include "Solution.hpp"
#include "Evaluation.hpp"
using namespace std;
template<class R, class M = OPTFRAME_DEFAULT_MEMORY>
class Move
{
public:
virtual ~Move()
{
}
bool canBeApplied(const Solution<R>& s)
{
return canBeApplied(s.getR());
}
bool canBeApplied(const Evaluation<M>& e, const Solution<R>& s)
{
return canBeApplied(e.getM(), s.getR());
}
virtual bool canBeApplied(const R&) = 0;
virtual bool canBeApplied(const M& m, const R& r)
{
return canBeApplied(r);
}
Move<R, M>& apply(Solution<R>& s)
{
return apply(s.getR());
}
Move<R, M>& apply(Evaluation<M>& e, Solution<R>& s)
{
return apply(e.getM(), s.getR());
}
virtual Move<R, M>& apply(R& r) = 0;
virtual Move<R, M>& apply(M& m, R& r)
{
return apply(r);
}
virtual bool operator==(const Move<R, M>& m) const = 0;
bool operator!=(const Move<R, M>& m) const
{
return !(*this == m);
}
virtual void print() = 0;
};
#endif /*OPTFRAME_MOVE_HPP_*/