--
You received this message because you are subscribed to the Google Groups "jsprit-mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsprit-mailing-...@googlegroups.com.
To post to this group, send email to jsprit-ma...@googlegroups.com.
Visit this group at http://groups.google.com/group/jsprit-mailing-list.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "jsprit-mailing-list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jsprit-mailing-list/KipEbXbSZXQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jsprit-mailing-...@googlegroups.com.
--
final int WEIGHT_INDEX = 0;
VehicleTypeImpl.Builder vehicleTypeBuilder = VehicleTypeImpl.Builder.newInstance("vehicleType").addCapacityDimension(WEIGHT_INDEX, 11000);
VehicleType vehicleType = vehicleTypeBuilder.build();
/*
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
*/
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
final GeoPoint onyx = MapUtilities.getOnyxGeoPointInstance();
vehicleBuilder.setStartLocation(Location.newInstance(onyx.getLatitude(), onyx.getLongitude()));
vehicleBuilder.setType(vehicleType);
List<VehicleImpl> vehicles = new ArrayList<VehicleImpl>(vehicleNumber);
VehicleImpl vehicle = vehicleBuilder.build();
vehicles.add(vehicle);
Map<String, TruckStop> truckStopMap = new HashMap<String, TruckStop>();
int i = 1;
List<Service> services = new ArrayList<Service>();
for(GateStops gateStop : currentStops) {
for (TruckStop stop : gateStop.getStops()) {
truckStopMap.put(""+i, stop);
Service service = Service.Builder.newInstance(""+i)
.addSizeDimension(WEIGHT_INDEX,(int)stop.getPounds())
.setLocation(Location.newInstance(stop.getAddress().getLocation().getLatitude(), stop.getAddress().getLocation().getLongitude()))
.build();
services.add(service);
i++;
}
}
/*
* again define a builder to build the VehicleRoutingProblem
*/
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
vrpBuilder.addAllVehicles(vehicles);
vrpBuilder.addAllJobs(services);
VehicleRoutingTransportCosts transportCosts = new GreatCircleCosts(); // VRPTransportCosts();
vrpBuilder.setRoutingCost(transportCosts);
/*
* build the problem
* by default, the problem is specified such that FleetSize is INFINITE, i.e. an infinite number of
* the defined vehicles can be used to solve the problem
* by default, transport costs are computed as Euclidean distances
*/
VehicleRoutingProblem problem = vrpBuilder.build();
problem.getTransportCosts();
/*
* get the algorithm out-of-the-box.
*/
Builder builder = Jsprit.Builder.newInstance(problem);
VehicleRoutingAlgorithm algorithm = builder.buildAlgorithm();
/*
* and search a solution which returns a collection of solutions (here only one solution is constructed)
*/
Collection<VehicleRoutingProblemSolution> solutions = algorithm.searchSolutions();
/*
* use the static helper-method in the utility class Solutions to get the best solution (in terms of least costs)
*/
VehicleRoutingProblemSolution bestSolution = Solutions.bestOf(solutions);
Hi Scott,
Can you use this instead of your own implementation? It is also the Haversine formula. Have you tested whether the distance/time between two points is the expected distance? Which algorithm do you use? Try Jsprit.createAlgorithm(vrp).
Best,
Stefan
Am 23/10/15 um 21:26 schrieb Scott Onyx Harmon:
Here is an example of the strange behavior:--
On Friday, October 23, 2015 at 10:55:18 AM UTC-5, Scott Onyx Harmon wrote:Hello All!
I'm fairly new to the VRP, but I am trying to use this library to suggest optimizations and construct routes. I have a list of stops with weights and lat,lon's. I have a weight constraint on trucks. I fed this into the vsprit engine, using a custom VRPTransportCosts class (I took the Euclidian distance one and modified it to estimate driving distance between a pair of lat, lon coordinates). I have one depot.
The engine finds a solution, but the solution is always pretty obviously sub-optimal (just by looking at the map, I can see stops that should be swapped in routes). I also tried to get the "costs" of the "best" solution that the engine gave and the costs seem to be much lower than the total drive distance (which makes me think I've done something wrong here).
Any direction would be appreciated.
Thanks!
You received this message because you are subscribed to the Google Groups "jsprit-mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsprit-mailing-list+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to jsprit-mailing-...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to jsprit-mailing-...@googlegroups.com.
To post to this group, send email to jsprit-ma...@googlegroups.com.
Visit this group at http://groups.google.com/group/jsprit-mailing-list.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "jsprit-mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsprit-mailing-...@googlegroups.com.
To post to this group, send email to jsprit-ma...@googlegroups.com.
Visit this group at http://groups.google.com/group/jsprit-mailing-list.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "jsprit-mailing-list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jsprit-mailing-list/KipEbXbSZXQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jsprit-mailing-...@googlegroups.com.
--