concepts.benchmark.algorithm_env.graph_env.PathGraphEnv#

class PathGraphEnv[source]#

Bases: GraphEnvBase

Env for Finding a path from starting node to the destination.

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

dist

The distance between starting node and the destination.

graph

The generated graph.

stats

unwrapped

__init__(nr_nodes, dist_range, 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.

  • dist_range – The sampling range of distance between starting node and the destination.

__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 dist#

The distance between starting node and the destination.

property graph#

The generated graph.

property stats#
property unwrapped#