KNITRO.jl icon indicating copy to clipboard operation
KNITRO.jl copied to clipboard

Releasing the License

Open sonofwatt84 opened this issue 1 year ago • 2 comments

When using KNITRO.Optimizer with JuMP, KNITRO licenses tend to remain checked out. Is there an elegant way with JuMP to make sure KN_free() gets called after the optimization is complete?

sonofwatt84 avatar Jul 01 '24 23:07 sonofwatt84

I think the correct solution to this is to use a license manager:

using JuMP, KNITRO
manager = KNITRO.LMcontext()
model = Model(() -> KNITRO.Optimizer(; license_manager = manager))
# maybe needed
finalize(manager)

this isn't documented yet (and I don't have a license setup that requires this, so I can't easily test), so let me know if it works and I will add to the README.

odow avatar Jul 16 '24 08:07 odow

Great, thanks for the suggestion. Still working on testing this in our context, but should be able to provide results soonish.

sonofwatt84 avatar Jul 25 '24 16:07 sonofwatt84

This works fine. KNITRO.KN_release_license(manager)

hgangwar avatar Mar 05 '25 17:03 hgangwar