public static HashSet <IGPChromosome> GenerateAllCombinations(SocialGPChromosome socialChromosome) { var allSubCombinations = new GPChromosome[socialChromosome.NumAgents][]; for (var i = 0; i < socialChromosome.NumAgents; i++) { //adds sub-element and all its combinations to list var gpChromosome = (GPChromosome)socialChromosome[i]; var allChromCombs = Learning.IMRL.EC.Util.GenerateAllCombinations(gpChromosome).ToList(); allChromCombs.Add(gpChromosome); var allChromCombsArray = new GPChromosome[allChromCombs.Count]; for (var j = 0; j < allChromCombs.Count; j++) { allChromCombsArray[j] = (GPChromosome)allChromCombs[j]; } allSubCombinations[i] = allChromCombsArray; } //makes combinations with all chromosomes var chromCombs = allSubCombinations.AllCombinations(); var allCombinations = new HashSet <IGPChromosome>(); foreach (var chromComb in chromCombs) { allCombinations.Add(new SocialGPChromosome(chromComb)); } return(allCombinations); }
public override List <ITestParameters> GetSpecialTestParameters(IScenario scenario) { var specialParams = base.GetSpecialTestParameters(scenario); for (var i = 0; i < specialParams.Count; i++) { specialParams[i] = new SocialGPChromosome( ((ISocialScenario)scenario).NumAgents, (GPChromosome)specialParams[i]); } return(specialParams); }
public SocialGPFitnessTest(SocialScenario scenario, SocialGPChromosome chromosome) : base(scenario, chromosome) { }