예제 #1
0
        public static Brkga Get(Solution solution)
        {
            throw new Exception();

            //var problemDecoder = new ProblemDecoder();
            //var populationGenerator = new PopulationGenerator(problemDecoder, );
            //var brkga = new Brkga();
        }
예제 #2
0
        public Vehicle GetNextAvailableVehicleFor(Solution solution, Destination destination, int currentVehicleNumber)
        {
            while (currentVehicleNumber <= solution.VehicleFleet.Vehicles.Count)
            {
                var currentVehicle = solution.VehicleFleet.GetByNumber(currentVehicleNumber);

                var distanceFromCurrentDestinationToNewDestination = solution.Map.GetDistance(currentVehicle.Route.CurrentLastDestination, destination);
                var distanceFromNewDestinationToEnding = solution.Map.GetDistance(destination, currentVehicle.Route.EndingPoint);

                if (currentVehicle.Route.GetDistanceWithoutFinalReturn(solution.Map) + distanceFromCurrentDestinationToNewDestination + distanceFromNewDestinationToEnding <= currentVehicle.MaxDistance)
                    return currentVehicle;

                currentVehicleNumber++;
            }
            return null;
        }