The article is devoted to the development of a numerical algorithm for optimal selection of initial conditions of the Cauchy problem and its application to the problem of optimal selection of initial concentrations of substances in a chemical reaction. In general form, the problem of determining the optimal composition of the reaction mixture is formulated based on the kinetic model of the reaction. A step-by-step algorithm has been developed to solve the problem using the penalty method and the Hooke-Jeeves method. The advantage of the algorithm is that it takes into account the physical and chemical features of the problem. Based on the formulated algorithm, a software package has been developed for the catalytic reaction of the synthesis of N-(adamantyl)acetamide. With its help, the optimal concentrations of the reaction reagents were calculated, at which the highest concentration of the target product is achieved.