Skip to content

Commit 1ec11a6

Browse files
author
maximilian
committed
translation
1 parent aca1848 commit 1ec11a6

8 files changed

Lines changed: 15 additions & 13 deletions

File tree

pics/evo-0.png

-514 KB
Loading

pics/evo-1.png

-161 KB
Loading

pics/evo-2.png

-156 KB
Loading

pics/evo-3.png

-206 KB
Loading

pics/evo-4.png

-184 KB
Loading

pics/evo-5.png

-191 KB
Loading

pics/evo-6.png

-485 KB
Loading

testbenches/testbench_pid_pt2_evolutionPyGAD.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@
99
import time
1010
import pygad
1111

12-
# Hyperparameter
12+
# Hyperparameters
1313

14-
# Anzahl der Gene
14+
# number of genes
1515
num_genes = 3
16-
# Anzahl der Generationen
16+
# number of generations
1717
num_generations = 20
18-
# Anzahl der Chromosomen
18+
# number of chromosomes
1919
sol_per_pop = 10
20-
# Anzahl der Eltern
20+
# number of parents
2121
num_parents_mating = 10
22-
# Wahrscheinlichkeit zur Mutation
22+
# probably of mutation
2323
mutation_percent_genes = 34
2424

25-
# untere Grenze der Zufallszahl
25+
# lower limit of the random number
2626
init_range_low = 0
27-
# obere Grenze der Zufallszahl
27+
# upper limit of the random number
2828
init_range_high = 100
29-
# Datentyp
29+
# data type
3030
gene_type = float
3131

3232

@@ -53,13 +53,15 @@ def fitness_func(ga_instance, solution, solution_idx):
5353
pid_control.update_params(p, i, d)
5454
pt2.reset()
5555

56+
ww = 0
5657
for w in w_lst:
5758
e = w - x
5859
y = pid_control.get_xa(e)
5960
x = pt2.get_xa(y)
6061
x_lst.append(x)
62+
ww = w
6163

62-
fitness = rating.get_update_rating(x_lst, w)
64+
fitness = rating.get_update_rating(x_lst, ww)
6365

6466
return fitness
6567

@@ -88,9 +90,9 @@ def fitness_func(ga_instance, solution, solution_idx):
8890

8991
solution, solution_fitness, solution_idx = ga_instance.best_solution()
9092

91-
print("Benötigte Zeit:", tm)
92-
print("Beste Parameter:", solution)
93-
print("Höchster Fitnesswert:", solution_fitness)
93+
print("Required time:", tm)
94+
print("Best parameters:", solution)
95+
print("Highest fitness value:", solution_fitness)
9496
ga_instance.plot_fitness()
9597
####################################################
9698
# plot the fittest control loop

0 commit comments

Comments
 (0)