Alps 1.5.7
Loading...
Searching...
No Matches
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-2019, 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
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
53private:
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
62protected:
63
65
66public:
67
69 virtual ~AlpsKnowledge() {}
70
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
AlpsReturnStatus
Definition Alps.h:118
@ AlpsReturnStatusOk
Definition Alps.h:119
@ AlpsKnowledgeTypeUndefined
Definition Alps.h:94
int KnowledgeType
Type of knowledge like solution, node, cut...
Definition Alps.h:86
This data structure is to contain the packed form of an encodable knowledge.
Definition AlpsEncoded.h:25
The abstract base class of any user-defined class that Alps has to know about in order to encode/deco...
KnowledgeType getType()
void setType(KnowledgeType t)
virtual ~AlpsKnowledge()
KnowledgeType type_
virtual AlpsEncoded * encode() const
This method should encode the content of the object and return a pointer to the encoded form.
void setEncoded(AlpsEncoded *e)
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 ...
AlpsEncoded * getEncoded() const
Get/set encoded.
virtual AlpsReturnStatus encode(AlpsEncoded *encoded)
Pack into a encode object.
A function object to perform lexicographic lexicographic comparison between two C style strings.
bool operator()(const char *s1, const char *s2) const