public ScheduleOld CrossOver(ScheduleOld parent2) 
        {
            if (_random.Next(100) > _crossoverProbability)
                return new ScheduleOld(this, false);

            ScheduleOld s = new ScheduleOld(this, true);
            int numberOfClasses = _classes.Count;
            bool[] cp = new bool[numberOfClasses];
            for (int i = _numberOfCrossoverPoints; i > 0; i--)
            {
                while (true)
                {
                    int p = _random.Next(numberOfClasses);
                    if (!cp[p])
                    {
                        cp[p] = true;
                        break;
                    }
                }
            }
            var classes1 = _classes.GetEnumerator();
            var classes2 = parent2._classes.GetEnumerator();
            bool first = _random.Next(0,2)==0;
            for (int i = 0; i < numberOfClasses; i++)
            {
                classes1.MoveNext();
                classes2.MoveNext();
                if (first)
                {
                    s._classes.Add(classes1.Current.Key, classes1.Current.Value);
                    for (int j = classes1.Current.Key.Length - 1; j >= 0; j--)
                    {
                        s._timeslots[classes1.Current.Value + j].Add(classes1.Current.Key);
                    }
                }
                else
                {
                    s._classes.Add(classes2.Current.Key, classes2.Current.Value);
                    for (int j = classes2.Current.Key.Length - 1; j >= 0; j--)
                    {
                        s._timeslots[classes2.Current.Value + j].Add(classes2.Current.Key);
                    }
                }
                if (cp[i]) first = !first;
                
            }
            s.CalculateFitness();
            return s;
        }
        public ScheduleOld CreateNewFromPrototype() 
        {
            int size = _timeslots.Length;
            ScheduleOld newChromosome = new ScheduleOld(this, true);

            List<CourseClass> classes = Configuration.GetInstance().CourseClasses;
            int roomCount = Configuration.GetInstance().Rooms.Count;
            foreach (CourseClass c in classes)
            {
                int duration = c.Length;
                int day = _random.Next(Constants.DAYS);
                int room = c.RequiresLab ? Configuration.GetInstance().GetLabRoom().ID : Configuration.GetInstance().GetNonLabRoom().ID;
                int time = _random.Next(Constants.HOURS_PER_DAY + 1 - duration);
                int pos = day * roomCount * Constants.HOURS_PER_DAY + room * Constants.HOURS_PER_DAY + time;
                for(int i = duration-1;i>=0;i--)
                {
                    newChromosome._timeslots[pos+i].Add(c);
                }
                newChromosome._classes.Add(c, pos);
            }
            newChromosome.CalculateFitness();
            return newChromosome;
        }