Exemplo n.º 1
0
        public static Dictionary <Workbench, List <WorkbenchTimestamp> > Simulate(IEnumerable <Detail> details, out int minTime, out int maxTime)
        {
            var plans             = details.Select(detail => new DetailWorkplan(detail)).ToList();
            var maxWorkbecnhCount = plans.Max(plan => plan.Detail.OrdersDictionary.Count);
            var priorities        = Enumerable.Range(1, maxWorkbecnhCount)
                                    .Select(_ => Enumerable.Range(1, plans.Count).ToList()).ToList();


            minTime = int.MaxValue;
            maxTime = int.MinValue;

            Dictionary <Workbench, List <WorkbenchTimestamp> > timeStamps = null;

            do
            {
                var planTime = SimulatePlan(plans, priorities, out var t);
                if (planTime < minTime)
                {
                    minTime    = planTime;
                    timeStamps = t;
                }

                if (maxTime < planTime)
                {
                    maxTime = planTime;
                }
            } while (CombHelper.NextMultyPermutation(priorities));

            return(timeStamps);
        }