Development of an evolutionary algorithm for the ab initio discovery of two-dimensional materials