# \[AMPL 24764\] Solving status

**URL:** <https://discuss.ampl.com/t/ampl-24764-solving-status/701>\
**Category:** Google Group Mirror\
**Created:** [August 27, 2023, 7:08pm UTC](https://discuss.ampl.com/t/ampl-24764-solving-status/701 "2023-08-27T19:08:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matheus\_Diogenes\_And](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/matheus_diogenes_and/32/380_2.png) [@Matheus\_Diogenes\_And](https://discuss.ampl.com/u/Matheus_Diogenes_And)\
**Post date:** [August 27, 2023, 7:08pm UTC](https://discuss.ampl.com/t/ampl-24764-solving-status/701/1 "2023-08-27T19:08:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Matheus\_Diogenes\_And](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/matheus_diogenes_and/32/380_2.png) [@Matheus\_Diogenes\_And](https://discuss.ampl.com/u/Matheus_Diogenes_And)\
**Post date:** [August 28, 2023, 1:01pm UTC](https://discuss.ampl.com/t/ampl-24764-solving-status/701/2 "2023-08-28T13:01:14Z")

</div>

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](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](https://github.com/ampl/amplpy/issues/47)

Thanks and regards.
