def afpo(self): envs = ENVIRONMENTS() print('envs to run:', c.envsToRun, ' pop init:', c.num_rand_phc + len(self.fit_ids)) parents = POPULATION(c.num_rand_phc + len(self.fit_ids)) parents.InitializeRandomPop() # parents = self.phc_ga(parents, envs, c.afpo2_phc_gens) # print('\n############# phc done #############\n') parents.Evaluate(envs, False, True) for i in range(0, len(parents.p)): parents.p[i].age += i # for i in range(0, len(parents.p)): # print('p[' + str(i) + '].age =', parents.p[i].age) print("Initial population age adjusted") parents.Print() finalpop = self.af_pareto_ga(parents, envs) frontinds = self.af_pareto_math(finalpop.GetAges(), finalpop.GetFits()) finalpopfront = POPULATION(len(frontinds)) for i in range(0, len(frontinds)): finalpopfront.p[i] = finalpop.p[frontinds[i]] finalpopfront.Pickling618() self.ShowEvaluatePop(finalpopfront, envs, pp=True, pb=False)
def afpo(self): envs = ENVIRONMENTS() print('envs to run:', c.envsToRun, ' pop init:', c.num_rand_phc + len(self.fit_ids)) parents = POPULATION(c.num_rand_phc + len(self.fit_ids)) parents.InitializeRandomPop() parents = self.phc_ga(parents, envs, c.afpo2_phc_gens) print('\n############# phc done #############\n') for i in range(0, len(parents.p)): parents.p[i].age += i for i in range(0, len(parents.p)): print('p[' + str(i) + '].age =', parents.p[i].age) # 3rd arg gens=2 by default parents = self.af_pareto_ga(parents, envs, c.afpo2_afpo_gens) parents.Pickling618()
def combo_simple_phc_ga(self): envs = ENVIRONMENTS() # parents = POPULATION(c.num_rand_phc) # print('envs:', c.envsToRun, ' pop init:', c.num_rand_phc) # parents.InitializeRandomPop() # parents.Evaluate(envs, False, True) pop_phc = POPULATION(c.combo_ga_num_slots) for k in range(0, c.combo_ga_num_slots): print("***** Slot number", k, "*****") pop_phc.p[k] = self.simple_ga(envs) pop_phc.p[k].ID = k pop_phc = self.phc_ga(pop_phc, envs) pop_phc.Pickling618() self.ShowEvaluatePop(pop_phc, envs, True, False)