ArraysSolverValidator { public static void validateInputs(int[][] travelTime, int[] releaseDates, int[] dueDates, int[][] servicePairs, int[] serviceTimes) { final int n = travelTime.length; checkArgument(n > 0, "Travel time matrix cannot be empty"); for (int i = 0; i < n; i++) { checkArgument(travelTime[i].length == n, "row %s has invalid length %s", i, travelTime[i].length); } checkArgument(releaseDates.length == n, "ReleaseDates array has incorrect length (%s) should be %s", releaseDates.length, n); checkArgument(dueDates.length == n, "dueDates array has incorrect length (%s) should be %s", dueDates.length, n); checkArgument(serviceTimes.length == n, "serviceTimes has incorrect length (%s) should be %s", serviceTimes.length, n); for (int i = 0; i < n; i++) { if (i == 0 || i == n - 1) { checkArgument(serviceTimes[i] == 0, "first and last index in serviceTimes should be 0"); } else { checkArgument(serviceTimes[i] >= 0, "serviceTimes should be >= 0"); } } for (int i = 0; i < n; i++) { checkArgument( releaseDates[i] <= dueDates[i], "Index %s, release date (%s) should always be before the due date " + "(%s)", i, releaseDates[i], dueDates[i]); } checkArgument(releaseDates[0] == 0 && dueDates[0] == 0, "Start location should have release date and due date 0"); final Set<Integer> set = newHashSet(); for (int i = 0; i < servicePairs.length; i++) { checkArgument(servicePairs[i].length == 2, "Each pair entry should consist of exactly two locations."); for (int j = 0; j < 2; j++) { checkArgument( servicePairs[i][j] > 0 && servicePairs[i][j] < n - 1, "Pair consists of an invalid location (start location and depot are" + " not allowed), index is %s, location is %s", i, servicePairs[i][j]); checkArgument( !set.contains(servicePairs[i][j]), "Location can be part of only one pair, duplicate location: %s " + "(index %s,%s)", servicePairs[i][j], i, j); set.add(servicePairs[i][j]); } } } private  ArraysSolverValidator(); static SingleVehicleArraysSolver wrap(
      SingleVehicleArraysSolver delegate); static MultiVehicleArraysSolver wrap(
      MultiVehicleArraysSolver delegate); static void validateInputs(int[][] travelTime, int[] releaseDates,
      int[] dueDates, int[][] servicePairs, int[] serviceTimes); static void validateInputs(int[][] travelTime, int[] releaseDates,
      int[] dueDates, int[][] servicePairs, int[] serviceTimes,
      int[][] vehicleTravelTimes, int[][] inventories,
      int[] remainingServiceTimes, int[] currentDestinations,
      @Nullable SolutionObject[] currentSolutions); static SolutionObject validateOutputs(SolutionObject sol,
      int[][] travelTime, int[] releaseDates, int[] dueDates,
      int[][] servicePairs, int[] serviceTimes,
      @Nullable SolutionObject currentSolution); static SolutionObject[] validateOutputs(SolutionObject[] sols,
      int[][] travelTime, int[] releaseDates, int[] dueDates,
      int[][] servicePairs, int[] serviceTimes, int[][] vehicleTravelTimes,
      int[][] inventories, int[] remainingServiceTimes,
      int[] currentDestinations);  }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidDestinations2b() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{1, 1}, {1, 3}}, new int[] {300, 0}, new int[] { -1, 3}, null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidDestinations3() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{1, 3}, {1, 1}}, new int[] {300, 0}, new int[] {0, 2} , null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidDestinations4() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{1, 3}, {1, 1}}, new int[] {300, 0}, new int[] {1, 0} , null); }
