The paper is devoted to application of Cartesian Genetic Programming (CGP) for generating optimal trajectories of a mobile robots group. The problem of a control system synthesis for a mobile robots group is solved. The proposed algorithm uses numerical approach from the class of symbolic regression methods to which Cartesian Genetic Programming belonging. It allows to receive a control function in the form of a mathematical expression. We consider several stages to get optimal trajectories for mobile robots group moving along which the robots wouldn't collide with each other and obstacles. Initially, we solve the problem of synthesis for each robot in order to get the stabilized robot control system relative some point in the state space. At the second stage, spatial trajectories are found along which robots move from the current state to the obtained equilibrium points without collisions. It was proposed to improve an initial algorithm by using the principal of small variation of basic solution. There is considered a group of three robots and the control system for them with phase constraints in the paper. © 2020 IEEE.