Light extraction from light-emitting materials is fundamentally limited by internal reflections due to the high dielectric-constant contrast between the material that produces the light and the emergent medium. These internal reflections can however be reduced significantly by a well-designed texturation of the surface of the emitting material. We used a genetic algorithm to determine optimal geometrical and material parameters for this texturation, the objective being to maximize the extraction of light of a GaN light-emitting diode. This study, which was restricted to two-dimensional texturations, shows that symmetric triangles actually correspond to the optimal shape. The dielectric constant of the material used for this texturation should ideally have the same dielectric constant as the GaN. The optimal texturation determined in this work leads to a light-extraction efficiency of 11.1%, which improves significantly the value of 3.7% obtained with a flat surface and the value of 5.7% achieved in previous work.