The problem of determining the optimal initial composition of a reaction mixture was formulated in general terms. The method of solving the formulated problem on the basis of a simulated annealing algorithm was described. Computational experiment was conducted for the Michaelis-Menten enzymatic reaction and the aminomethylation reaction of thiols. Parameters were fitted for efficient algorithm operation. Using the proposed method, the optimal initial composition of a reaction mixture was found to provide a maximum target product yield was found. The efficiency of this algorithm was analyzed by comparison with the results of operation with other optimization methods.