public CourseScheduleEntry(CourseScheduleEntry x) { group = x.group; course = x.course; instructor = x.instructor; time = x.time; day = x.day; room = x.room; }
public void RandomInitialize() { Random rng = new Random(); for (int i = 0; i < popSize; i++) { Schedule newSchedule = new Schedule(i); foreach (var cl in groups) { foreach (var course in cl.courses) { for (var j = 0; j < course.MinHours; j++) { byte _day = 0; byte _time = 0; var freeInstructors = new List <Instructor>(); var freeRooms = new List <Room>(); while (_day < daysCount) { freeRooms = GetFreeRooms(newSchedule, _day, _time, course.capacity); freeInstructors = GetFreeQualifiedInstructors(newSchedule, course, _day, _time); if (freeRooms.Count > 0 && freeInstructors.Count > 0) { break; } else { _time++; if (_time == timeSlotsCount) { _day++; _time = 0; } } } var newEntry = new CourseScheduleEntry(cl, course) { group = cl, room = freeRooms[rng.Next(freeRooms.Count)], instructor = freeInstructors[rng.Next(freeInstructors.Count)], day = _day, time = _time, }; newSchedule.Entries.Add(newEntry); } } } schedules.Add(newSchedule); } }