@Test public void validateInputsValidDestinations2() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}}, new int[6], new int[][] {{0, MI, MI, MI, 0, MI}, {0, MI, MI, 0, MI, MI}}, new int[][] {{1, 3}, {1, 1}}, new int[] {0, 0}, new int[] {4, 3} , null); }
@Test public void validateInputsValidMulti() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}}, new int[6], new int[][] {{0, MI, MI, MI, 0, MI}, {0, 0, 0, 0, 0, 0}}, new int[][] {{1, 1}, {1, 3}}, new int[] {300, 0}, new int[] {4, 0}, null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsEmptyTravelTimeMatrix() { validateInputs(new int[][] {}, new int[] {}, new int[] {}, new int[][] {}, new int[] {}); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidTravelTimeMatrix1() { validateInputs(new int[7][6], new int[] {}, new int[] {}, new int[][] {}, new int[] {}); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidTravelTimeMatrix2() { validateInputs(new int[][] {new int[3], new int[3], new int[4]}, new int[] {}, new int[] {}, new int[][] {}, new int[] {}); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidReleaseDatesLength() { validateInputs(new int[4][4], new int[5], new int[] {}, new int[][] {}, new int[] {}); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidDueDatesLength() { validateInputs(new int[4][4], new int[4], new int[2], new int[][] {}, new int[] {}); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidServiceTime() { validateInputs(new int[7][7], new int[7], new int[7], new int[][] {}, new int[3]); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidTW() { validateInputs(new int[3][3], new int[] {1, 2, 3}, new int[] {1, 3, 2}, new int[][] {}, new int[3]); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidTWstart1() { validateInputs(new int[3][3], new int[] {1, 2, 3}, new int[] {1, 3, 6}, new int[][] {}, new int[3]); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidTWstart2() { validateInputs(new int[3][3], new int[] {0, 2, 3}, new int[] {1, 3, 6}, new int[][] {}, new int[3]); }
@Test public void validateInputsValidEmpty() { validateInputs(new int[3][3], new int[3], new int[3], new int[][] {}, new int[3]); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidPairSize() { validateInputs(new int[4][4], new int[4], new int[4], new int[][] { new int[] {1, 2}, new int[3]}, new int[4]); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidPairLocation1() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] { new int[] {1, 2}, new int[] {3, 0}}, new int[6]); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidPairLocation2() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] { new int[] {1, 2}, new int[] {3, 913}}, new int[6]); }
@Test(expected = IllegalArgumentException.class) public void validateInputsDuplicatePairLocation() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] { new int[] {1, 2}, new int[] {2, 0}}, new int[6]); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidArrivalTimes() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] { new int[] {4, 2}, new int[] {3, 1}}, new int[] {-1, -1, 0, 0, 0, 0}); }
@Test public void validateInputsValid() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] { new int[] {4, 2}, new int[] {3, 1}}, new int[6]); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidNoVehicles() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] { new int[] {4, 2}, new int[] {3, 1}}, new int[6], new int[0][0], new int[0][0], new int[0], new int[0], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidVehicleTravelTimes1() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}, new int[] {3, 1}}, new int[6], new int[2][0], new int[0][0], new int[2], new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidVehicleTravelTimes2() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] { new int[] {4, 2}, new int[] {3, 1}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, -1, 0}}, new int[0][0], new int[2], new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidVehicleTravelTimes3() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}, new int[] {3, 1}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0}}, new int[0][0], new int[2], new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidVehicleTravelTimes4() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}, new int[] {3, 1}}, new int[6], new int[][] {{0, MI, MI - 1, 0, MI, 0}, {0, 0, 0, 0, 0, 0}}, new int[0][0], new int[2], new int[] {2, 0}, null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidVehicleTravelTimes5() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}, new int[] {3, 1}}, new int[6], new int[][] {{0, 0, MI - 1, 0, MI, 0}, {0, 0, 0, 0, 0, 0}}, new int[0][0], new int[2], new int[] {0, 0}, null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidInventories1() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] { new int[] {4, 2}, new int[] {3, 1}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{0}}, new int[2], new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidInventories2() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {3, 1}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{0}}, new int[2], new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidInventories3() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {3, 1}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{0}, {0}}, new int[2], new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidInventories4a() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {3, 1}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{2, 0}, {2, 0}}, new int[2], new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidInventories4b() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {3, 1}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{-1, 0}, {2, 0}}, new int[2], new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidInventories5a() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {3, 1}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{1, 0}, {1, 0}}, new int[2], new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidInventories5b() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {3, 1}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{1, 5}, {1, 5}}, new int[2], new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidInventories6() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {3, 1}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{1, 1}, {1, 1}}, new int[2], new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidInventories7() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{1, 1}, {1, 1}}, new int[2], new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidRemainingServiceTimes1() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{1, 1}, {1, 3}}, new int[] {1}, new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidRemainingServiceTimes2() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{1, 1}, {1, 3}}, new int[] {300, -1}, new int[2], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidDestinations1() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{1, 1}, {1, 3}}, new int[] {300, 0}, new int[1], null); }
@Test(expected = IllegalArgumentException.class) public void validateInputsInvalidDestinations2a() { validateInputs(new int[6][6], new int[6], new int[6], new int[][] {new int[] {4, 2}}, new int[6], new int[][] {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}, new int[][] {{1, 1}, {1, 3}}, new int[] {300, 0}, new int[] { 5, 3}, null); }