Bio-inspired techniques are commonly used in robotics. In this work we used the Central Pattern Generator (CPG) concept to generate gait commands in a humanoid robot. They were modeled through nonlinear ordinary differential equations (ODEs) and a difficult task is to obtain the parameters of the oscillators in order to obtain a suitable gait. In this work, we used Particle Swarm Optimization (PSO) and Genetic Algorithm (GA) to obtain the parameters of the oscillators. Using a fitness function that focus on a efficiently gait it was possible to obtain suitable gaits through either methods.