qgym.envs.initial_mapping.initial_mapping_visualiser module
This module contains a class used for rendering a InitialMapping
environment.
- class qgym.envs.initial_mapping.initial_mapping_visualiser.InitialMappingVisualiser(render_mode, connection_graph)[source]
Bases:
Visualiser
Visualiser class for the
InitialMapping
environment.- __init__(render_mode, connection_graph)[source]
Init of the
InitialMappingVisualiser
.- Parameters:
connection_graph (
Graph
) – networkx Graph representation of the connection graph.render_mode (
str
) – If ‘human’ open apygame
screen visualizing the step. If ‘rgb_array’, return an RGB array encoding of the rendered frame on each render call.
- render(state)[source]
Render the current state using
pygame
.The upper left screen shows the connection graph. The lower left screen the interaction graph. The right screen shows the mapped graph. Gray edges are unused, green edges are mapped correctly and red edges need at least on swap.
- Parameters:
state (
InitialMappingState
) – State to render.- Raises:
ValueError – When an invalid mode is provided.
- Return type:
- Returns:
In ‘human’ mode returns a boolean value encoding whether the
pygame
screen is open. In ‘rgb_array’ mode returns an RGB array encoding of the rendered image.