aGrUM  0.16.0
gum::FactorySimulator Class Reference

A class to simulate the Factory problem. More...

#include <agrum/FMDP/simulation/factorySimulator.h>

+ Inheritance diagram for gum::FactorySimulator:
+ Collaboration diagram for gum::FactorySimulator:

Public Attributes

Instantiation _currentState
 Tha state in which the system currently is. More...
 
Instantiation _endState
 

Public Member Functions

Constructors, Destructors.
 FactorySimulator ()
 Default constructor. More...
 
 ~FactorySimulator ()
 Default destructor. More...
 
Variables
const DiscreteVariableprimeVar (const DiscreteVariable *mainVar)
 Iteration over the variables of the simulated probleme. More...
 
SequenceIteratorSafe< const DiscreteVariable *> beginVariables ()
 Iteration over the variables of the simulated probleme. More...
 
SequenceIteratorSafe< const DiscreteVariable *> endVariables ()
 Iteration over the variables of the simulated probleme. More...
 
Actions
const std::string & actionName (Idx actionId)
 Iteration over the variables of the simulated probleme. More...
 
SequenceIteratorSafe< IdxbeginActions ()
 Iteration over the variables of the simulated probleme. More...
 
SequenceIteratorSafe< IdxendActions ()
 Iteration over the variables of the simulated probleme. More...
 
INLINE void setInitialState (const Instantiation &initialState)
 Sets the intial statefrom which we begun the simulation. More...
 
void setInitialStateRandomly ()
 Sets the intial statefrom which we begun the simulation. More...
 
INLINE void setEndState (const Instantiation &endState)
 Sets the final states upon which a run is over. More...
 
INLINE const InstantiationcurrentState ()
 Sets the intial statefrom which we begun the simulation. More...
 
bool hasReachEnd ()
 Choses a random state as the first test for a run. More...
 
double reward ()
 Choses a random state as the first test for a run. More...
 
void perform (Idx)
 Choses a random state as the first test for a run. More...
 
Instantiation _randomState ()
 Choses a random state as the first test for a run. More...
 

Detailed Description

A class to simulate the Factory problem.

Definition at line 83 of file factorySimulator.h.

Constructor & Destructor Documentation

◆ FactorySimulator()

gum::FactorySimulator::FactorySimulator ( )

Default constructor.

◆ ~FactorySimulator()

gum::FactorySimulator::~FactorySimulator ( )

Default destructor.

Member Function Documentation

◆ __fillUp()

void gum::FactorySimulator::__fillUp ( )
private

Referenced by endActions().

+ Here is the caller graph for this function:

◆ __goEast()

void gum::FactorySimulator::__goEast ( )
private

Referenced by endActions().

+ Here is the caller graph for this function:

◆ __goNorth()

void gum::FactorySimulator::__goNorth ( )
private

Referenced by endActions().

+ Here is the caller graph for this function:

◆ __goSouth()

void gum::FactorySimulator::__goSouth ( )
private

Referenced by endActions().

+ Here is the caller graph for this function:

◆ __goWest()

void gum::FactorySimulator::__goWest ( )
private

Referenced by endActions().

+ Here is the caller graph for this function:

◆ __pickUp()

void gum::FactorySimulator::__pickUp ( )
private

Referenced by endActions().

+ Here is the caller graph for this function:

◆ __putDown()

void gum::FactorySimulator::__putDown ( )
private

Referenced by endActions().

+ Here is the caller graph for this function:

◆ _randomState()

Instantiation gum::FactorySimulator::_randomState ( )
protectedvirtual

Choses a random state as the first test for a run.

Reimplemented from gum::AbstractSimulator.

◆ actionName()

const std::string& gum::FactorySimulator::actionName ( Idx  actionId)
inlinevirtual

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 143 of file factorySimulator.h.

References __actionMap.

143 { return *__actionMap[actionId]; }
HashTable< Idx, std::string *> __actionMap

◆ beginActions()

SequenceIteratorSafe< Idx > gum::FactorySimulator::beginActions ( )
inlinevirtual

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 146 of file factorySimulator.h.

References __FactoryActions, and gum::SequenceImplementation< Key, Alloc, Gen >::beginSafe().

146  {
147  return __FactoryActions.beginSafe();
148  }
Sequence< Idx > __FactoryActions
Actions.
iterator_safe beginSafe() const
Returns a safe begin iterator.
Definition: sequence_tpl.h:627
+ Here is the call graph for this function:

◆ beginVariables()

SequenceIteratorSafe< const DiscreteVariable* > gum::FactorySimulator::beginVariables ( )
inlinevirtual

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 129 of file factorySimulator.h.

References __FactoryVars.

129  {
130  return __FactoryVars.beginSafe();
131  }
Sequence< const DiscreteVariable *> __FactoryVars
Variables data structures.

◆ currentState()

INLINE const Instantiation& gum::AbstractSimulator::currentState ( )
inlineinherited

Sets the intial statefrom which we begun the simulation.

Definition at line 92 of file abstractSimulator.h.

References gum::AbstractSimulator::_currentState, gum::AbstractSimulator::actionName(), gum::AbstractSimulator::beginActions(), gum::AbstractSimulator::beginVariables(), gum::AbstractSimulator::endActions(), gum::AbstractSimulator::endVariables(), gum::AbstractSimulator::perform(), gum::AbstractSimulator::primeVar(), and gum::AbstractSimulator::reward().

