- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

AlpsKnowledge.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 #ifndef AlpsKnowledge_h
24 #define AlpsKnowledge_h
25
26 #include <map>
27 #include <memory>
28 #include <typeinfo>
29
30 #include "Alps.h"
31 #include "AlpsEncoded.h"
32
33 //#############################################################################
36 //#############################################################################
37
38 struct AlpsStrLess
39 {
40 inline bool operator()(const char* s1, const char* s2) const {
41 return strcmp(s1, s2) < 0;
42 }
43 };
44
45 //#############################################################################
49 //#############################################################################
50
51 class AlpsKnowledge {
52
53 private:
54 AlpsKnowledge(const AlpsKnowledge&);
55 AlpsKnowledge& operator=(const AlpsKnowledge&);
56
58 //FIXME: For now, we just use a regular pointer here to get it to compile.
59 //CoinPtr<AlpsEncoded> encoded_;
60 AlpsEncoded* encoded_;
61
62 protected:
63
64 KnowledgeType type_;
65
66 public:
67
68 AlpsKnowledge() : encoded_(0), type_(AlpsKnowledgeTypeUndefined) {}
69 virtual ~AlpsKnowledge() {}
70
71 KnowledgeType getType() { return type_; }
72 void setType(KnowledgeType t) { type_ = t; }
73
80 virtual AlpsEncoded* encode() const;
81
83 virtual AlpsReturnStatus encode(AlpsEncoded *encoded)
84 { return AlpsReturnStatusOk; }
85
95 virtual AlpsKnowledge* decode(AlpsEncoded& encoded) const;
96
98 inline AlpsEncoded* getEncoded() const { return encoded_; }
99 inline void setEncoded(AlpsEncoded* e) { encoded_ = e; }
100 };
101
102 //#############################################################################
103
104 #endif
KnowledgeType
int KnowledgeType
Type of knowledge like solution, node, cut...
Definition: Alps.h:86
AlpsKnowledge::~AlpsKnowledge
virtual ~AlpsKnowledge()
Definition: AlpsKnowledge.h:69
AlpsKnowledge::decode
virtual AlpsKnowledge * decode(AlpsEncoded &encoded) const
This method should decode and return a pointer to a brand new object, i.e., the method must create a ...
AlpsKnowledge::setEncoded
void setEncoded(AlpsEncoded *e)
Definition: AlpsKnowledge.h:99
AlpsReturnStatus
AlpsReturnStatus
Definition: Alps.h:118
AlpsKnowledge::operator=
AlpsKnowledge & operator=(const AlpsKnowledge &)
AlpsKnowledge::AlpsKnowledge
AlpsKnowledge()
Definition: AlpsKnowledge.h:68
AlpsEncoded
This data structure is to contain the packed form of an encodable knowledge.
Definition: AlpsEncoded.h:25
AlpsStrLess
A function object to perform lexicographic lexicographic comparison between two C style strings...
Definition: AlpsKnowledge.h:38
AlpsReturnStatusOk
Definition: Alps.h:119
Alps.h
AlpsKnowledgeTypeUndefined
Definition: Alps.h:94
AlpsKnowledge::getType
KnowledgeType getType()
Definition: AlpsKnowledge.h:71
AlpsKnowledge::type_
KnowledgeType type_
Definition: AlpsKnowledge.h:64
AlpsStrLess::operator()
bool operator()(const char *s1, const char *s2) const
Definition: AlpsKnowledge.h:40
AlpsKnowledge
The abstract base class of any user-defined class that Alps has to know about in order to encode/deco...
Definition: AlpsKnowledge.h:51
AlpsKnowledge::getEncoded
AlpsEncoded * getEncoded() const
Get/set encoded.
Definition: AlpsKnowledge.h:98
AlpsKnowledge::encode
virtual AlpsReturnStatus encode(AlpsEncoded *encoded)
Pack into a encode object.
Definition: AlpsKnowledge.h:83
AlpsEncoded.h
AlpsKnowledge::encoded_
AlpsEncoded * encoded_
The encoded object in an encoded form (could be compressed!)
Definition: AlpsKnowledge.h:60
AlpsKnowledge::encode
virtual AlpsEncoded * encode() const
This method should encode the content of the object and return a pointer to the encoded form...
AlpsKnowledge::setType
void setType(KnowledgeType t)
Definition: AlpsKnowledge.h:72