concepts.benchmark.algorithm_env.graph_env.GraphEnvBase#

class GraphEnvBase[source]#

Bases: SimpleRLEnvBase

Graph Env Base.

Methods

action(action)

append_stat(name, value)

clear_stats()

evaluate_one_episode(func)

finish(*args, **kwargs)

play_one_episode(func[, ret_states, ...])

restart(*args, **kwargs)

Attributes

action_space

current_state

graph

The generated graph.

stats

unwrapped

__init__(nr_nodes, p=0.5, directed=False, gen_method='edge')[source]#

Initialize the environment.

Parameters:
  • nr_nodes – The number of nodes in the graph.

  • p – Parameter for random generation. (Default: 0.5) - (edge method): The probability that an edge doesn’t exist in directed graph. - (dnc method): Control the range of the sample of out-degree. - other methods: Unused.

  • directed – Directed or Undirected graph. Default: False (undirected)

  • gen_method – Use which method to randomly generate a graph. - ‘edge’: By sampling the existence of each edge. - ‘dnc’: Sample out-degree (\(m\)) of each node, and link to nearest neighbors in the unit square. - ‘list’: generate a chain-like graph.

__new__(**kwargs)#
action(action)#
append_stat(name, value)#
clear_stats()#
evaluate_one_episode(func)#
finish(*args, **kwargs)#
play_one_episode(func, ret_states=False, ret_actions=False, restart_kwargs=None, finish_kwargs=None, max_steps=10000)#
restart(*args, **kwargs)#
property action_space#
property current_state#
property graph#

The generated graph.

property stats#
property unwrapped#