Made changes to Optimal.cpp