In this study, we consider the extended optimal control problem and search for a control function in the class of feasible functions for a real control object. Unlike the classical optimal control problem, the control function should depend on the state, not time. Therefore, the control synthesis problem for the initial-state domain should be solved, instead of the optimal control problem with one initial state. Alternatively, an optimal trajectory motion stabilisation system may be constructed. Both approaches—control and trajectory motion stabilisation system syntheses—cannot be applied to real-time control, as the task is too complex. The minimum threshold of quality criteria is searched for in the space of mathematical expression codes. Among other problems, the search space is difficult to define and the gradient is hard to determine. Therefore, the advanced control object model is used to obtain a feasible control function. The advanced model is firstly obtained before solving the optimal control problem and it already includes a trajectory motion stabilisation system; in particular, this stabilisation system is synthesised in advance at the control system design stage. When the optimal control problem appears, it is solved in real time in the classical statement, and a control function is searched for as a function of time. The advanced control object model also uses the reference model to generate the optimal trajectory. The search for the optimal control function is performed in real time and considers the synthesised stabilisation system of motion along a determined trajectory. Machine learning control via symbolic regression, namely, the network operator method, is used to directly solve the control synthesis problem. An example solution of the optimal control problem, with an advanced model moving in the environment with obstacles for a group of two mobile robots, is presented. The obtained solution is a control function for a reference model that generates a trajectory from a class of trajectories stabilised with the object’s control system.