Exemplo n.º 1
0
        public static void AssignAndSolveForDay(IDataInput dataInput, IDataOutput dataOutput,
                                                VrpProblem vrpProblem, Day day, ConfigParams cfg, int[] VCMinMax)
        {
            CalculateTMWithHaversineFormula(day);

            int min = VCMinMax[0];
            int max = VCMinMax[1];

            while (!day.InfeasibleNodes && max >= min)
            {
                day.SetVehicleNumber(min);
                day.ResetResults();
                vrpProblem.SolveVrpProblem(day, cfg, vrpProblem, dataOutput, VCMinMax);

                if (day.Locations.Count > 1)
                {
                    dataOutput.PrintSolution(vrpProblem.day, vrpProblem.routing, vrpProblem.manager, vrpProblem.solution);
                    dataOutput.PrintStatus(vrpProblem.routing);
                }

                min++;
            }
            foreach (var item in day.DroppedLocations)//Remove unassigned locations from list
            {
                day.Locations.Remove(item);
            }
            foreach (var item in day.Locations)
            {
                if (!item.Infeasible)
                {
                    item.VisitDay = day.DayNum;
                }
            }
        }
Exemplo n.º 2
0
        public static void SolveForAssignedDay(IDataInput dataInput, IDataOutput dataOutput,
                                               VrpProblem vrpProblem, Day day, ConfigParams cfg, int[] VCMinMax)
        {
            //TimeMatrixInit(day, cfg);

            //SaveTimeMatrix(day);
            //LoadTimeMatrix(day);
            CalculateTMWithHaversineFormula(day);

            //vrpProblem.SolveVrpProblem(day, cfg);

            int min = VCMinMax[0];
            int max = VCMinMax[1];

            while (day.LocationDropped && !day.InfeasibleNodes && max >= min)
            {
                day.SetVehicleNumber(min);
                day.ResetResults();

                vrpProblem.SolveVrpProblem(day, cfg, vrpProblem, dataOutput, VCMinMax);

                dataOutput.PrintSolution(vrpProblem.day, vrpProblem.routing, vrpProblem.manager, vrpProblem.solution);
                dataOutput.PrintStatus(vrpProblem.routing);
                min++;
            }
            foreach (var item in day.DroppedLocations)//Remove unassigned locations from list
            {
                day.Locations.Remove(item);
            }

            return;
        }