A variant constrained genetic algorithm (VCGA) for effective tracking of conditional nonlinear optimal perturbations (CNOPs) is presented. Compared with traditional constraint handling methods, the treatment of the constraint condition in VCGA is relatively easy to implement. Moreover, it does not require adjustments to indefinite pararneters. Using a hybrid crossover operator and the newly developed multi-ply mutation operator, VCGA improves the performance of GAs. To demonstrate the capability of VCGA to catch CNOPS in non-smooth cases, a partial differential equation, which has "on off" switches in its forcing term, is employed as the nonlinear model. To search global CNOPs of the nonlinear model, numerical experiments using VCGA, the traditional gradient descent algorithm based on the adjoint method (ADJ), and a GA using tournament selection operation and the niching technique (GA-DEB) were performed. The results with various initial reference states showed that, in smooth cases, all three optimization methods are able to catch global CNOPs. Nevertheless, in non-smooth situations, a large proportion of CNOPs captured by the ADJ are local. Compared with ADJ, the performance of GA-DEB shows considerable improvement, but it is far below VCGA. Further, the impacts of population sizes on both VCGA and GA-DEB were investigated. The results were used to estimate the computation time of ~CGA and GA-DEB in obtaining CNOPs. The computational costs for VCGA, GA-DEB and ADJ to catch CNOPs of the nonlinear model are also compared.