//Misc public static Population OverLearn(SimParams par, Population pop, int[] vacant, List <int> notVacant) { //Get learners and tutors List <int> Learners = vacant.ToList(); List <int>[] Tutors = ChooseMultipleTutors(par, pop, Learners, notVacant, par.NumTutorOverLearn); List <int>[] TutorSyls = new List <int> [Learners.Count]; //Create combined song with all sylls List <int>[] AllSongs; List <int> CollapsedSongs; for (int i = 0; i < Learners.Count; i++) { AllSongs = ListeningTest(par, pop, Tutors[i].ToArray(), par.ListeningThreshold); CollapsedSongs = AllSongs.SelectMany(x => x).ToList(); TutorSyls[i] = CollapsedSongs.Distinct().ToList(); } //Add Syls and update song traits AddSyllables(par, pop, Learners, TutorSyls); UpdateSongTraits(par, pop, Learners); return(pop); }
//Learning Accessory functions private static ConsensusResults ConsensusLearning(SimParams par, Population pop, List <int>[] tutors, List <int> learners) { //Create a consensus based on songs from several males List <int>[] ConsensusSongs = new List <int> [learners.Count]; List <int>[] AddSyls = new List <int> [learners.Count]; List <int>[] AllSongs; List <int> CollapsedSongs; float Conform; for (int i = 0; i < learners.Count; i++) { ConsensusSongs[i] = new List <int> { }; AddSyls[i] = new List <int> { }; AllSongs = ListeningTest(par, pop, tutors[i].ToArray(), par.ListeningThreshold); CollapsedSongs = AllSongs.SelectMany(x => x).ToList(); ConsensusSongs[i] = CollapsedSongs.Distinct().ToList(); for (int j = 0; j < ConsensusSongs[i].Count(); j++) { Conform = ConsensusCalc(par, ConsensusSongs[i][j], CollapsedSongs); if (par.NextFloat() < Conform) { AddSyls[i].Add(ConsensusSongs[i][j]); } } } ConsensusResults Returnable = new ConsensusResults(AddSyls, ConsensusSongs); return(Returnable); }