public static ProblemResourceProvider CreateProblemProvider(Instance instance) { var destinations = instance.Destinies.Select(destiny => new Destination(destiny)).ToList(); var map = new Map(destinations); var vehicleFleet = new VehicleFleet(); for (var index = 0; index < instance.Vehicles; index++) { var route = new Route(destinations.First(), destinations.Last()); var vehicle = new Vehicle(Convert.ToInt16(index + 1), instance.TMax, route); vehicleFleet.Vehicles.Add(vehicle); } return new ProblemResourceProvider(map, vehicleFleet); }
private static ProblemResourceProvider CreateProblemProvider(List<int> profits, List<Coordinate> coordinates, int amountOfVehicles, decimal vehicleMaxDistance) { if (!ValidateArgs(profits, coordinates)) throw new Exception("Argumentos invalidos"); var destinations = new List<Destination>(); for (var index = 0; index < profits.Count(); index++) destinations.Add(new Destination(index, profits[index], coordinates[index])); var map = new Map(destinations); var vehicleFleet = new VehicleFleet(); for (var index = 0; index < amountOfVehicles; index++) { var route = new Route(destinations.First(), destinations.Last()); var vehicle = new Vehicle(Convert.ToInt16(index + 1), vehicleMaxDistance, route); vehicleFleet.Vehicles.Add(vehicle); } return new ProblemResourceProvider(map, vehicleFleet); }