Mathematical eye models are crucial for developing treatment strategies for astigmatic eye conditions. Extensive research has been conducted on various treatment techniques, and also various surfaces in glasses and contact lenses. This study aims to address the existing research gap by optimizing mathematical eye models for specific astigmatic conditions. Using Liu and Brennan's model, we simulate the correction of astigmatism with glasses and contact lenses. We optimize toroidal and aspherical lens surfaces to maximize their effectiveness in correcting astigmatism and evaluate image quality using modulation transfer function (MTF), point spread function (PSF), and focal spot diagrams. Our results show that both glasses and contact lenses can effectively treat astigmatism, with glasses providing superior correction. However, individual factors such as oblique vision, decentration, and anterior surface asphericity can influence treatment outcomes. This study contributes to advancing ophthalmology by integrating computational models with clinical data to improve treatment planning and personalization.