working Platt casadi. optimization still doesn't work though