Skip to content

SimionSrcParser

BorjaFG edited this page Mar 17, 2019 · 4 revisions

Goals

This C# app is executed each time the source code of RLSimion is recompiled, parsing it and outputting the hierarchical structure and parameters of the app. It mainly focuses on class constructors that take a pointer to a CConfigNode node. This is a node in an XML file from which the values of the parameters are taken. This diagram below represents the coupling between RLSimion and Badger:

SimionSrcParser - coupling between RLSimion and Badger

Constructors and parameters

If our Simion app has the following classes/parameters:

RLSimionApp::RLSimionApp(ConfigNode* pConfigNode)
{
  pLogger= CHILD_OBJECT<Logger>(pConfigNode, "Log", "The logger class");
  pWorld = CHILD_OBJECT<World>(pConfigNode, "World", "The simulation environment and its parameters");
}

Logger::Logger(ConfigNode* pConfigNode)
{
  m_bLogEvaluationEpisodes= BOOL_PARAM(pConfigNode,"Log-eval-episodes", "Log evaluation episodes?",true);
  m_bLogTrainingEpisodes= BOOL_PARAM(pConfigNode,"Log-training-episodes", "Log training episodes?",false);
  m_logFreq= DOUBLE_PARAM(pConfigNode,"Log-Freq","Log frequency. Simulation time in seconds.",0.25);
}

World::World(ConfigNode* pConfigNode)
{
  m_numIntegrationSteps= INT_PARAM(pConfigNode,"Num-Integration-Steps","The number of ...",4);
  m_dt= DOUBLE_PARAM(pConfigNode,"Delta-T","The delta-time between simulation steps", 0.01);
}

Then, SimionSrcParser will parse these constructors and output them in a definition file:

<CLASS Name="RLSimionApp">
  <BRANCH Name="Log" Class="Logger" Comment="The logger class"/>
  <BRANCH Name="World" Class="World" Comment="The simulation environment and its parameters"/>
</CLASS>
<CLASS Name="Logger">
  <DOUBLE-VALUE Name="Log-Freq" Comment="Log frequency. Simulation time in seconds." Default="0.25"/>
  <BOOL-VALUE Name="Log-eval-episodes" Comment="Log evaluation episodes?" Default="true"/>
  <BOOL-VALUE Name="Log-training-episodes" Comment="Log training episodes?" Default="false"/>
</CLASS>
<CLASS Name="World">
  <INTEGER-VALUE Name="Num-Integration-Steps" Comment="The number of integration steps performed each simulation time-step" Default="4"/>
  <DOUBLE-VALUE Name="Delta-T" Comment="The delta-time between simulation steps" Default="0.01"/>
</CLASS>
Clone this wiki locally