Пример #1
0
 public void InsertInside(Random householdRandom, IActivityEpisode episode, IActivityEpisode into)
 {
     throw new NotImplementedException("Available in the Tasha2 Scheduler");
 }
Пример #2
0
 public void InsertInside(Random householdRandom, IActivityEpisode episode, IActivityEpisode into)
 {
     throw new NotImplementedException( "Available in the Tasha2 Scheduler" );
 }
Пример #3
0
 public bool AssignStartTime(ITashaPerson person, int personIndex, ISchedule[] schedule, IActivityEpisode episode, Random rand)
 {
     throw new NotImplementedException("This method should never be called, either the work or school project should be invoked.");
 }
Пример #4
0
        public bool AssignStartTime(ITashaPerson person, int personIndex, ISchedule[] schedule, IActivityEpisode episode, Random rand)
        {
            switch (episode.Purpose)
            {
            case Activity.PrimaryWork:
                return(PrimaryWorkStartTime(person, personIndex, schedule, episode, rand));

            default:
                throw new XTMFRuntimeException(this, "In '" + Name + "' we received an episode of purpose '" + episode.Purpose + "'");
            }
        }
Пример #5
0
        private bool PrimaryWorkStartTime(ITashaPerson person, int personIndex, ISchedule[] schedule, IActivityEpisode episode, Random rand)
        {
            var personSchedule            = schedule[personIndex];
            var episodeList               = personSchedule.GenerateScheduledEpisodeList();
            var episodeDuration           = episode.Duration;
            List <TimeWindow> timeWindows = new List <TimeWindow>();

            //If there are no episodes in the schedule, then we can place it anywhere
            if (episodeList.Length == 0 || episodeList[0] == null)
            {
                timeWindows.Add(new TimeWindow()
                {
                    StartTime = StartOfDay, EndTime = EndOfDay
                });
                return(GiveStartTimeForPrimaryWork(person, timeWindows, episode, rand));
            }
            //Check before the first episode
            {
                //Check after the last episode
                var firstStartTime = episodeList[0].StartTime;
                if (firstStartTime - StartOfDay >= episodeDuration)
                {
                    timeWindows.Add(new TimeWindow()
                    {
                        StartTime = StartOfDay, EndTime = firstStartTime
                    });
                }
            }
            //Check between each episode
            for (int i = 0; i < episodeList.Length - 1; i++)
            {
                var e = episodeList[i + 1];
                if (e == null)
                {
                    break;
                }
                var endTime   = episodeList[i].EndTime;
                var startTime = episodeList[i + 1].StartTime;
                if (endTime - startTime >= episodeDuration)
                {
                    timeWindows.Add(new TimeWindow()
                    {
                        StartTime = startTime, EndTime = endTime
                    });
                }
            }
            if (episodeList.Length > 1)
            {
                //Check after the last episode
                var lastEpisodeEndTime = episodeList[episodeList.Length - 1].EndTime;
                if (EndOfDay - lastEpisodeEndTime >= episodeDuration)
                {
                    timeWindows.Add(new TimeWindow()
                    {
                        StartTime = lastEpisodeEndTime, EndTime = EndOfDay
                    });
                }
            }
            return(GiveStartTimeForPrimaryWork(person, timeWindows, episode, rand));
        }
Пример #6
0
 private bool GiveStartTimeForPrimaryWork(ITashaPerson worker, List <TimeWindow> timeWindows, IActivityEpisode episode, Random rand)
 {
     throw new NotImplementedException();
 }
Пример #7
0
 private bool GiveStartTimeForPrimaryWork(List <TimeWindow> timeWindows, IActivityEpisode episode)
 {
     throw new NotImplementedException();
 }
Пример #8
0
 public bool AssignStartTime(ITashaPerson person, int personIndex, ISchedule[] schedule, IActivityEpisode episode, Random rand)
 {
     throw new NotImplementedException( "This method should never be called, either the work or school project should be invoked." );
 }