예제 #1
0
        /// <summary>
        /// Prepares for the next scheduling iteration. This is invoked
        /// at the end of a scheduling iteration. It must return false
        /// if the scheduling strategy should stop exploring.
        /// </summary>
        /// <returns>True to start the next iteration</returns>
        public override bool PrepareForNextIteration()
        {
            ScheduleLength = Math.Max(ScheduleLength, ScheduledSteps);
            ScheduledSteps = 0;

            RemainingDelays.Clear();
            for (int idx = 0; idx < MaxDelays; idx++)
            {
                RemainingDelays.Add(RandomNumberGenerator.Next(ScheduleLength));
            }

            RemainingDelays.Sort();

            CurrentIterationDelays.Clear();
            CurrentIterationDelays.AddRange(RemainingDelays);

            return(true);
        }
        /// <summary>
        /// Prepares for the next scheduling iteration. This is invoked
        /// at the end of a scheduling iteration. It must return false
        /// if the scheduling strategy should stop exploring.
        /// </summary>
        /// <returns>True to start the next iteration</returns>
        public override bool PrepareForNextIteration()
        {
            ScheduleLength = Math.Max(ScheduleLength, ScheduledSteps);
            ScheduledSteps = 0;

            var bound = Math.Min(MaxScheduledSteps, ScheduleLength);

            for (var idx = 0; idx < MaxDelays; idx++)
            {
                if (DelaysCache[idx] < bound)
                {
                    DelaysCache[idx] = DelaysCache[idx] + 1;
                    break;
                }

                DelaysCache[idx] = 0;
            }

            RemainingDelays.Clear();
            RemainingDelays.AddRange(DelaysCache);
            RemainingDelays.Sort();

            return(true);
        }