The meanings are similar:
Optimal: Best or most favorable; optimum
Ideal: Satisfying one's conception of what is perfect; most suitable
In my mind optimal is the best that is reasonably possible while ideal is the perfect and possibly unattainable.