92 { return _currentState; }
Instantiation _currentState
Tha state in which the system currently is.
+ Here is the call graph for this function:

◆ endActions()

SequenceIteratorSafe< Idx > gum::FactorySimulator::endActions ( )
inlinevirtual

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 149 of file factorySimulator.h.

References __FactoryActions, __fillUp(), __goEast(), __goNorth(), __goSouth(), __goWest(), __pickUp(), __putDown(), and gum::SequenceImplementation< Key, Alloc, Gen >::endSafe().

149 { return __FactoryActions.endSafe(); }
const iterator_safe & endSafe() const noexcept
Returns the safe end iterator.
Definition: sequence_tpl.h:634
Sequence< Idx > __FactoryActions
Actions.
+ Here is the call graph for this function:

◆ endVariables()

SequenceIteratorSafe< const DiscreteVariable* > gum::FactorySimulator::endVariables ( )
inlinevirtual

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 132 of file factorySimulator.h.

References __FactoryVars.

132  {
133  return __FactoryVars.endSafe();
134  }
Sequence< const DiscreteVariable *> __FactoryVars
Variables data structures.

◆ hasReachEnd()

bool gum::FactorySimulator::hasReachEnd ( )
virtual

Choses a random state as the first test for a run.

Reimplemented from gum::AbstractSimulator.

◆ perform()

void gum::FactorySimulator::perform ( Idx  )
virtual

Choses a random state as the first test for a run.

Implements gum::AbstractSimulator.

◆ primeVar()

const DiscreteVariable* gum::FactorySimulator::primeVar ( const DiscreteVariable mainVar)
inlinevirtual

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 124 of file factorySimulator.h.

References __primeMap.

124  {
125  return __primeMap.second(mainVar);
126  }
Bijection< const DiscreteVariable *, const DiscreteVariable *> __primeMap

◆ reward()

double gum::FactorySimulator::reward ( )
virtual

Choses a random state as the first test for a run.

Implements gum::AbstractSimulator.

◆ setEndState()

INLINE void gum::AbstractSimulator::setEndState ( const Instantiation endState)
inlineinherited

Sets the final states upon which a run is over.

Definition at line 84 of file abstractSimulator.h.

References gum::AbstractSimulator::_endState, and gum::AbstractSimulator::hasReachEnd().

84  {
85  _endState = endState;
86  }
+ Here is the call graph for this function:

◆ setInitialState()

INLINE void gum::AbstractSimulator::setInitialState ( const Instantiation initialState)
inlineinherited

Sets the intial statefrom which we begun the simulation.

Definition at line 73 of file abstractSimulator.h.

References gum::AbstractSimulator::_currentState, gum::AbstractSimulator::_randomState(), and gum::AbstractSimulator::setInitialStateRandomly().

73  {
74  _currentState = initialState;
75  }
Instantiation _currentState
Tha state in which the system currently is.
+ Here is the call graph for this function:

◆ setInitialStateRandomly()

void gum::AbstractSimulator::setInitialStateRandomly ( )
inherited

Sets the intial statefrom which we begun the simulation.

Definition at line 58 of file abstractSimulator.cpp.

References gum::AbstractSimulator::_currentState, gum::AbstractSimulator::_randomState(), and gum::AbstractSimulator::hasReachEnd().

Referenced by gum::AbstractSimulator::setInitialState().

58  {
59  bool hre = true;
60  while (hre) {
62  hre = hasReachEnd();
63  }
64  }
virtual bool hasReachEnd()
Tests if end state has been reached.
Instantiation _currentState
Tha state in which the system currently is.
virtual Instantiation _randomState()
Choses a random state as the first test for a run.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ __actionMap

HashTable< Idx, std::string* > gum::FactorySimulator::__actionMap
private

Definition at line 175 of file factorySimulator.h.

Referenced by actionName().

◆ __FactoryActions

Sequence< Idx > gum::FactorySimulator::__FactoryActions
private

Actions.

Definition at line 174 of file factorySimulator.h.

Referenced by beginActions(), and endActions().

◆ __FactoryVars

Sequence< const DiscreteVariable* > gum::FactorySimulator::__FactoryVars
private

Variables data structures.

Definition at line 165 of file factorySimulator.h.

Referenced by beginVariables(), and endVariables().

◆ __fuelLevel

DiscreteVariable* gum::FactorySimulator::__fuelLevel
private

Definition at line 171 of file factorySimulator.h.

◆ __lastAction

FactorySimulationAction gum::FactorySimulator::__lastAction
private

Definition at line 177 of file factorySimulator.h.

◆ __passengerDest

DiscreteVariable* gum::FactorySimulator::__passengerDest
private

Definition at line 170 of file factorySimulator.h.

◆ __passengerPos

DiscreteVariable* gum::FactorySimulator::__passengerPos
private

Definition at line 169 of file factorySimulator.h.

◆ __primeMap

Bijection< const DiscreteVariable*, const DiscreteVariable* > gum::FactorySimulator::__primeMap
private

Definition at line 166 of file factorySimulator.h.

Referenced by primeVar().

◆ __xPos

DiscreteVariable* gum::FactorySimulator::__xPos
private

Definition at line 167 of file factorySimulator.h.

◆ __yPos

DiscreteVariable* gum::FactorySimulator::__yPos
private

Definition at line 168 of file factorySimulator.h.

◆ _currentState

◆ _endState

Instantiation gum::AbstractSimulator::_endState
inherited

The documentation for this class was generated from the following file: