aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
factorySimulator.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 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-2025 *
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#ifndef GUM_FACTORY_SIMULATOR_H
50#define GUM_FACTORY_SIMULATOR_H
51//======================================================================
52//======================================================================
53//======================================================================
55
56//======================================================================
57//======================================================================
58
59namespace gum {
60
61
62 enum FactorySimulationLandmark : Idx { HOME = 0, WORK = 1, THEATER = 2, CLUB = 3, Factory = 4 };
63
71
79
89
90 // clang-format off
97 // clang-format on
98
100 public:
101 // ===========================================================================
103 // ===========================================================================
105
110
115
117
118 // ===========================================================================
120 // ===========================================================================
122
123 protected:
126
127 public:
130 double reward();
132
134
135 // ===========================================================================
137 // ===========================================================================
139
141 return _primeMap_.second(mainVar);
142 }
143
148
152
154
155 // ===========================================================================
157 // ===========================================================================
159
160 const std::string& actionName(Idx actionId) { return *_actionMap_[actionId]; }
161
164
166
168
169
170 private:
171 void _goNorth_();
172 void _goEast_();
173 void _goSouth_();
174 void _goWest_();
175 void _pickUp_();
176 void _putDown_();
177 void _fillUp_();
178
187
190 HashTable< Idx, std::string* > _actionMap_; // __actionMap.insert ( actionId,
191 // new std::string ( action ) );
193 };
194
195} /* namespace gum */
196
197
198#endif // GUM_FACTORY_SIMULATOR_H
Class for simulating a discrete time stochastic process.
AbstractSimulator()
Default constructor.
Set of pairs of elements with fast search for both elements.
Definition bijection.h:1594
Base class for discrete random variable.
SequenceIteratorSafe< const DiscreteVariable * > beginVariables()
Iteration over the variables of the simulated probleme.
DiscreteVariable * _passengerDest_
Instantiation randomState_()
Choses a random state as the first test for a run.
SequenceIteratorSafe< Idx > endActions()
Iteration over the variables of the simulated probleme.
FactorySimulationAction _lastAction_
DiscreteVariable * _passengerPos_
FactorySimulator()
Default constructor.
bool hasReachEnd()
Choses a random state as the first test for a run.
Sequence< const DiscreteVariable * > _FactoryVars_
Variables data structures.
const std::string & actionName(Idx actionId)
Iteration over the variables of the simulated probleme.
const DiscreteVariable * primeVar(const DiscreteVariable *mainVar)
Iteration over the variables of the simulated probleme.
HashTable< Idx, std::string * > _actionMap_
void perform(Idx)
Choses a random state as the first test for a run.
SequenceIteratorSafe< const DiscreteVariable * > endVariables()
Iteration over the variables of the simulated probleme.
DiscreteVariable * _xPos_
DiscreteVariable * _fuelLevel_
double reward()
Choses a random state as the first test for a run.
Bijection< const DiscreteVariable *, const DiscreteVariable * > _primeMap_
SequenceIteratorSafe< Idx > beginActions()
Iteration over the variables of the simulated probleme.
~FactorySimulator()
Default destructor.
DiscreteVariable * _yPos_
Sequence< Idx > _FactoryActions_
Actions.
The class for generic Hash Tables.
Definition hashTable.h:637
Class for assigning/browsing values to tuples of discrete variables.
Safe iterators for Sequence.
Definition sequence.h:1134
The generic class for storing (ordered) sequences of objects.
Definition sequence.h:972
Size Idx
Type for indexes.
Definition types.h:79
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
FactorySimulationLandmark
FactorySimulationAction
FactorySimulationLandmarkY
FactorySimulationLandmarkX