static ImmutableList<Double> decomposedCost(GlobalStateObject state, ImmutableList<ImmutableList<Parcel>> schedule, ObjectiveFunction objFunc) { final ImmutableList.Builder<Double> builder = ImmutableList.builder(); for (int i = 0; i < schedule.size(); i++) { builder.add(objFunc.computeCost(Solvers.computeStats( state.withSingleVehicle(i), ImmutableList.of(schedule.get(i))))); } return builder.build(); }
@Override public double computeCost(GlobalStateObject context, int routeIndex, ImmutableList<Parcel> newRoute) { return objectiveFunction.computeCost(Solvers.computeStats( context.withSingleVehicle(routeIndex), ImmutableList.of(newRoute))); } }
/** * Computes a {@link StatisticsDTO} instance for the given * {@link GlobalStateObject} and routes. For each vehicle in the state the * specified route is used and its arrival times, tardiness and travel times * are computed. The resulting {@link StatisticsDTO} has the same properties * as performing a simulation with the same state. However, since the current * state may be half-way a simulation, it is possible that the returned * statistics describe only a partial simulation. As a result * {@link StatisticsDTO#totalDeliveries} does not necessarily equal * {@link StatisticsDTO#totalPickups}. The travel times and distance are * computed using {@link GeomHeuristics#euclidean()}. * @param state The state which represents a simulation. * @param routes Specifies the route the vehicles are currently following, * must be of same size as the number of vehicles (one route per * vehicle). If this is <code>null</code> the * {@link VehicleStateObject#getRoute()} field must be set instead * for <b>each</b> vehicle. * @return The statistics that will be generated when executing this * simulation. */ public static ExtendedStats computeStats(GlobalStateObject state, @Nullable ImmutableList<ImmutableList<Parcel>> routes) { return computeStats(state, routes, GeomHeuristics.euclidean()); }
final GlobalStateObject state = solverHandle.get().convert( SolveArgs.create().noCurrentRoutes().useParcels(parcels)); final double baseline = objectiveFunction.computeCost(Solvers.computeStats( state, ImmutableList.of(currentRoute))); final double newCost = objectiveFunction.computeCost(Solvers.computeStats( state, ImmutableList.of(ImmutableList.copyOf(newRoute))));
solverHandle.get().getCurrentSchedule(); final double newCost = objectiveFunction.computeCost( Solvers.computeStats(state, schedule));
static double decomposedCost(GlobalStateObject gso, ImmutableList<ImmutableList<Parcel>> routes, ObjectiveFunction objFunc) { double sum = 0d; for (int i = 0; i < gso.getVehicles().size(); i++) { sum += objFunc.computeCost(Solvers.computeStats(gso.withSingleVehicle(i), ImmutableList.of(routes.get(i)))); } return sum; }
SolveArgs.create().noCurrentRoutes().useParcels(assignedParcels)); final StatisticsDTO stats = Solvers.computeStats(state, ImmutableList.of(currentRoute)); newRoute.removeAll(Collections.singleton(sp)); final double cost = objectiveFunction.computeCost( Solvers.computeStats(state, ImmutableList.of(ImmutableList.copyOf(newRoute)))); if (cost < lowestCost) {
.computeStats(state.withSingleVehicle(i), ImmutableList.of(r)));
.useParcels(parcels)); final double baseline = objectiveFunction.computeCost( Solvers.computeStats(state, ImmutableList.of(currentRoute)));
System.out.println(Joiner.on("\n").join(schedule)); final StatisticsDTO stats = Solvers.computeStats(state, schedule);
ExtendedStats stats = Solvers.computeStats(state, routes); stats = Solvers.computeStats(state, routes);
.build(); final StatisticsDTO stats = Solvers.computeStats(state, routes); final ObjectiveFunction objFunc = Gendreau06ObjectiveFunction.instance(); final double cost = objFunc.computeCost(stats); final double cost0 = objFunc.computeCost(Solvers.computeStats( state.withSingleVehicle(0), ImmutableList.of(routes.get(0)))); final double cost1 = objFunc.computeCost(Solvers.computeStats( state.withSingleVehicle(1), ImmutableList.of(routes.get(1))));
final ExtendedStats stats = Solvers.computeStats(globalState, routes);
/ MS_TO_MIN; final ExtendedStats stats = Solvers.computeStats( solverInput, solverOutput);
objValInMinutes, 0.2); final StatisticsDTO stats = Solvers.computeStats(solverInput, solverOutput); assertTrue(stats.toString(), obj.isValidResult(stats));
.computeCost(Solvers.computeStats(gso, schedule)) * 60000d; assertThat(rinSimCost).isWithin(0.00001).of(563828.5364288616); .computeCost(Solvers.computeStats(gso2, schedule)) * 60000d; assertThat(rinSimCost2).isWithin(0.00001).of(563828.5364288616);