title: Solving the Traveling Salesman Problem with bruteforce
body: <p>For a school project, I am trying to implement a bruteforce algorithm to the Traveling Salesman Problem. What I would like to do is, that I enter an integer which represents the number of points, for each point there will given an random x and y value which represents their position on a 2D Plane. After all points have been initialized, the algorithm will calculate the distance for each route starting from point 1 and then permutate all different possibilites.</p>
  
  <p>Update 1:</p>
  
  <p>So I coded the Point.java and the PointManager.java classes which there purpose is to initialize the points and keep them in an arraylist.
  They look like this
  Point.java:</p>
  
  <pre><code>public class Point {
  
      int x;
      int y;
  
      //Constructs a random Point
      public Point(){
          this.x = (int)(Math.random()*200);
          this.y = (int)(Math.random()*200);
      }
  
      //gives Point X Position
      public int getPosX(){
          return this.x;
      }
  
      //gives Point Y Position
      public int getPosY(){
          return this.y;
      }
  
      public double distance(Point point){
          int distance_x = Math.abs(getPosX() - point.getPosX());
          int distance_y = Math.abs(getPosY() - point.getPosY());
          double distance = Math.sqrt((distance_x * distance_x) + (distance_y * distance_y));
          return distance;
      }  
  }
  </code></pre>
  
  <p>PointManager.java</p>
  
  <pre><code>import java.util.ArrayList;
  public class PointManager {
  
      // Holds our cities
      private static ArrayList destinationPoints = new ArrayList&lt;Point&gt;();
  
      // Adds a destination city
      public static void addPoint(Point point) {
          destinationPoints.add(point);
      }
  
      // Get a city
      public static Point getPoint(int index){
          return (Point)destinationPoints.get(index);
      }
  
      // Get the number of destination cities
      public static int numberOfPoints(){
          return destinationPoints.size();
      } 
  }
  </code></pre>
  
  <p>Now my question is, how would I continue doing the different permutations of the possibilities and how do I check if a point has already been used in a route?</p>