Using metaheuristics, such as the Evolutionary Algorithm (EA), within control structures is a realistic approach for certain optimal control problems. Their role is often predicting the optimal control values over a prediction horizon using a process model (PM). The big computational effort sometimes causes problems. Our work addresses a new issue: whether a machine learning (ML) algorithm could “learn” the optimal behaviour of the couple (EA, PM). A positive answer is given by proposing datasets apprehending this couple's optimal behaviour and appropriate ML models. Following a design procedure, a number of closed-loop simulations will provide the sequences of optimal control and state values, which are collected and aggregated in a data structure. For each sampling period, datasets are extracted from the aggregated data. The ML algorithm experiencing these datasets will produce a set of regression functions. Replacing the EA predictor with the ML model, new simulations are carried out, proving that the state evolution is almost identical. The execution time decreases drastically because the PM’s numerical integrations are totally avoided. The performance index equals the best-known value. In different case studies, the ML models succeeded in capturing the optimal behaviour of the couple (EA, PM) and yielded efficient controllers.