package com.company.simulated_annealing_travelling_sales_man; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class SingleTour { private List tour; // the total sum of the edge weights private int distance; public SingleTour() { tour = new ArrayList<>(); for(int i=0;i cities) { tour = new ArrayList<>(); for(City city : cities) tour.add(city); } // we have to calculate the total sum of edge weights public double getDistance() { if(distance==0) { int tourDistance = 0; for(int cityIndex=0;cityIndex getTour() { return this.tour; } public void setCity(int index, City city) { tour.set(index, city); } public City getCity(int index) { return tour.get(index); } public int getTourSize() { return tour.size(); } @Override public String toString() { String s = ""; for(City city : tour) s += city.toString() + " - "; return s; } }