"Synchrotron Radiation Workshop" (SRW) is an open source physical optics computer code for calculation of detailed characteristics of Synchrotron Radiation (SR) generated by relativistic electrons in magnetic fields of arbitrary configuration. SRW also supports high-accuracy simulations of fully- and partially-coherent radiation propagation through X-ray optical beamlines, facilitated by so-called “Virtual Beamline” module. In this present tech note, we discuss the nonlinear optimization features of SRW with emphasis on the optimization library in SRW. This optimization library not only can be used to optimize the simulation beamline in SRW, it also can be integrated with real beamline operations and optimize the parameters based on real measurements. We also show some demos of the optimization library recently developed in SRW.