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 
52 
53 private:
56 
58  //FIXME: For now, we just use a regular pointer here to get it to compile.
59  //CoinPtr<AlpsEncoded> encoded_;
61 
62 protected:
63 
65 
66 public:
67 
69  virtual ~AlpsKnowledge() {}
70 
71  KnowledgeType getType() { return type_; }
72  void setType(KnowledgeType t) { type_ = t; }
73 
80  virtual AlpsEncoded* encode() const;
81 
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
int KnowledgeType
Type of knowledge like solution, node, cut...
Definition: Alps.h:86
virtual ~AlpsKnowledge()
Definition: AlpsKnowledge.h:69
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 ...
void setEncoded(AlpsEncoded *e)
Definition: AlpsKnowledge.h:99
AlpsReturnStatus
Definition: Alps.h:118
AlpsKnowledge & operator=(const AlpsKnowledge &)
This data structure is to contain the packed form of an encodable knowledge.
Definition: AlpsEncoded.h:25
A function object to perform lexicographic lexicographic comparison between two C style strings...
Definition: AlpsKnowledge.h:38
KnowledgeType getType()
Definition: AlpsKnowledge.h:71
KnowledgeType type_
Definition: AlpsKnowledge.h:64
bool operator()(const char *s1, const char *s2) const
Definition: AlpsKnowledge.h:40
The abstract base class of any user-defined class that Alps has to know about in order to encode/deco...
Definition: AlpsKnowledge.h:51
AlpsEncoded * getEncoded() const
Get/set encoded.
Definition: AlpsKnowledge.h:98
virtual AlpsReturnStatus encode(AlpsEncoded *encoded)
Pack into a encode object.
Definition: AlpsKnowledge.h:83
AlpsEncoded * encoded_
The encoded object in an encoded form (could be compressed!)
Definition: AlpsKnowledge.h:60
virtual AlpsEncoded * encode() const
This method should encode the content of the object and return a pointer to the encoded form...
void setType(KnowledgeType t)
Definition: AlpsKnowledge.h:72