/// <summary> /// Initializes a new instance of the <see cref="VehicleRouting.SolutionResult"/> class. /// </summary> /// <param name="customers">Customers.</param> /// <param name="numberOfVehicles">Number of vehicles.</param> public SolutionResult(Customer[] customers, int numberOfVehicles) { Customers = customers; Vehicles = new List<Vehicle>(numberOfVehicles); for (int k = 0; k < numberOfVehicles; k++) { var vehicle = new Vehicle(k); vehicle.Path.Add(Customers[0]); Vehicles.Add(vehicle); } }
private Route BuildRoute(Vehicle venicle, List<Request> requests) { if (!requests.Any()) return null; var result = new Route(_venicleInfo) { Venicle = venicle }; foreach (var request in requests) { if (result.IsCanAdd(request)) { if (BruteForceCounter.CurrentOption == BruteForceCounter.MaximumOption) { result.Requests.Add(request); } else { BruteForceCounter.CurrentOption++; } } } return result.Requests.Any() ? result : null; }