I am trying to test if an optimizer supports the attribute MOI.NumberOfThreads()
:
m = Model(optimizer)
if MOI.supports(MOI.Utilities.CachingOptimizer(MOI.Utilities.Model{Float64}(), MOI.Utilities.AUTOMATIC), MOI.NumberOfThreads())
MOI.set(m, MOI.NumberOfThreads(), pars.nthreads)
elseif pars.nthreads < typemax(Int)
@warn "Your solver doesn't support setting the number of threads [pars.nthreads]"
end
It does work quite well. However, I believe there could be a shorter code using a MockOptimizer. Am I right? However, the documentation about MockOptimizer doesn’t seem to explain how I could use it, does it?