Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.48 KB | None | 0 0
  1. private static void LoadData(String path) throws Exception {
  2.         BufferedReader file = new BufferedReader(new FileReader(path));
  3.         String separator[];
  4.         String line = file.readLine();
  5.         separator = line.split(" ");
  6.         int i = 0;
  7.         if (separator[i].equals("")) {
  8.             i++;
  9.         }
  10.         int n = Integer.parseInt(separator[i]);
  11.         int capacity = Integer.parseInt(separator[i + 1]);
  12.         int maxRouteTime = Integer.parseInt(separator[i + 2]);
  13.         int dropTime = Integer.parseInt(separator[i + 3]);
  14.         vrp = new VehicleRoutingProblem(n, capacity, maxRouteTime, dropTime);
  15.         double coord[][] = new double[vrp.getNumberOfCustomers() + 1][2];
  16.         line = file.readLine();
  17.         separator = line.split(" ");
  18.         i = 0;
  19.         if (separator[i].equals("")) {
  20.             i++;
  21.         }
  22.         coord[0][0] = Integer.parseInt(separator[i]);
  23.         coord[0][1] = Integer.parseInt(separator[i + 1]);
  24.         vrp.addCustomerDemand(0, 0);
  25.         for (int j = 1; j <= vrp.getNumberOfCustomers(); j++) {
  26.             line = file.readLine();
  27.             separator = line.split(" ");
  28.             i = 0;
  29.             if (separator[i].equals("")) {
  30.                 i++;
  31.             }
  32.             coord[j][0] = Integer.parseInt(separator[i]);
  33.             coord[j][1] = Integer.parseInt(separator[i + 1]);
  34.             vrp.addCustomerDemand(j, Integer.parseInt(separator[i + 2]));
  35.         }
  36.         fillMatrix(coord);
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement