Add External Factor

An external variable refers to a variable that affects the current system but is not affected by the current system. For example, in a robot control task, the lighting conditions indoors usually affect the robot’s sensor readings, and the sensor data also affects the robot’s movement strategy indoors. The lighting conditions are not affected by the robot’s movement strategy, so they can be considered an external variable. In autonomous driving tasks, traffic signs and traffic rules such as red lights and green lights are external variables because they are usually established by road management agencies and are not affected by autonomous vehicles.。

External variables are typically caused by external factors and cannot be manipulated or controlled by the current system. Introducing external variables in the modeling process can make the model more accurate.

The REVIVE SDK supports the introduction of external variables as inputs to decision flowcharts, and these variables are only used as inputs in the decision flowchart, without being configured to output nodes.

For example, in the refrigerator case study, the internal temperature of the refrigerator is affected by the status of the refrigerator door switch, which is entirely determined by human decision and is not influenced by the refrigerator itself. Therefore, the status of the refrigerator door switch is introduced as an external variable.

Note

The use of external variables is not a mandatory requirement for using REVIVE. Only when a variable affects the rest of the nodes in the decision flowchart but is not affected by the rest of the nodes should it be set as an external variable.

We use the following .yaml file to demonstrate the use of external variables in the refrigerator case study:

metadata:

   graph:
     action:
     - temperature
     next_temperature:
     - action
     - temperature
     - door_open

   columns:
   - obs_temp:
       dim: temperature
       type: continuous
       max: 20
       min: -20
   - power_action:
       dim: action
       type: continuous
       max: 10
       min: 0
   - factor_door_state:
       dim: door_open
       type: continuous
                                                                                                                                                                                              

In the above .yaml file, door_open is used as an input to the next_temperature node along with action and temperature. However, there is no outgoing edge from the door_open node, so door_open cannot be affected by other nodes in the decision flowchart.

If we assume that door_open is affected by the temperature and that the refrigerator door will automatically open when the temperature reaches a certain condition, we need to add an edge pointing to door_open in the above .yaml file. The modified file would look like this:

metadata:

   graph:
     action:
     - temperature
     next_temperature:
     - action
     - temperature
     - door_open
     next_door_open:
     - next_temperature

   columns:
   - obs_temp:
       dim: temperature
       type: continuous
       max: 20
       min: -20
   - power_action:
       dim: action
       type: continuous
       max: 10
       min: 0
   - factor_door_state:
       dim: door_open
       type: continuous

When using the REVIVE SDK, we should define or construct external factors in the decision flowchart based on the business logic. This will make the learning environment model of REVIVE more accurate and closer to reality.