A variational approach for the reduction of transient load sway in overhead cranes