qgym.envs.routing.routing_visualiser module

This module contains a class used for rendering a Routing environment.

class qgym.envs.routing.routing_visualiser.RoutingVisualiser(render_mode, connection_graph)[source]

Bases: Visualiser

Visualiser class for the Routing environment.

__init__(render_mode, connection_graph)[source]

Init of the RoutingVisualiser.

Parameters:
  • connection_graph (Graph) – networkx.Graph representation of the connection graph.

  • render_mode (str) – If ‘human’ open a pygame screen visualizing the step. If ‘rgb_array’, return an RGB array encoding of the rendered frame on each render call.

property header_spacing: float

Header spacing.

render(state)[source]

Render the current state using pygame.

Parameters:

state (RoutingState) – State to render.

Raises:

ValueError – When an invalid mode is provided.

Return type:

None | ndarray[Any, dtype[int32]]

Returns:

If render_mode is ‘human’ returns show the current step at using a pygame screen. If render_mode is ‘rgb_array’ returns a RGB array encoding of the rendered image.