aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
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 Member Functions

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

Public Attributes

Instantiation currentState_
 Tha state in which the system currently is.
Instantiation endState_

Private Member Functions

void _goNorth_ ()
void _goEast_ ()
void _goSouth_ ()
void _goWest_ ()
void _pickUp_ ()
void _putDown_ ()
void _fillUp_ ()

Private Attributes

Sequence< const DiscreteVariable * > _FactoryVars_
 Variables data structures.
Bijection< const DiscreteVariable *, const DiscreteVariable * > _primeMap_
DiscreteVariable_xPos_
DiscreteVariable_yPos_
DiscreteVariable_passengerPos_
DiscreteVariable_passengerDest_
DiscreteVariable_fuelLevel_
Sequence< Idx_FactoryActions_
 Actions.
HashTable< Idx, std::string * > _actionMap_
FactorySimulationAction _lastAction_
bool hasReachEnd ()
 Choses a random state as the first test for a run.
double reward ()
 Choses a random state as the first test for a run.
void perform (Idx)
 Choses a random state as the first test for a run.
Instantiation randomState_ ()
 Choses a random state as the first test for a run.

Detailed Description

A class to simulate the Factory problem.

Definition at line 99 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

◆ _goEast_()

void gum::FactorySimulator::_goEast_ ( )
private

◆ _goNorth_()

void gum::FactorySimulator::_goNorth_ ( )
private

◆ _goSouth_()

void gum::FactorySimulator::_goSouth_ ( )
private

◆ _goWest_()

void gum::FactorySimulator::_goWest_ ( )
private

◆ _pickUp_()

void gum::FactorySimulator::_pickUp_ ( )
private

◆ _putDown_()

void gum::FactorySimulator::_putDown_ ( )
private

◆ actionName()

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

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 160 of file factorySimulator.h.

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

References _actionMap_.

◆ beginActions()

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

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 163 of file factorySimulator.h.

163{ return _FactoryActions_.beginSafe(); }
Sequence< Idx > _FactoryActions_
Actions.

References _FactoryActions_.

◆ beginVariables()

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

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 145 of file factorySimulator.h.

145 {
146 return _FactoryVars_.beginSafe();
147 }
Sequence< const DiscreteVariable * > _FactoryVars_
Variables data structures.

References _FactoryVars_.

◆ currentState()

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

Sets the intial statefrom which we begun the simulation.

Definition at line 108 of file abstractSimulator.h.

108{ return currentState_; }
Instantiation currentState_
Tha state in which the system currently is.

References currentState_.

◆ endActions()

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

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 165 of file factorySimulator.h.

165{ return _FactoryActions_.endSafe(); }

References _FactoryActions_.

◆ endVariables()

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

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 149 of file factorySimulator.h.

149 {
150 return _FactoryVars_.endSafe();
151 }

References _FactoryVars_.

◆ 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 140 of file factorySimulator.h.

140 {
141 return _primeMap_.second(mainVar);
142 }
Bijection< const DiscreteVariable *, const DiscreteVariable * > _primeMap_

References _primeMap_.

◆ randomState_()

Instantiation gum::FactorySimulator::randomState_ ( )
protectedvirtual

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

Reimplemented from gum::AbstractSimulator.

◆ 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 102 of file abstractSimulator.h.

102{ endState_ = endState; }

References endState_.

◆ setInitialState()

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

Sets the intial statefrom which we begun the simulation.

Definition at line 92 of file abstractSimulator.h.

92{ currentState_ = initialState; }

References currentState_.

◆ setInitialStateRandomly()

void gum::AbstractSimulator::setInitialStateRandomly ( )
inherited

Sets the intial statefrom which we begun the simulation.

Definition at line 82 of file abstractSimulator.cpp.

82 {
83 bool hre = true;
84 while (hre) {
86 hre = hasReachEnd();
87 }
88 }
virtual Instantiation randomState_()
Choses a random state as the first test for a run.
virtual bool hasReachEnd()
Tests if end state has been reached.

References currentState_, hasReachEnd(), and randomState_().

Here is the call graph for this function:

Member Data Documentation

◆ _actionMap_

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

Definition at line 190 of file factorySimulator.h.

Referenced by actionName().

◆ _FactoryActions_

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

Actions.

Definition at line 189 of file factorySimulator.h.

Referenced by beginActions(), and endActions().

◆ _FactoryVars_

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

Variables data structures.

Definition at line 180 of file factorySimulator.h.

Referenced by beginVariables(), and endVariables().

◆ _fuelLevel_

DiscreteVariable* gum::FactorySimulator::_fuelLevel_
private

Definition at line 186 of file factorySimulator.h.

◆ _lastAction_

FactorySimulationAction gum::FactorySimulator::_lastAction_
private

Definition at line 192 of file factorySimulator.h.

◆ _passengerDest_

DiscreteVariable* gum::FactorySimulator::_passengerDest_
private

Definition at line 185 of file factorySimulator.h.

◆ _passengerPos_

DiscreteVariable* gum::FactorySimulator::_passengerPos_
private

Definition at line 184 of file factorySimulator.h.

◆ _primeMap_

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

Definition at line 181 of file factorySimulator.h.

Referenced by primeVar().

◆ _xPos_

DiscreteVariable* gum::FactorySimulator::_xPos_
private

Definition at line 182 of file factorySimulator.h.

◆ _yPos_

DiscreteVariable* gum::FactorySimulator::_yPos_
private

Definition at line 183 of file factorySimulator.h.

◆ currentState_

◆ endState_

Instantiation gum::AbstractSimulator::endState_
inherited

Definition at line 146 of file abstractSimulator.h.

Referenced by hasReachEnd(), and setEndState().


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