A method for determining an optimal configuration of the beams (b i)of a LiDAR system (LiD) intended to perform a specific task, in which method: - an actual performance associated with a configuration of the beams corresponds to a quality of the result of an execution of said specific task by said LiDAR system (LiD) configured according to this configuration; - a predicted performance of a configuration is a prediction of an actual performance associated with this configuration; said method comprising: (i) an exploration step comprising at least one iteration (I t) of the substeps: (a) selecting (E20A) a new configuration from among at least one potential configuration (CLP k t) of the LiDAR system (LiD), said selecting being performed according to an exploration strategy for which a configuration, whose predicted performance (VP t) is the best among said at least one potential configuration, has a higher chance to be selected, the predicted performance of a configuration being assigned by an initial prediction function, said initial prediction function being a machine learning model; (b) obtaining (E20B) an actual performance (VT t) associated with said new configuration (CL t); (c) obtaining (E20C) a new history (H t) by adding said new configuration (CL t) and its said actual performance (VT t) associated with an initial history (H t-1), (d) obtaining (E20D) a new prediction function (NN t+1) by modifying said initial prediction function (NN t) in such a way that it assigns, to at least one configuration (CL n) included in the new history (H t), at least one predicted performance (VP n t) that is as close as possible to the associated at least one actual performance (VT n); said new history (H t) and said new prediction function (NN t+1) constituting, respectively, said initial history (H t-1) and said initial prediction function (N t), for a next iteration of the exploration step, until a stopping criterion of the exploration step is satisfied; (ii) determining said optimal configuration as being the configuration (CL n) having the best associated actual performance (VT n), among the new history (H t). - an actual performance associated with a configuration of the beams corresponds to a quality of the result of an execution of said specific task by said LiDAR system (LiD) configured according to this configuration; - a predicted performance of a configuration is a prediction of an actual performance associated with this configuration; (i) an exploration step comprising at least one iteration (I t) of the substeps: (a) selecting (E20A) a new configuration from among at least one potential configuration (CLP k t) of the LiDAR system (LiD), said selecting being performed according to an exploration strategy for which a configuration, whose predicted performance (VP t) is the best among said at least one potential configuration, has a higher chance to be selected, the predicted performance of a configuration being assigned by an initial prediction function, said initial prediction function being a machine learning model; (b) obtaining (E20B) an actual performance (VT t) associated with said new configuration (CL t); (c) obtaining (E20C) a new history (H t) by adding said new configuration (CL t) and its said actual performance (VT t) associated with an initial history (H t-1), (d) obtaining (E20D) a new prediction function (NN t+1) by modifying said initial prediction function (NN t) in such a way that it assigns, to at least one configuration (CL n) included in the new history (H t), at least one predicted performance (VP n t) that is as close as possible to the associated at least one actual performance (VT n); said new history (H t) and said new prediction function (NN t+1) constituting, respectively, said initial history (H t-1) and said initial prediction function (N t), for a next iteration of the exploration step, until a stopping criterion of the exploration step is satisfied; (a) selecting (E20A) a new configuration from among at least one potential configuration (CLP k t) of the LiDAR system (LiD), said selecting being performed according to an exploration strategy for which a configuration, whose predicted performance (VP t) is the best among said at least one potential configuration, has a higher chance to be selected, the predicted performance of a configuration being assigned by an initial prediction function, said initial prediction function being a machine learning model; (b) obtaining (E20B) an actual performance (VT t) associated with said new configuration (CL t); (c) obtaining (E20C) a new history (H t) by adding said new configuration (CL t) and its said actual performance (VT t) associated with an initial history (H t-1), (d) obtaining (E20D) a new prediction function (NN t+1) by modifying said initial prediction function (NN t) in such a way that it assigns, to at least one configuration (CL n) included in the new history (H t), at least one predicted performance (VP n t) that is as close as possible to the associated at least one actual performance (VT n); (ii) determining said optimal configuration as being the configuration (CL n) having the best associated actual performance (VT n), among the new history (H t).