quantum_launcher.problems.problem_initialization.tsp

quantum_launcher.problems.problem_initialization.tsp#

Summary#

Classes:

TSP

Traveling Salesman Problem (TSP) definition.

Reference#

class quantum_launcher.problems.problem_initialization.tsp.TSP(instance: Graph, instance_name: str = 'unnamed')[source]#

Bases: Problem

Traveling Salesman Problem (TSP) definition.

property setup: dict#
visualize(solution=None)[source]#
static from_preset(instance_name: str = 'default', **kwargs) TSP[source]#

Generate TSP instance from a preset name.

Parameters:
  • instance_name (str) – Name of the preset instance

  • quadratic (bool, optional) – Whether to use quadratic constraints. Defaults to False

Returns:

TSP instance

Return type:

TSP

static generate_tsp_instance(num_vertices: int, min_distance: float = 1.0, max_distance: float = 10.0, **kwargs) TSP[source]#

Generate a random TSP instance.

Parameters:
  • num_vertices (int) – Number of vertices in the graph

  • min_distance (float, optional) – Minimum distance between vertices. Defaults to 1.0

  • max_distance (float, optional) – Maximum distance between vertices. Defaults to 10.0

  • quadratic (bool, optional) – Whether to use quadratic constraints. Defaults to False

Returns:

TSP instance

Return type:

TSP