Fish, cetaceans and many other aquatic vertebrates undulate their bodies to
propel themselves through water. Numerous studies on natural, artificial or
analogous swimmers are dedicated to revealing the links between the kinematics
of body oscillation and the production of thrust for swimming. One of the most
open and difficult questions concerns the best kinematics to maximize this
later quantity for given constraints and how a system strategizes and adjusts
its internal parameters to reach this maximum. To address this challenge, we
exploit a biomimetic robotic swimmer to determine the control signal that
produces the highest thrust. Using machine learning techniques and intuitive
models, we find that this optimal control consists of a square wave function,
whose frequency is fixed by the interplay between the internal dynamics of the
swimmer and the fluid-structure interaction with the surrounding fluid. We then
propose a simple implementation for autonomous robotic swimmers that requires
no prior knowledge of systems or equations. This application to aquatic
locomotion is validated by 2D numerical simulations