Gradient-free optimal control? I have an existing dynamics simulation that provides a calculation of the state derivative: dx/dt = f(x,u). 

I would like to solve for the state and control-input trajectories solving an optimal control problem given by an initial state, a final cost metric, and state/control-input costs and constraints.

Because the state derivative is implemented in C, it's hard to take derivatives (except numerically).

What would be the best way to approach this problem? Is there an existing solver that would be relatively easy to plug into?