graphenv.examples.hallway.hallway_state.HallwayState
- class HallwayState(corridor_length, cur_pos=0)[source]
Bases:
graphenv.vertex.Vertex
Example Vertex implementation of a simple hallway process graph. The hallway graph is a simple bidirectional chain of vertices. The root vertex is on one end of the chain and the terminal goal vertex is on the opposite end. The length is configurable.
- Parameters
corridor_length (int) – length of the vertex chain
cur_pos (int, optional) – initial vertex index. Defaults to 0.
- Return type
None
Methods
Convenience function for duplicating the existing node.
render
Optional method for rendering the current state of the environment.
Attributes
children
Gets the child vertices of this vertex.
Debugging information compiled and returned by the environment step() method about vertices passed through or considered.
observation
Gets the observation of this vertex.
HallwayStates are observed with a dictionary containing a single key, 'cur_pos', with an integer value between 0 and self.end_pos, indicating the index of the vertex.
The reward function for the HallwayState graph.
Returns: HallwayState: initial state (vertex at index 0)
terminal
Returns: True if this is a terminal vertex in the graph.
- property info: Dict
Debugging information compiled and returned by the environment step() method about vertices passed through or considered.
- Returns
Debugging information including the index of this vertex.
- Return type
Dict
- new(cur_pos)[source]
Convenience function for duplicating the existing node.
- Returns
a copy of this HallwayState.
- Return type
- Parameters
cur_pos (int) –
- property observation_space: gymnasium.spaces.dict.Dict
HallwayStates are observed with a dictionary containing a single key, ‘cur_pos’, with an integer value between 0 and self.end_pos, indicating the index of the vertex.
- Returns
The observation space for HallwayStates.
- Return type
gym.spaces.Dict
- property reward: float
The reward function for the HallwayState graph.
- Returns
- random reward between 0 and 2 on the goal vertex, -0.1
otherwise.
- Return type
float
- property root: graphenv.examples.hallway.hallway_state.HallwayState
Returns: HallwayState: initial state (vertex at index 0)