00001 /*===========================================================================* 00002 * This file is part of the Abstract Library for Parallel Search (ALPS). * 00003 * * 00004 * ALPS is distributed under the Common Public License as part of the * 00005 * COIN-OR repository (http://www.coin-or.org). * 00006 * * 00007 * Authors: * 00008 * * 00009 * Yan Xu, Lehigh University * 00010 * Ted Ralphs, Lehigh University * 00011 * * 00012 * Conceptual Design: * 00013 * * 00014 * Yan Xu, Lehigh University * 00015 * Ted Ralphs, Lehigh University * 00016 * Laszlo Ladanyi, IBM T.J. Watson Research Center * 00017 * Matthew Saltzman, Clemson University * 00018 * * 00019 * * 00020 * Copyright (C) 2001-2007, Lehigh University, Yan Xu, and Ted Ralphs. * 00021 *===========================================================================*/ 00022 00023 #ifndef AlpsKnowledge_h 00024 #define AlpsKnowledge_h 00025 00026 #include <map> 00027 #include <memory> 00028 #include <typeinfo> 00029 00030 #include "Alps.h" 00031 #include "AlpsEncoded.h" 00032 00033 //############################################################################# 00036 //############################################################################# 00037 00038 struct AlpsStrLess 00039 { 00040 inline bool operator()(const char* s1, const char* s2) const { 00041 return strcmp(s1, s2) < 0; 00042 } 00043 }; 00044 00045 //############################################################################# 00049 //############################################################################# 00050 00051 class AlpsKnowledge { 00052 00053 private: 00054 AlpsKnowledge(const AlpsKnowledge&); 00055 AlpsKnowledge& operator=(const AlpsKnowledge&); 00056 00058 //FIXME: For now, we just use a regular pointer here to get it to compile. 00059 //CoinPtr<AlpsEncoded> encoded_; 00060 AlpsEncoded* encoded_; 00061 00062 protected: 00063 00064 KnowledgeType type_; 00065 00066 public: 00067 00068 AlpsKnowledge() : encoded_(0), type_(AlpsKnowledgeTypeUndefined) {} 00069 virtual ~AlpsKnowledge() {} 00070 00071 KnowledgeType getType() { return type_; } 00072 void setType(KnowledgeType t) { type_ = t; } 00073 00080 virtual AlpsEncoded* encode() const; 00081 00083 virtual AlpsReturnStatus encode(AlpsEncoded *encoded) 00084 { return AlpsReturnStatusOk; } 00085 00095 virtual AlpsKnowledge* decode(AlpsEncoded& encoded) const; 00096 00098 inline AlpsEncoded* getEncoded() const { return encoded_; } 00099 inline void setEncoded(AlpsEncoded* e) { encoded_ = e; } 00100 }; 00101 00102 //############################################################################# 00103 00104 #endif