言語
English
Bengali
Japanese
Spanish



Tsp

class Tsp(graph)[ソース]

ベースクラス: GraphOptimizationApplication

Optimization application for the 「traveling salesman problem」 [1] based on a NetworkX graph.

参照

[1]: 「Travelling salesman problem」, https://en.wikipedia.org/wiki/Travelling_salesman_problem

パラメータ:

graph (Union[Graph, ndarray, List]) – A graph representing a problem. It can be specified directly as a NetworkX graph, or as an array or list format suitable to build out a NetworkX graph.

Attributes

Methods

create_random_instance(n[, low, high, seed])

Create a random instance of the traveling salesman problem

interpret(result)

Interpret a result as a list of node indices

parse_tsplib_format(filename)

Read a graph in TSPLIB format from file and return a Tsp instance.

to_quadratic_program()

Convert a traveling salesman problem instance into a QuadraticProgram

tsp_value(z, adj_matrix)

Compute the TSP value of a solution.