QDpy
Loading...
Searching...
No Matches
graph_paths.py File Reference

Quality-diversity genetic search for directed endpoint-pair routes. More...

Go to the source code of this file.

Classes

class  qdpy.algorithms.graph_paths.GraphPath
 An immutable directed route and its summed edge weight. More...
class  qdpy.algorithms.graph_paths.GraphPathRepertoire
 One retained route per discovered ordered pair and the proposal counts. More...

Namespaces

namespace  qdpy

Functions

 qdpy.algorithms.graph_paths.graph_path_qd (edges, *, budget, nodes=None, crossover_probability=0.5, crossover="feasible", seed=0)
 Search for short paths by evolving one solution per directed endpoint pair.

Detailed Description

Quality-diversity genetic search for directed endpoint-pair routes.

Definition in file graph_paths.py.

Function Documentation

◆ graph_path_qd()

qdpy.algorithms.graph_paths.graph_path_qd ( edges,
* ,
budget,
nodes = None,
crossover_probability = 0.5,
crossover = "feasible",
seed = 0 )

Search for short paths by evolving one solution per directed endpoint pair.

Explore routes with endpoint mutations and directed path crossover.

Initialize the repertoire with the direct edges. Each subsequent
attempt changes one path or concatenates two paths. Mutation draws
one plus a Poisson(1) number of incident-edge edits and ends the
proposal at the first invalid edit. Crossover can select occupied
pairs uniformly or draw the second pair from the first pair's target
row. Empty or incompatible pairs consume one attempt. A valid path
replaces an equal-cost or higher-cost incumbent.

:param edges: Iterable of (source, target, positive weight) triples.
    Nodes may be any hashable labels. Weights can be integers or floats.
:param budget: Nonnegative number of proposals after direct-edge initialization.
:param nodes: Optional node labels in sampling order, including isolated
    nodes. Omit to infer nodes in order of first occurrence in edges.
:param crossover_probability: Probability of a crossover attempt.
    Zero runs mutation-only QD-EA.
:param crossover: "feasible" for directed-row selection or "uniform"
    for two independent draws from occupied pairs.
:param seed: Local NumPy random seed.
:returns: A GraphPathRepertoire with routes and separate proposal counts.

Definition at line 123 of file graph_paths.py.