aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
statesChecker.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief Headers of the States Checker class.
25  *
26  * @author Pierre-Henri WUILLEMIN(@LIP6) and Jean-Christophe MAGNAN and Christophe
27  * GONZALES(@AMU)
28  */
29 
30 // =========================================================================
31 #ifndef GUM_STATES_CHECKER_H
32 #define GUM_STATES_CHECKER_H
33 // =========================================================================
34 // =========================================================================
35 #include <agrum/tools/core/sequence.h>
36 #include <agrum/tools/multidim/implementations/multiDimFunctionGraph.h>
37 // =========================================================================
38 
39 namespace gum {
40 
41 
42  /**
43  * @class StatesChecker statesChecker.h
44  * <agrum/FMDP/simulation/statesChecker.h>
45  * @brief Provides the necessary to check whether or not states have been
46  * already visited.
47  * @ingroup fmdp_group
48  */
49  class StatesChecker {
50  public:
51  // ==========================================================================
52  /// @name Constructor & destructor.
53  // ==========================================================================
54  /// @{
55 
56  /**
57  * Default constructor
58  */
59  StatesChecker();
60 
61  /**
62  * Default destructor
63  */
64  ~StatesChecker();
65 
66  /// @}
67 
68  // ==========================================================================
69  /// @name Miscelleanous methods
70  // ==========================================================================
71  /// @{
72 
73  bool checkState(const Instantiation& state) { return _checker_->get(state); }
74 
75  void addState(const Instantiation&);
76 
77  Idx nbVisitedStates() { return _nbVisitedStates_; }
78 
79  void reset(const Instantiation&);
80 
81  /// @}
82 
83  private:
84  void _insertState_(const Instantiation&, NodeId, Idx);
85 
87 
90 
92  };
93 } /* namespace gum */
94 
95 #endif // GUM_STATES_CHECKER_H
bool checkState(const Instantiation &state)
Definition: statesChecker.h:73
~StatesChecker()
Default destructor.
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
void _insertState_(const Instantiation &, NodeId, Idx)
void addState(const Instantiation &)
StatesChecker()
Default constructor.
Set< Instantiation *> _visitedStates_
Definition: statesChecker.h:91
void reset(const Instantiation &)
<agrum/FMDP/simulation/statesChecker.h>
Definition: statesChecker.h:49
MultiDimFunctionGraph< bool > * _checker_
Definition: statesChecker.h:88