aGrUM
0.16.0
O3prmrInterpreter.h
Go to the documentation of this file.
1
30
#ifndef SKOORINTERPRETER_H
31
#define SKOORINTERPRETER_H
32
33
#ifndef DOXYGEN_SHOULD_SKIP_THIS
34
# include <
agrum/PRM/inference/PRMInference.h
>
35
# include <
agrum/PRM/o3prm/O3prmReader.h
>
36
# include <
agrum/PRM/o3prmr/O3prmrContext.h
>
37
38
# include <
agrum/core/errorsContainer.h
>
39
#endif // DOXYGEN_SHOULD_SKIP_THIS
40
41
namespace
gum
{
42
43
namespace
prm {
44
45
namespace
o3prmr {
46
50
class
SingleResult
{
51
public
:
52
std::string
label
;
53
float
p
;
54
};
55
59
class
QueryResult
{
60
public
:
61
double
time
;
62
std::string
command
;
63
std::vector< SingleResult >
values
;
64
};
65
70
class
O3prmrInterpreter
{
71
public
:
73
O3prmrInterpreter
();
75
~
O3prmrInterpreter
();
76
85
bool
interpretFile(
const
std::string& filename);
86
bool
interpretLine(
const
std::string& line);
87
89
const
gum::prm::PRM< double >
* prm()
const
;
91
const
gum::prm::PRMInference< double >
* inference()
const
;
95
const
std::vector< QueryResult >& results()
const
;
97
ErrorsContainer
errorsContainer()
const
;
98
100
O3prmrContext< double >
* getContext()
const
;
101
void
setContext(
O3prmrContext< double >
* context);
102
106
std::vector< std::string > getPaths()
const
;
107
void
addPath(std::string path);
108
void
clearPaths();
109
112
bool
isInSyntaxMode()
const
;
113
void
setSyntaxMode(
bool
f);
114
117
bool
isVerboseMode()
const
;
118
void
setVerboseMode(
bool
f);
119
123
Size
count()
const
;
126
Size
errors()
const
;
128
Size
warnings()
const
;
130
ParseError
error(
Idx
i)
const
;
132
void
showElegantErrors(std::ostream& o = std::cerr)
const
;
134
void
showElegantErrorsAndWarnings(std::ostream& o = std::cerr)
const
;
136
void
showErrorCounts(std::ostream& o = std::cerr)
const
;
137
138
private
:
139
bool
checkSemantic(
O3prmrContext< double >
* context);
140
bool
checkSetEngine(
SetEngineCommand
* command);
141
bool
checkSetGndEngine(
SetGndEngineCommand
* command);
142
bool
checkObserve(
ObserveCommand< double >
* command);
143
bool
checkUnobserve(
UnobserveCommand< double >
* command);
144
bool
checkQuery(
QueryCommand< double >
* command);
145
146
bool
interpret(
O3prmrContext< double >
* c);
147
bool
import
(
O3prmrContext< double >
* context, std::string
import
);
148
bool
observe(
const
ObserveCommand< double >
* command);
149
bool
unobserve(
const
UnobserveCommand< double >
* command);
150
void
query(
const
QueryCommand< double >
* command);
151
void
setEngine(
const
SetEngineCommand
* command);
152
void
setGndEngine(
const
SetGndEngineCommand
* command);
153
154
std::string findSystemName(std::string& s);
155
std::string findInstanceName(std::string& s,
156
const
gum::prm::PRMSystem< double >
& sys);
157
std::string
158
findAttributeName(
const
std::string& s,
159
const
gum::prm::PRMInstance< double >
& instance);
160
const
PRMSystem< double >
& system(std::string& ident);
161
void
generateInfEngine(
const
gum::prm::PRMSystem< double >
& sys);
162
163
void
addError(std::string msg);
164
void
addWarning(std::string msg);
165
166
std::string __readFile(
const
std::string& file);
167
168
O3prmrContext< double >
*
m_context
;
169
gum::prm::o3prm::O3prmReader< double >
*
m_reader
;
170
std::vector< std::string >
m_paths
;
171
gum::BayesNet< double >
*
m_bn
;
172
// Don't delete this, the m_inf_map will do it
173
gum::prm::PRMInference< double >
*
m_inf
;
174
HashTable< const PRMSystem< double >
*,
PRMInference< double >
* >
m_inf_map
;
175
std::string
m_engine
;
176
std::string
m_bn_engine
;
177
std::vector< QueryResult >
m_results
;
178
gum::ErrorsContainer
m_errors
;
179
bool
m_syntax_flag
;
180
bool
m_verbose
;
181
std::ostream&
m_log
;
182
int
m_current_line
;
183
185
// gum::BayesNetInference<gum::prm::prm_float>* bn;
186
187
};
// class O3prmrInterpreter
188
189
}
// namespace o3prmr
190
}
// namespace prm
191
}
// namespace gum
192
193
#endif // GUM_SKOORINTERPRETER_H
gum::BayesNet< double >
O3prmrContext.h
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
errorsContainer.h
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
gum::prm::o3prmr::SingleResult
Definition:
O3prmrInterpreter.h:50
gum::prm::o3prmr::QueryResult::command
std::string command
Definition:
O3prmrInterpreter.h:62
gum::prm::o3prmr::O3prmrInterpreter::m_bn
gum::BayesNet< double > * m_bn
Definition:
O3prmrInterpreter.h:171
gum::prm::PRMInstance
An PRMInstance is a Bayesian Network fragment defined by a Class and used in a PRMSystem.
Definition:
PRMInstance.h:63
gum::prm::o3prmr::QueryCommand
Definition:
O3prmrContext.h:161
gum::ParseError
This class is used to represent parsing errors for the different parser implemented in aGrUM...
Definition:
errorsContainer.h:50
gum::prm::o3prmr::O3prmrInterpreter::m_current_line
int m_current_line
Definition:
O3prmrInterpreter.h:182
gum::ErrorsContainer
This class is used contain and manipulate gum::ParseError.
Definition:
errorsContainer.h:161
gum
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition:
agrum.h:25
gum::prm::o3prmr::UnobserveCommand
Definition:
O3prmrContext.h:144
gum::prm::o3prm::O3prmReader< double >
gum::HashTable
The class for generic Hash Tables.
Definition:
hashTable.h:679
gum::prm::o3prmr::O3prmrInterpreter::m_bn_engine
std::string m_bn_engine
Definition:
O3prmrInterpreter.h:176
gum::prm::o3prmr::O3prmrInterpreter::m_reader
gum::prm::o3prm::O3prmReader< double > * m_reader
Definition:
O3prmrInterpreter.h:169
gum::prm::o3prmr::SingleResult::p
float p
Definition:
O3prmrInterpreter.h:53
gum::prm::o3prmr::SingleResult::label
std::string label
Definition:
O3prmrInterpreter.h:52
O3prmReader.h
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
gum::prm::o3prmr::O3prmrInterpreter::m_log
std::ostream & m_log
Definition:
O3prmrInterpreter.h:181
gum::prm::o3prmr::QueryResult::values
std::vector< SingleResult > values
Definition:
O3prmrInterpreter.h:63
gum::prm::o3prmr::SetEngineCommand
Definition:
O3prmrContext.h:90
PRMInference.h
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
gum::prm::PRMSystem< double >
gum::prm::o3prmr::O3prmrInterpreter::m_errors
gum::ErrorsContainer m_errors
Definition:
O3prmrInterpreter.h:178
gum::prm::o3prmr::O3prmrInterpreter::m_inf
gum::prm::PRMInference< double > * m_inf
Definition:
O3prmrInterpreter.h:173
gum::prm::o3prmr::O3prmrInterpreter::m_paths
std::vector< std::string > m_paths
Definition:
O3prmrInterpreter.h:170
gum::prm::o3prmr::ObserveCommand
Definition:
O3prmrContext.h:119
gum::prm::o3prmr::O3prmrInterpreter
Represents a O3PRMR context.
Definition:
O3prmrInterpreter.h:70
gum::prm::o3prmr::O3prmrContext< double >
gum::prm::PRMInference< double >
gum::prm::PRM< double >
gum::prm::o3prmr::QueryResult::time
double time
Definition:
O3prmrInterpreter.h:61
gum::prm::o3prmr::O3prmrInterpreter::m_syntax_flag
bool m_syntax_flag
Definition:
O3prmrInterpreter.h:179
gum::prm::o3prmr::O3prmrInterpreter::m_verbose
bool m_verbose
Definition:
O3prmrInterpreter.h:180
gum::Idx
Size Idx
Type for indexes.
Definition:
types.h:53
gum::prm::o3prmr::O3prmrInterpreter::m_engine
std::string m_engine
Definition:
O3prmrInterpreter.h:175
gum::Size
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition:
types.h:48
gum::prm::o3prmr::QueryResult
Definition:
O3prmrInterpreter.h:59
gum::prm::o3prmr::SetGndEngineCommand
Definition:
O3prmrContext.h:104
gum::prm::o3prmr::O3prmrInterpreter::m_inf_map
HashTable< const PRMSystem< double > *, PRMInference< double > *> m_inf_map
Definition:
O3prmrInterpreter.h:174
gum::prm::o3prmr::O3prmrInterpreter::m_results
std::vector< QueryResult > m_results
Definition:
O3prmrInterpreter.h:177
gum::prm::o3prmr::O3prmrInterpreter::m_context
O3prmrContext< double > * m_context
Definition:
O3prmrInterpreter.h:168