@Override public SolutionObject[] solve(int[][] travelTime, int[] releaseDates, int[] dueDates, int[][] servicePairs, int[] serviceTimes, int[][] vehicleTravelTimes, int[][] inventories, int[] remainingServiceTimes, int[] currentDestinations, @Nullable SolutionObject[] currentSolutions) { inputMemory.add(new MVArraysObject(travelTime, releaseDates, dueDates, servicePairs, serviceTimes, vehicleTravelTimes, inventories, remainingServiceTimes, currentDestinations, currentSolutions)); final SolutionObject[] output = solver.solve(travelTime, releaseDates, dueDates, servicePairs, serviceTimes, vehicleTravelTimes, inventories, remainingServiceTimes, currentDestinations, currentSolutions); outputMemory.add(output); return output; } }
@Override public ImmutableList<ImmutableList<Parcel>> solve(GlobalStateObject state) { final MVArraysObject o = ArraysSolvers.toMultiVehicleArrays(state, outputTimeUnit); final SolutionObject[] sols = solver.solve(o.travelTime, o.releaseDates, o.dueDates, o.servicePairs, o.serviceTimes, o.vehicleTravelTimes, o.inventories, o.remainingServiceTimes, o.currentDestinations, o.currentSolutions); final ImmutableList.Builder<ImmutableList<Parcel>> b = ImmutableList .builder(); for (final SolutionObject sol : sols) { b.add(ArraysSolvers.convertSolutionObject(sol, o.index2parcel)); } return b.build(); } }
@Override public SolutionObject[] solve(int[][] travelTime, int[] releaseDates, int[] dueDates, int[][] servicePairs, int[] serviceTimes, int[][] vehicleTravelTimes, int[][] inventories, int[] remainingServiceTimes, int[] currentDestinations, @Nullable SolutionObject[] currentSolutions) { validateInputs(travelTime, releaseDates, dueDates, servicePairs, serviceTimes, vehicleTravelTimes, inventories, remainingServiceTimes, currentDestinations, currentSolutions); final SolutionObject[] output = delegateSolver.solve(travelTime, releaseDates, dueDates, servicePairs, serviceTimes, vehicleTravelTimes, inventories, remainingServiceTimes, currentDestinations, currentSolutions); return validateOutputs(output, travelTime, releaseDates, dueDates, servicePairs, serviceTimes, vehicleTravelTimes, inventories, remainingServiceTimes, currentDestinations); } }
@Test public void testWrapMulti() { TestUtil.testPrivateConstructor(ArraysSolverValidator.class); final MultiVehicleArraysSolver s = wrap(new FakeMultiSolver( new SolutionObject[] {new SolutionObject(new int[] {0, 1, 2, 3}, new int[] {0, 10, 100, 108}, 228)})); s.solve(travelTimes, new int[4], new int[4], new int[][] {}, new int[4], new int[2][4], new int[][] {{0, 1}, {0, 2}}, new int[2], new int[2], null); }
.wrap(new FakeMultiSolver(new SolutionObject[] {sol1, sol2})); s.solve(tt, // travel times new int[5], // release dates new int[5], // due dates