The Robust Conjugate Direction Search (RCDS) method is used to optimize the collimation system for the Rapid Cycling Synchrotron (RCS) of the China Spallation Neutron Source (CSNS). The parameters of secondary collimators are optimized for a better performance of the collimation system. To improve the efficiency of the optimization, the Objective Ring Beam Injection and Tracking (ORBIT) parallel module combined with MATLAB parallel computing is used, which can run multiple ORBIT instances simultaneously. This study presents a way to find an optimal parameter combination of the secondary collimators for a machine model in preparation for CSNS/RCS commissioning.