aGrUM  0.20.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 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

◆ 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  {
151  return FactoryActions__.beginSafe();
152  }
Sequence< Idx > FactoryActions__
Actions.
iterator_safe beginSafe() const
Returns a safe begin iterator.
Definition: sequence_tpl.h:628

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

References gum::AbstractSimulator::reward().

91 { 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 153 of file factorySimulator.h.

153 { return FactoryActions__.endSafe(); }
const iterator_safe & endSafe() const noexcept
Returns the safe end iterator.
Definition: sequence_tpl.h:635
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.

◆ 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

◆ 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.

◆ pickUp__()

void gum::FactorySimulator::pickUp__ ( )
private

◆ 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__

◆ putDown__()

void gum::FactorySimulator::putDown__ ( )
private

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

References gum::AbstractSimulator::reward().

83  {
84  endState_ = endState;
85  }
+ 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  {
73  currentState_ = initialState;
74  }
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::Set< Key, Alloc >::emplace().

58  {
59  bool hre = true;
60  while (hre) {
62  hre = hasReachEnd();
63  }
64  }
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 179 of file factorySimulator.h.

◆ currentState_

Instantiation gum::AbstractSimulator::currentState_
inherited

Tha state in which the system currently is.

Definition at line 129 of file abstractSimulator.h.

◆ endState_

Instantiation gum::AbstractSimulator::endState_
inherited

Definition at line 129 of file abstractSimulator.h.

◆ FactoryActions__

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

Actions.

Definition at line 178 of file factorySimulator.h.

◆ FactoryVars__

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

Variables data structures.

Definition at line 169 of file factorySimulator.h.

◆ fuelLevel__

DiscreteVariable* gum::FactorySimulator::fuelLevel__
private

Definition at line 175 of file factorySimulator.h.

◆ lastAction__

FactorySimulationAction gum::FactorySimulator::lastAction__
private

Definition at line 181 of file factorySimulator.h.

◆ passengerDest__

DiscreteVariable* gum::FactorySimulator::passengerDest__
private

Definition at line 174 of file factorySimulator.h.

◆ passengerPos__

DiscreteVariable* gum::FactorySimulator::passengerPos__
private

Definition at line 173 of file factorySimulator.h.

◆ primeMap__

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

Definition at line 170 of file factorySimulator.h.

◆ xPos__

DiscreteVariable* gum::FactorySimulator::xPos__
private

Definition at line 171 of file factorySimulator.h.

◆ yPos__

DiscreteVariable* gum::FactorySimulator::yPos__
private

Definition at line 172 of file factorySimulator.h.


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