Solver IsBusy is obsolete

19 views
Skip to first unread message

Jessica Wong

unread,
Feb 26, 2020, 11:43:02 AM2/26/20
to OPTANO Modeling
I'm trying to control which jobs (e.g. production vs test) are sent to the solver based on whether it is currently running a solve.
When I try to use IsBusy from my solver it gives me the error: 'SolverBase.IsBusy' is obsolete: 'Remove and replace it with locks.'
Is this something that is supposed to be implemented in Optano? I don't see any replacement for IsBusy implemented.
If you have a solution could you provide an example?

Thanks,
Jessica.

OPTANO Team

unread,
Feb 26, 2020, 12:03:29 PM2/26/20
to OPTANO Modeling
 Hi,

a usual dotnet pattern would be to create tasks out of the optimization jobs and have the tpl manage them. please have a look at the TPL. https://docs.microsoft.com/en-us/dotnet/standard/parallel-programming/task-parallel-library-tpl
Your solver will be busy until the solve call returns. that might be easly tracked in your code: use a appropiate accessable field, set it to solving before the code calls solver.solve() and set it back, when it returns.
In general, OPTANO Modeling support parallel solving processes. the isbusy parameter has been used to track wether matrix updates hit into a running solution process. Keep in mind: there might be several solver instances and several model instances in memory. those are not singaltons.



Is this information of any help?

Best.
jp

OPTANO Team

unread,
Feb 27, 2020, 5:12:00 AM2/27/20
to OPTANO Modeling
Hi

I just passed a website that describes quite well how to implement such a queue: https://michaelscodingspot.com/c-job-queues/

tTe "//do the job" would then be solver.solve(model). The model object itself could be managed in the queue. The worker thread could also write the solutions into an output queue.

Best,
jp
Reply all
Reply to author
Forward
0 new messages