Thread AMPL API Python

I am reaching out to inquire about how to obtain the ‘thread count’ at the conclusion of solving a linear programming problem.

I am using the following code:
THD = ampl.get_value(“thread”)

However, it seems it is not working.

I am eagerly awaiting your response.

1 Like

Hi @Oscar_Romero,

Are you trying to see how many threads did the solver use? That information is available in the solver output, which can be parsed to retrieve it. Which solver are you using? Typically by default, the number of threads used be commercial solvers is either the number of CPU cores, or the number of CPU threads available on the machine.

To control the number of threads there is usually a solver option called threads that you can set.