To describe and test TopasOpt: a free, open-source and extensible library for performing mathematical optimization of Monte Carlo simulations in Topas. TopasOpt enables any Topas model to be transformed into an optimization problem, and any parameter within the model to be treated as an optimization variable. Three case studies are presented. The starting model consists of a 10 MeV electron beam striking a tungsten target. The resulting bremsstrahlung X-ray spectrum is collimated by a primary and secondary collimator before being scored in a water tank. In the first case study (electron phase space optimization), five parameters describing the electron beam were treated as optimization variables and assigned a random starting value. An objective function was defined based on differences of depth-dose and profiles in water between the original (ground truth) model and a given model generated by TopasOpt. The problem was solved using Bayesian Optimization and the Nelder-Mead method. One hundred iterations were run in each case. In the second case study, (collimator geometry optimization), this process was repeated, but three geometric parameters defining the secondary collimator were treated as optimization variables and assigned random starting values, and forty iterations were run. In the third case study, the optimization was repeated with different number of primary particles to study the effect of noise on convergence. For case 1 (phase space optimization), both optimization algorithms successfully minimized the objective function, with absolute mean differences in profile dose of 0.4% (Bayesian) and 0.3% (Nelder-Mead) and 0.2% in depth-dose for both algorithms. The beam energy was recovered to within 1%, however some parameters had relative errors of up to 171% - a result consistent with the known X-ray dose is insensitivity to many electron beam parameters. For case 2 (geometry optimization), absolute mean differences in profile dose were 0.6% (Bayesian) and 0.9% (Nelder-Mead), and 0.5% and 0.9% in depth-dose. The maximum percentage error in any parameter was 9% with Bayesian Optimization and 28% with Nelder-Mead. Finally, the Bayesian Optimization algorithm was demonstrated to be robust to moderate levels of noise; when the standard deviation of the objective function was 16% of the mean, the maximum error in any parameter value was 16%, and the absolute mean difference in dose was 0.9% (profile) and 0.8% (depth-dose). An open-source library for optimization with Topas Monte Carlo has been developed, tested, and released. This tool will improve accuracy and efficiency in any situation in which the optimal value of a parameter in a Monte Carlo simulation is unknown. Applications for this tool include (1) The design of new components (2) Reverse engineering of models based on limited experimental or published data, and (3) Tuning of Monte Carlo "hyper parameters" such as variance reduction, physics settings, or scoring parameters.
Read full abstract