This paper presents a combination of a nonlinear PD controller and Nelder-Mead algorithm to design an optimal controller for a nonlinear overhead crane system. The nonlinear PD controller is derived based on the passivity of the system and Nelder-Mead algorithm is exploited to find optimal parameters for the controller. The system dynamic model is derived by using Lagrangian equation. Simulations are conducted within Matlab environment to determine the optimal control parameters and to verify the performance of the controller. The simulations demonstrates that the controller is effective to move the trolley as fast as possible to the desired position while the oscillation of the payload is suppressed at the end of the operation. The robustness of the controller against uncertainties in cable length and payload is also indicated by the simulations.