aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
statesCounter.h
Go to the documentation of this file.
1
/****************************************************************************
2
* This file is part of the aGrUM/pyAgrum library. *
3
* *
4
* Copyright (c) 2005-2026 by *
5
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
6
* - Christophe GONZALES(_at_AMU) *
7
* *
8
* The aGrUM/pyAgrum library is free software; you can redistribute it *
9
* and/or modify it under the terms of either : *
10
* *
11
* - the GNU Lesser General Public License as published by *
12
* the Free Software Foundation, either version 3 of the License, *
13
* or (at your option) any later version, *
14
* - the MIT license (MIT), *
15
* - or both in dual license, as here. *
16
* *
17
* (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18
* *
19
* This aGrUM/pyAgrum library is distributed in the hope that it will be *
20
* useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26
* OTHER DEALINGS IN THE SOFTWARE. *
27
* *
28
* See LICENCES for more details. *
29
* *
30
* SPDX-FileCopyrightText: Copyright 2005-2026 *
31
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
32
* - Christophe GONZALES(_at_AMU) *
33
* SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34
* *
35
* Contact : info_at_agrum_dot_org *
36
* homepage : http://agrum.gitlab.io *
37
* gitlab : https://gitlab.com/agrumery/agrum *
38
* *
39
****************************************************************************/
40
41
49
50
// =========================================================================
51
#ifndef GUM_STATES_COUNTER_H
52
#define GUM_STATES_COUNTER_H
53
// =========================================================================
54
// =========================================================================
55
#include <
agrum/FMDP/learning/datastructure/IVisitableGraphLearner.h
>
56
57
// =========================================================================
58
// =========================================================================
59
60
namespace
gum
{
61
62
70
class
GUM_PUBLIC_FMDP
StatesCounter
:
public
IVisitableGraphLearner
{
71
public
:
72
// ==========================================================================
74
// ==========================================================================
76
80
StatesCounter
();
81
85
~StatesCounter
()
override
;
86
88
89
// ==========================================================================
91
// ==========================================================================
93
94
void
incState
(
const
Instantiation
&);
95
96
void
reset
(
const
Instantiation
&);
97
98
const
MultiDimFunctionGraph< int >
*
counter
();
99
101
102
103
// ###################################################################
105
// ###################################################################
107
108
public
:
109
// ==========================================================================
111
// ==========================================================================
112
NodeId
root
()
const override
;
113
114
// ==========================================================================
116
// ==========================================================================
117
bool
isTerminal
(
NodeId
ni)
const override
;
118
119
// ==========================================================================
121
// ==========================================================================
122
const
DiscreteVariable
*
nodeVar
(
NodeId
ni)
const override
;
123
124
// ==========================================================================
126
// ==========================================================================
127
NodeId
nodeSon
(
NodeId
ni,
Idx
modality)
const override
;
128
129
// ==========================================================================;
130
131
Idx
nodeNbObservation
(
NodeId
ni)
const override
;
132
133
void
insertSetOfVars
(
MultiDimFunctionGraph< double >
* ret)
const override
;
134
136
137
private
:
138
void
_incState_
(
const
Instantiation
&,
NodeId
,
Idx
,
Size
);
139
140
MultiDimFunctionGraph< Size >
*
_counter_
;
141
142
Set< Instantiation* >
_visitedStates_
;
143
};
144
}
/* namespace gum */
145
146
#ifndef GUM_NO_INLINE
147
# include <
agrum/FMDP/simulation/statesCounter_inl.h
>
148
#endif
// GUM_NO_INLINE
149
#endif
// GUM_STATES_COUNTER_H
IVisitableGraphLearner.h
Headers of the Learning Strategy interface.
gum::DiscreteVariable
Base class for discrete random variable.
Definition
discreteVariable.h:80
gum::IVisitableGraphLearner
<agrum/FMDP/SDyna/IVisitableGraphLearner.h>
Definition
IVisitableGraphLearner.h:71
gum::Instantiation
Class for assigning/browsing values to tuples of discrete variables.
Definition
instantiation.h:102
gum::MultiDimFunctionGraph
Class implementingting a function graph.
Definition
multiDimFunctionGraph.h:91
gum::Set
Representation of a set.
Definition
set.h:129
gum::StatesCounter::_incState_
void _incState_(const Instantiation &, NodeId, Idx, Size)
Definition
statesCounter.cpp:100
gum::StatesCounter::counter
const MultiDimFunctionGraph< int > * counter()
gum::StatesCounter::root
NodeId root() const override
Definition
statesCounter_inl.h:48
gum::StatesCounter::StatesCounter
StatesCounter()
Default constructor.
Definition
statesCounter.cpp:54
gum::StatesCounter::insertSetOfVars
void insertSetOfVars(MultiDimFunctionGraph< double > *ret) const override
Definition
statesCounter_inl.h:62
gum::StatesCounter::isTerminal
bool isTerminal(NodeId ni) const override
Definition
statesCounter_inl.h:50
gum::StatesCounter::incState
void incState(const Instantiation &)
Definition
statesCounter.cpp:85
gum::StatesCounter::nodeSon
NodeId nodeSon(NodeId ni, Idx modality) const override
Definition
statesCounter_inl.h:56
gum::StatesCounter::nodeVar
const DiscreteVariable * nodeVar(NodeId ni) const override
Definition
statesCounter_inl.h:52
gum::StatesCounter::nodeNbObservation
Idx nodeNbObservation(NodeId ni) const override
Definition
statesCounter_inl.h:60
gum::StatesCounter::reset
void reset(const Instantiation &)
Definition
statesCounter.cpp:69
gum::StatesCounter::_counter_
MultiDimFunctionGraph< Size > * _counter_
Definition
statesCounter.h:140
gum::StatesCounter::_visitedStates_
Set< Instantiation * > _visitedStates_
Definition
statesCounter.h:142
gum::Size
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition
types.h:74
gum::Idx
Size Idx
Type for indexes.
Definition
types.h:79
gum::NodeId
Size NodeId
Type for node ids.
Definition
graphElements.h:117
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
statesCounter_inl.h
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0