The Inverse-dynamics Particle Swarm Optimization has already been successfully applied to several minimum-time problems. This numerical technique based on swarm intelligence is applied to solve optimal control problems formulated with the differentially flat approach. The advantages of this method lie in the global search ability of the optimizer and the reduction of the independent functions due to the exploitation of the differential flatness. However, it is known that optimal control problems formulated with either differential inclusion or differential flatness can lead to nonconvex problems with undesirable numerical properties. This paper in intended to show that, considering difficult problems with nonconvex state constraints and nonconvex cost functions, the proposed numerical technique can lead to satisfactory near-optimal solutions. Minimum-time, minimum-energy and minimum-effort maneuvers are addressed considering a constrained slew-maneuver as a test case.