[AMPL 24764] Solving status

Hello everyone.

I would like to know if it is possible to retrieve the solving status after running a model. For instance, if I want to check whether the obtained solution is an optimal or feasible, what snippet should I place in?

ampl.solve();
if (???) // check optimality

cout<<“Optimal solution found”<<endl;

else if (???) // check feasibility

cout<<“Feasible solution found”<<endl;

else // check infeasibility

cout<<“No feasible solution found”<<endl;

Thanks and best regards.

Thanks for the attention. Actually, I can simply use the commands below:

cout<<ampl.getValue(“solve_result_num”).dbl()<<endl;
cout<<ampl.getValue(“solve_result”).str()<<endl;

Whosen dictionary is given here (https://portal.ampl.com/docs/archive/first-website/BOOK/CHAPTERS/17-solvers.pdf#page=8).

Source: How to get sentence from lpopt outputs with output handler? · Issue #47 · ampl/amplpy · GitHub

Thanks and regards.