We propose an amplitude encoding of the traveling salesperson problem along with a method for calculating the cost function. Our encoding requires a number of qubits which grows logarithmically with the number of cities. We propose to calculate the cost function classically based on the probability distribution extracted from measuring the quantum computer. This is in contrast from the typical method of evaluating the cost function by taking the expectation value of a quantum operator. We demonstrate our method using a variational quantum eigensolver algorithm to find the shortest route for a given graph. We find that there is a broad range in the hyperparameters of the optimization procedure for which the best route is found.