qiskit.optimization.applications.ising.tsp
Convert symmetric TSP instances into Pauli list Deal with TSPLIB format. Design the tsp object w as a two-dimensional np.array e.g., w[i, j] = x means that the length of a edge between i and j is x Note that the weights are symmetric, i.e., w[j, i] = x always holds.
Functions
calc_distance (coord[, name]) | calculate distance |
get_operator (ins[, penalty]) | Generate Hamiltonian for TSP of a graph. |
get_tsp_solution (x) | Get graph solution from binary string. |
parse_tsplib_format (filename) | Read graph in TSPLIB format from file. |
random_tsp (n[, low, high, savefile, seed, name]) | Generate a random instance for TSP. |
tsp_feasible (x) | Check whether a solution is feasible or not. |
tsp_value (z, w) | Compute the TSP value of a solution. |
Classes
TspData (name, dim, coord, w) | Create new instance of TspData(name, dim, coord, w) |
Was this page helpful?
Report a bug or request content on GitHub.