aGrUM  0.20.3
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 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 87 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 147 of file factorySimulator.h.

147 { 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 150 of file factorySimulator.h.

150 { return _FactoryActions_.beginSafe(); }
Sequence< Idx > _FactoryActions_
Actions.
iterator_safe beginSafe() const
Returns a safe begin iterator.
Definition: sequence_tpl.h:603

◆ beginVariables()

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

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 133 of file factorySimulator.h.

133  {
134  return _FactoryVars_.beginSafe();
135  }
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 87 of file abstractSimulator.h.

References gum::AbstractSimulator::reward().

87 { 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 151 of file factorySimulator.h.

151 { return _FactoryActions_.endSafe(); }
const iterator_safe & endSafe() const noexcept
Returns the safe end iterator.
Definition: sequence_tpl.h:610
Sequence< Idx > _FactoryActions_
Actions.

◆ endVariables()

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

Iteration over the variables of the simulated probleme.

Implements gum::AbstractSimulator.

Definition at line 136 of file factorySimulator.h.

136  {
137  return _FactoryVars_.endSafe();
138  }
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 128 of file factorySimulator.h.

128  {
129  return _primeMap_.second(mainVar);
130  }
Bijection< const DiscreteVariable *, const DiscreteVariable *> _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 81 of file abstractSimulator.h.

References gum::AbstractSimulator::reward().

81 { endState_ = endState; }
+ 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 72 of file abstractSimulator.h.

References gum::AbstractSimulator::reward().

72 { currentState_ = initialState; }
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 64 of file abstractSimulator.cpp.

References gum::Set< Key, Alloc >::emplace().

64  {
65  bool hre = true;
66  while (hre) {
68  hre = hasReachEnd();
69  }
70  }
virtual bool hasReachEnd()
Tests if end state has been reached.
virtual Instantiation randomState_()
Choses a random state as the first test for a run.
Instantiation currentState_
Tha state in which the system currently is.
+ Here is the call graph for this function:

Member Data Documentation

◆ _actionMap_

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

Definition at line 177 of file factorySimulator.h.

◆ _FactoryActions_

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

Actions.

Definition at line 176 of file factorySimulator.h.

◆ _FactoryVars_

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

Variables data structures.

Definition at line 167 of file factorySimulator.h.

◆ _fuelLevel_

DiscreteVariable* gum::FactorySimulator::_fuelLevel_
private

Definition at line 173 of file factorySimulator.h.

◆ _lastAction_

FactorySimulationAction gum::FactorySimulator::_lastAction_
private

Definition at line 179 of file factorySimulator.h.

◆ _passengerDest_

DiscreteVariable* gum::FactorySimulator::_passengerDest_
private

Definition at line 172 of file factorySimulator.h.

◆ _passengerPos_

DiscreteVariable* gum::FactorySimulator::_passengerPos_
private

Definition at line 171 of file factorySimulator.h.

◆ _primeMap_

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

Definition at line 168 of file factorySimulator.h.

◆ _xPos_

DiscreteVariable* gum::FactorySimulator::_xPos_
private

Definition at line 169 of file factorySimulator.h.

◆ _yPos_

DiscreteVariable* gum::FactorySimulator::_yPos_
private

Definition at line 170 of file factorySimulator.h.

◆ currentState_

Instantiation gum::AbstractSimulator::currentState_
inherited

Tha state in which the system currently is.

Definition at line 125 of file abstractSimulator.h.

◆ endState_

Instantiation gum::AbstractSimulator::endState_
inherited

Definition at line 125 of file abstractSimulator.h.


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