Class IMacExecutor
Defined in File imac_executor.h
Inheritance Relationships
Derived Types
public FixedIMacExecutor
(Class FixedIMacExecutor)public IMacBeliefSampler
(Class IMacBeliefSampler)
Class Documentation
-
class IMacExecutor
An executor class for an IMac model.
This class retains an IMac model and samples from it to generate runs of the dynamics.
See also
mod/imac.h
Members:
_imac: A shared ptr to an IMac model
_currentState: The current MoD state (deterministic, i.e. just 0s and 1s)
Subclassed by FixedIMacExecutor, IMacBeliefSampler
Public Functions
Constructor initialises the member variables.
- Parameters:
imac – The IMac model
-
virtual Eigen::MatrixXi restart(const std::vector<IMacObservation> &observations = std::vector<IMacObservation>{})
Restart the simulation and return the new initial state.
- Parameters:
observations – A vector of IMacObservations (what is seen at t=0). Optional.
- Returns:
the initial state of the map of dynamics
-
virtual Eigen::MatrixXi updateState(const std::vector<IMacObservation> &observations)
Update the current MoD state based on the iMac model, where successor values are constrained to match the observations we have made.
- Parameters:
observations – A vector of IMacObservations
- Returns:
The successor IMac state
-
virtual void logMapDynamics(const std::filesystem::path &outFile)
Output the map dynamic information into a csv file.
Each row is the state of the map at the corresponding timestep. Row format: ts,(x,y,occ)*
- Parameters:
outFile – The CSV file to write the map logs
-
virtual Eigen::MatrixXi clearRobotPosition(const GridCell &cell)
Clear the robot’s position in the map.
If a robot fails an action, it stays where it is. Due to sampling, this location may not be clear. This function clears it.
- Parameters:
cell – The grid cell to clear
- Returns:
The updated currentState
Protected Functions
-
void _addMapForTs()
Store the current state of the map for logging purposes.
-
Eigen::MatrixXi _sampleState(const Eigen::MatrixXd &distMatrix)
Helper function which samples an MoD state from a distribution matrix.
- Parameters:
distMatrix – a matrix of probabilities. Each probability is the occupation probability for the current timestep.
- Returns:
an MOD state sampled from the distribution