This example app demonstrates the following features:
- Add an optimization with multiple vehicles and only one set of vehicle constraints set on all the vehicles and display the solution on the map.
Create an optimization where all vehicles have the same constraints (the same start time, end time, maximum distance to be traveled, etc).
When you run the example app, an optimization will be saved, the solution will be returned and showed on map.
- Create a
vrp::OrderListand add the orders to it. Each order needs to have a customer set; you can either add a new customer and then set it to the order, or you can use a previously created customer (see Get Customer example). - Create a
vrp::VehicleConstraintswith the desired fields and add it to avrp::VehicleConstraintsList. Thevrp::VehicleConstraintswill be applied to all the vehicles. - Create a
vrp::Optimizationand set the objects created at 1.) and 2.) to it. Also set the vehicles (at least two). - Create a
ProgressListener,vrp::Service, and avrp::Requestthat will be used to track the request status. - Call the
addOptimization()method fromvrp::Serviceusing the request from 4.), thevrp::Optimizationfrom 3.), and the progress listener. - After adding the optimization, monitor the request status. Once it reaches a finished state, retrieve the optimization results by calling the
getSolution()method, which returns avrp::RouteListcontaining the generated routes.
- Create a
MapServiceListener,OpenGLContextandMapView. - Create a
LandmarkList,CoordinatesListandPolygonGeographicArea. - Instruct the
MapViewto highlight theLandmarkListfrom 2.) to print the orders, departures and destinations. - Instruct the
MapViewto center on thePolygonGeographicArea. - Create a
MarkerCollectionof typePolylinefor each route and add the routes shapes to them. - Set the newly created
MarkerCollectionin the markers collections of the map view preferences. - Allow the application to run until the map view is fully loaded.

