Exemple #1
0
        public bool IsEquivalentTo(Route anotherRoute)
        {
            if (Destinations.Count != anotherRoute.Destinations.Count)
                return false;

            return !Destinations.Where((t, index) => t.Id != anotherRoute.Destinations[index].Id).Any();
        }
        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);
        }
Exemple #4
0
 public Vehicle(short number, decimal maxDistance, Destination startingPoint, Destination endingPoint)
 {
     Number = number;
     MaxDistance = maxDistance;
     Route = new Route(startingPoint, endingPoint);
 }
Exemple #5
0
 public Vehicle(short number, decimal maxDistance, Route route)
 {
     Number = number;
     MaxDistance = maxDistance;
     Route = route;
 }