Nonlocality of quantum states is usually verified via the violation of a Bell inequality. Determining if a Bell inequality is preserved or violated for a given state is in general a high-dimensional nonlinear constrained optimization problem. In this work a general numerical optimization approach based on the Euler angle parameterization of SU(N) is proposed. It is not restricted to a certain Bell inequality and can be used for all kinds of qudit systems. As a first application, the method is adapted to the CGLMP-Bell inequality for qutrits and density matrices consisting of mixtures of maximally entangled states. We also utilize this method to improve bounds of a recently proposed multipartite entanglement measure. The comparison of both results explicitly demonstrates that nonlocality detected by the CGLMP-Bell inequality and the amount of entanglement revealed by the measure behave differently, i.e. in general there is no simple relation between Bell inequality violation and the amount of entanglement.