public Individual(FlightInstruction[] chromosome) { Chromosome = new FlightInstruction[chromosome.Length]; for (int i = 0; i < chromosome.Length; i++) { Chromosome[i] = new FlightInstruction(chromosome[i].TiltAngle, chromosome[i].ThrustPower); } }
public Shuttle(Shuttle shuttle, Surface surface) : this(surface) { CurrentLocation = new Point(shuttle.CurrentLocation.X, shuttle.CurrentLocation.Y); CurrentFlightInstruction = new FlightInstruction(shuttle.CurrentFlightInstruction.TiltAngle, shuttle.CurrentFlightInstruction.ThrustPower); HorizontalSpeed = shuttle.HorizontalSpeed; VerticalSpeed = shuttle.VerticalSpeed; RemainingFuel = shuttle.RemainingFuel; FlightStatus = shuttle.FlightStatus; }
private void EvalPopulation(Population population) { Parallel.ForEach(population.Individuals, individual => { CalcFitness(individual); }); population.PopulationFitness = 0; foreach (Individual individual in population.Individuals) { population.PopulationFitness += individual.Fitness; } EliteIndividual = new Individual(population.GetFittest(0).Chromosome); BestFlightInstruction = new FlightInstruction(EliteIndividual.Chromosome[0]); }
public FlightInstruction(FlightInstruction flightInstruction) { TiltAngle = flightInstruction.TiltAngle; ThrustPower = flightInstruction.ThrustPower; }