public void CreateInitialPopulation() { // initial population this.Population = new List <Gen>(); for (int i = 0; i < this.GenerationsNumber; i++) { // ingresa uin nuevo gen a la poblacion List <Agent> AgentListAux = AgentList.Select(agent => new Agent(agent)).ToList(); Gen gen = new Gen(AgentListAux); gen.CreateGen(RequestedServiceList); this.Population.Add(gen); } }
/*Creara el nuevo gen en a sus padres(Cruce)*/ public Gen CreateChildGen(Gen pParent1, Gen pParent2) { List <Agent> AgentListAux = AgentList.Select(agent => new Agent(agent)).ToList(); List <Agent> crossedGen = Crossing(pParent1, pParent2); //Gen nuevo vacio Gen child = new Gen(AgentListAux); //Crea los objetos nuevos para no referenciar a objetos anteriores child.CreateChildGen(crossedGen, RequestedServiceList); child.Mutation(RequestedServiceList); child.ManipulatedMutation(RequestedServiceList); return(child); }