Genetic optmizer with elasticity check for JavaScript