LQR Control
Linear-Quadratic Regulator (LQR) is an optimal control strategy.
Optimality
LQR finds a control law that minimizes a cost function, typically balancing performance (minimizing error) and effort (minimizing control input).
For the cart-pole, LQR is excellent at balancing the pole once it is near the upright position.