mqt.problemsolver.qubo_tools.pathfinder.tsplib

Provides support for the TSPLib format as input for the pathfinding QuboGenerator.

Module Contents

to_graph(g: networkx.Graph) → Graph[source]

Transforms a networkx graph into a Graph object.

Parameters:

g – The networkx graph to be transformed.

Returns:

The transformed graph.

from_tsplib_problem(problem: tsplib95.models.StandardProblem, encoding_type: EncodingType) → PathFindingQuboGenerator[source]

Constructs a QUBO generator for a given problem in TSPLib format.

Parameters:
  • problem – The TSPLib problem.

  • encoding_type – The desired encoding type.

Returns:

The constructed QUBO generator.

Raises:

ValueError – If a CVRP problem is given, as this problem type cannot be solved by the pathfinder or an unknown problem type is given.