1

What is the fitness function used to solve an inverted pendulum ?

I am evolving neural networks with genetic algorithm. And I don't know how to evaluate each individual.

I tried minimize the angle of pendulum and maximize distance traveled at the end of evaluation time (10 s), but this won't work.

inputs for neural network are: cart velocity, cart position, pendulum angular velocity and pendulum angle at time (t). The output is the force applied at time (t+1)

thanks in advance.

user1931907
  • 41
  • 10

1 Answers1

0

I found this paper which lists their objective function as being:

Equation1

Defined as:

Equation2

where "Xmax = 1.0, thetaMax = pi/6, _X'max = 1.0, theta'Max = 3.0, N is the number of iteration steps, T = 0.02 * TS and Wk are selected positive weights." (Using specific values for angles, velocities, and positions from the paper, however, you will want to use your own values depending on the boundary conditions of your pendulum).

The paper also states "The first and second terms determine the accumulated sum of normalised absolute deviations of X1 and X3 from zero and the third term when minimised, maximises the survival time."

That should be more than enough to get started with, but i HIGHLY recommend you read the whole paper. Its a great read and i found it quite educational.

You can make your own fitness function, but i think the idea of using a position, velocity, angle, and the rate of change of the angle the pendulum is a good idea for the fitness function. You can, however, choose to use those variables in very different ways than the way the author of the paper chose to model their function.

It wouldn't hurt to read up on harmonic oscillators either. They take the general form:

mx" + Bx' -kx = Acos(w*t)

(where B, or A may be 0 depending on whether or not the oscillator is damped/undamped or driven/undriven respectively).

Community
  • 1
  • 1
Grant Williams
  • 1,469
  • 1
  • 12
  • 24
  • thank you very much for your answer, I tried also to maximise the duration of balancing the pole, but didn't find how to make the cart move within track borders... any ways, I will try the fitness of this article I see what happen – user1931907 Mar 12 '15 at 23:46