public Schedule Crossover(Schedule aSchedule, float crossoverChance) { if (rand.Next(1000) > crossoverChance * 1000) return aSchedule; int ind = rand.Next(0, activities.Length); Schedule child = new Schedule(dayCount, classPerDayCount); for (int i = 0; i < ind; i++) { child.activities[i] = activities[i]; } for (int i=ind; i<child.activities.Length; i++) { child.activities[i] = aSchedule.activities[i]; } return child; }
public static Schedule CreateRandom(int aDayCount, int aClassPerDayCount) { Schedule temp = new Schedule(aDayCount, aClassPerDayCount); temp.InitializeActivities(); return temp; }