Alps  2.0.2
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  * Aykut Bulut, Lehigh University *
11  * Ted Ralphs, Lehigh University *
12  * *
13  * Conceptual Design: *
14  * *
15  * Yan Xu, Lehigh University *
16  * Ted Ralphs, Lehigh University *
17  * Laszlo Ladanyi, IBM T.J. Watson Research Center *
18  * Matthew Saltzman, Clemson University *
19  * *
20  * *
21  * Copyright (C) 2001-2023, Lehigh University, Yan Xu, Aykut Bulut, and *
22  * Ted Ralphs. *
23  * All Rights Reserved. *
24  *===========================================================================*/
25 
26 
27 #ifndef AlpsKnowledge_h_
28 #define AlpsKnowledge_h_
29 
30 #include <map>
31 #include <memory>
32 #include <typeinfo>
33 
34 #include "Alps.h"
35 #include "AlpsEncoded.h"
36 
38 
44 struct AlpsStrLess {
45  inline bool operator()(const char* s1, const char* s2) const {
46  return strcmp(s1, s2) < 0;
47  }
48 };
49 
50 
65 public:
67 
68 public:
70 
76  virtual ~AlpsKnowledge() {}
78 
80 
81  AlpsKnowledgeType getType() const { return type_; }
84  void setType(AlpsKnowledgeType t) { type_ = t; }
88  AlpsKnowledgeBroker const * broker() const { return broker_; }
92 
94 
95  AlpsEncoded * encode() const;
103  virtual AlpsReturnStatus encode(AlpsEncoded * encoded) const;
107  virtual AlpsKnowledge * decode(AlpsEncoded & encoded) const = 0;
113  virtual AlpsReturnStatus decodeToSelf(AlpsEncoded & encoded);
115 
116 private:
118  AlpsKnowledge(AlpsKnowledge const &);
121 
122 };
123 
124 #endif
AlpsKnowledge::type_
AlpsKnowledgeType type_
Definition: AlpsKnowledge.h:64
AlpsKnowledge::broker
const AlpsKnowledgeBroker * broker() const
Get pointer to the knowledge broker.
Definition: AlpsKnowledge.h:88
AlpsReturnStatus
AlpsReturnStatus
Definition: Alps.h:261
AlpsKnowledge::broker_
AlpsKnowledgeBroker * broker_
Definition: AlpsKnowledge.h:66
AlpsKnowledge::decode
virtual AlpsKnowledge * decode(AlpsEncoded &encoded) const =0
Decode the given AlpsEncoded object into a new AlpsKnowledge object and return a pointer to it.
AlpsKnowledge::operator=
AlpsKnowledge & operator=(AlpsKnowledge const &)
Disable copy assignment operator.
AlpsEncoded
Definition: AlpsEncoded.h:64
Alps.h
AlpsKnowledge::getType
AlpsKnowledgeType getType() const
Get knowledge type.
Definition: AlpsKnowledge.h:82
AlpsKnowledgeTypeUndefined
@ AlpsKnowledgeTypeUndefined
Definition: Alps.h:230
AlpsKnowledgeType
AlpsKnowledgeType
Type of knowledge like solution, node, cut...
Definition: Alps.h:223
AlpsKnowledge::setBroker
void setBroker(AlpsKnowledgeBroker *broker)
Set knowledge broker.
Definition: AlpsKnowledge.h:90
AlpsKnowledge::setType
void setType(AlpsKnowledgeType t)
Set knowledge type.
Definition: AlpsKnowledge.h:84
AlpsStrLess::operator()
bool operator()(const char *s1, const char *s2) const
Definition: AlpsKnowledge.h:45
AlpsKnowledge::broker
AlpsKnowledgeBroker * broker()
Get pointer to the knowledge broker.
Definition: AlpsKnowledge.h:86
AlpsKnowledge
The abstract base class of Alps knowledges generated during the search.
Definition: AlpsKnowledge.h:63
AlpsKnowledgeBroker
The base class of knowledge broker class.
Definition: AlpsKnowledgeBroker.h:52
AlpsKnowledge::encode
AlpsEncoded * encode() const
Encode the content of this into an AlpsEncoded object and return a pointer to it.
AlpsEncoded.h
AlpsKnowledge::AlpsKnowledge
AlpsKnowledge(AlpsKnowledgeType type)
Definition: AlpsKnowledge.h:73
AlpsKnowledge::AlpsKnowledge
AlpsKnowledge()
Default constructor.
Definition: AlpsKnowledge.h:72
AlpsStrLess
A function object to perform lexicographic lexicographic comparison between two C style strings.
Definition: AlpsKnowledge.h:44
AlpsKnowledge::~AlpsKnowledge
virtual ~AlpsKnowledge()
Destructor.
Definition: AlpsKnowledge.h:76
AlpsKnowledge::decodeToSelf
virtual AlpsReturnStatus decodeToSelf(AlpsEncoded &encoded)
Decode the given AlpsEncoded object into this.