public GeneticAlgorithms(int size, int genomeLength, double geneMinimum, double geneMaximum, int generations, float crossoverChance, float mutationChance, int tournamentSize, float tournamentChance, bool elitism, float fitnessTreshold, SolutionFoundDelegate sf, StoppedDelegate stp, ImprovementDelegate imp, Graphics gReport, Graphics gReport2, Graphics gReport3, Graphics gFitness, Color backColor, Color foreColor1, Color foreColor2) { rnd = new Random(); Size = size; GenomeLength = genomeLength; GeneMinimum = geneMinimum; GeneMaximum = geneMaximum; Individuals = new Individual[Size]; for (int i = 0; i < Size; i++) { Individuals[i] = new Individual(GenomeLength); for (int n = 0; n < GenomeLength; n++) { Individuals[i].Genome[n] = (float)(GeneMinimum + rnd.NextDouble() * (GeneMaximum - GeneMinimum)); } } BestIndividual = new Individual(GenomeLength); Generations = generations; CrossoverChance = crossoverChance; MutationChance = mutationChance; TournamentSize = tournamentSize; TournamentChance = tournamentChance; Elitism = elitism; FitnessTreshold = fitnessTreshold; SF = sf; STP = stp; IMP = imp; GReport = gReport; GReport2 = gReport2; GReport3 = gReport3; GFitness = gFitness; GReportBuffer = new Bitmap(900, 170); GReport2Buffer = new Bitmap(300, 240); GReport3Buffer = new Bitmap(300, 50); GFitnessBuffer = new Bitmap(1260, 250); GReportBufferG = Graphics.FromImage(GReportBuffer); GReport2BufferG = Graphics.FromImage(GReport2Buffer); GReport3BufferG = Graphics.FromImage(GReport3Buffer); GFitnessBufferG = Graphics.FromImage(GFitnessBuffer); GReportBufferG.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; GReport2BufferG.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; GReport3BufferG.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; GFitnessBufferG.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; BackColor = backColor; ForeColor1 = new SolidBrush(foreColor1); ForeColor2 = new SolidBrush(foreColor2); f = new Font("Arial", 8); f2 = new Font("Arial", 20, FontStyle.Bold); ShowEval = true; ShowImprove = true; }
public GABipedal5Link(int size, int chromosomeLength, float geneMinimum, float geneMaximum, int generations, float crossoverChance, float mutationChance, int tournamentSize, float tournamentChance, bool elitism, float fitnessTreshold, SolutionFoundDelegate sf, StoppedDelegate stp, ImprovementDelegate imp, Graphics gReport, Graphics gReport2, Graphics gReport3, Graphics gFitness, Color backColor, Color foreColor1, Color foreColor2, int steps, double deltaTime, int hipFixSteps, double m, double m1, double m2, double l1, double l2, double kg, double bg, double g, Bipedal5Link.PointD hip, double[] theta, double servoSpeed, Bipedal5Link.Bipedal5Link.YGroundDelegate yGround) : base(size, chromosomeLength, geneMinimum, geneMaximum, generations, crossoverChance, mutationChance, tournamentSize, tournamentChance, elitism, fitnessTreshold, sf, stp, imp, gReport, gReport2, gReport3, gFitness, backColor, foreColor1, foreColor2) { Steps = steps; DeltaTime = deltaTime; HipFixSteps = hipFixSteps; M = m; M1 = m1; M2 = m2; G = g; KG = kg; BG = bg; L1 = l1; L2 = l2; ServoSpeed = servoSpeed; YGround = yGround; Hip = hip; Theta = theta; IndividualsDrawn = false; C1 = Color.FromArgb(35, 22, 0); F1 = new Font("Arial", 8); }
public GeneticAlgorithms(int size, int genomeLength, double geneMinimum, double geneMaximum, int generations, float crossoverChance, float mutationChance, int tournamentSize, float tournamentChance, bool elitism, float fitnessTreshold, SolutionFoundDelegate sf, StoppedDelegate stp, ImprovementDelegate imp, Graphics gReport, Graphics gReport2, Graphics gReport3, Graphics gFitness, Color backColor, Color foreColor1, Color foreColor2) { rnd = new Random(); Size = size; GenomeLength = genomeLength; GeneMinimum = geneMinimum; GeneMaximum = geneMaximum; Individuals = new Individual[Size]; for (int i = 0 ; i < Size ; i++) { Individuals[i] = new Individual(GenomeLength); for (int n = 0 ; n < GenomeLength ; n++) Individuals[i].Genome[n] = (float)(GeneMinimum + rnd.NextDouble() * (GeneMaximum - GeneMinimum)); } BestIndividual = new Individual(GenomeLength); Generations = generations; CrossoverChance = crossoverChance; MutationChance = mutationChance; TournamentSize = tournamentSize; TournamentChance = tournamentChance; Elitism = elitism; FitnessTreshold = fitnessTreshold; SF = sf; STP = stp; IMP = imp; GReport = gReport; GReport2 = gReport2; GReport3 = gReport3; GFitness = gFitness; GReportBuffer = new Bitmap(900, 170); GReport2Buffer = new Bitmap(300, 240); GReport3Buffer = new Bitmap(300, 50); GFitnessBuffer = new Bitmap(1260, 250); GReportBufferG = Graphics.FromImage(GReportBuffer); GReport2BufferG = Graphics.FromImage(GReport2Buffer); GReport3BufferG = Graphics.FromImage(GReport3Buffer); GFitnessBufferG = Graphics.FromImage(GFitnessBuffer); GReportBufferG.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; GReport2BufferG.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; GReport3BufferG.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; GFitnessBufferG.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; BackColor = backColor; ForeColor1 = new SolidBrush(foreColor1); ForeColor2 = new SolidBrush(foreColor2); f = new Font("Arial", 8); f2 = new Font("Arial", 20, FontStyle.Bold); ShowEval = true; ShowImprove = true; }