December 2019
Intermediate to advanced
368 pages
11h 10m
English
Using the number of successful simulation steps returned by the run_cart_pole_simulation function described earlier, we are ready to implement the genome fitness evaluation function:
steps = run_cart_pole_simulation(net, max_bal_steps)
log_steps = math.log(steps) log_max_steps = math.log(max_bal_steps) # The loss value is in range [0, 1] error = (log_max_steps - log_steps) / log_max_steps # The fitness value is a complement of the loss value fitness = 1.0 - error
Read now
Unlock full access