public static string PrintChromosome(this Chromosome chromosome, GA.Environment environment) { string distStr = ""; for (int i = 0; i < chromosome.Distances.Count - 1; i++) { distStr += chromosome.Distances[i].PrintNumber() + ":"; } distStr += chromosome.Distances.Last().PrintNumber(); string str = string.Format( @"F: {3} | D: {0} | BD: {1} | B {2}:- ", chromosome.Distance.PrintNumber(), distStr, chromosome.BalanceProportion.PrintNumber(), chromosome.GetOneFit(environment.Alpha, environment.Beta).PrintNumber() ); for (int i = 0; i < chromosome.genes.Count - 1; i++) { str += chromosome.genes[i].ToString() + "-"; } str += chromosome.genes.Last().ToString(); return(str); }
public TSPManager(DistanceOperator dOp, int travellerAmount, int depoId, NextGenerationEventHandler nextGenerationEventHandler = null) { this.dOp = dOp; Environment = new TSPAnde.Lib.GA.Environment(); Environment.TravelersAmount = travellerAmount; Environment.DepoId = depoId; DistanceOperator.InitializeOperator(dOp, Environment); Population = new Population(Environment); NextGenerationEvent = nextGenerationEventHandler; }
public static void Start(Population population, DistanceOperator dOp, TSPAnde.Lib.GA.Environment environment) { Environment = environment; Population = population; // population.Init(travelers: TSPAnde.Lib.GA.Environment.travelers, depo : 1); }
public static void InitializeOperator(DistanceOperator op, GA.Environment environment) { environment.CityAmount = op.Size; dOperator = op; }