public Individual(AlgoDb algoDb) { //initialize this.algoDb = algoDb; this.invitees = new List <Invitee>(algoDb.invitees); this.tables = new List <Table>(algoDb.tables); this.invitessAmount = invitees.Count; this.tablesAmount = tables.Count; gens = new Gen[invitessAmount]; /* //generate gens list - all invitess with random tables * Gen gen = null; * for (int i = 0; i < gens.Length; i++) * { * gen = generateRandomGen(i); * if(gen != null) * { * gens[i] = gen; * } * } */ for (int i = 0; i < gens.Length; i++) { gens[i] = generateRandomGen(i); } }
public Individual(Individual copyIndividual) { this.algoDb = copyIndividual.algoDb; cloneGens(copyIndividual.getGens()); this.invitees = copyIndividual.invitees; this.tables = copyIndividual.tables; }
public Individual RunAlgo(AlgoDb algoDb) { this.algoDb = algoDb; //Initialize population Population population = new Population(algoDb); population.initializePopulation(AlgoConsts.populationLength); //Calculate fitness of each individual + update Top X population.CalculateIndividualsFitness(); updateTopX(population); //While not break condition while (!breakCondition()) { //Do selection parentsCouplesList = Selection(population); //TODO - population includes individual which doesnt include algoDB! to fix! //Do crossover - get list of paretns - return new pointer for population population = CrossOver(parentsCouplesList); //Do mutation under a random probability if (algoUtils.AlgoRandom(1000) < 5) { population.runMutation(); } //Calculate new fitness value + update top X population.CalculateIndividualsFitness(); updateTopX(population); iterations++; } return(GetIndividualWithBestResult()); }
public Population(AlgoDb algoDb) { this.algoDb = algoDb; this.invitees = new List <Invitee>(algoDb.invitees); this.tables = new List <Table>(algoDb.tables); }
public Population(Individual[] individuals, AlgoDb algoDb) { cloneIndividuals(individuals); this.algoDb = algoDb; }
public Individual(int gensSize, AlgoDb algoDb) { this.algoDb = algoDb; gens = new Gen[gensSize]; }