This algorithm runs the simulation of the inverted pendulum iteratively to optimizes its controllers parameters.
With the mathematical model of the systems plant it is possible to simulate it in various conditions and evaluate its output. This algorithm finds a local minimum cost function with derivative-free method based on a priori calculated feedback controller. The cost function of the system is calculated with the mean squere erros of all four states with weights assigned to each state based on the linear–quadratic regulator (LQR) controll design.