KNITRO 'option_file' is not working

Hi all,

I’m trying to pass an option file to KNITRO solver and it gives me the following error:

using JuMP, KNITRO
m = Model(with_optimizer(KNITRO.Optimizer, option_file="knitro.opt"))
ERROR: MathOptInterface.UnsupportedAttribute
Stacktrace:
 [1] set(::KNITRO.Optimizer, ::MathOptInterface.RawParameter, ::String) at /home/jk5839/.julia/packages/KNITRO/hrPhn/src/MOI_wrapper.jl:242
 [2] set_options at /home/jk5839/.julia/packages/KNITRO/hrPhn/src/MOI_wrapper.jl:124 [inlined]
 [3] #Optimizer#36(::Nothing, ::Base.Iterators.Pairs{Symbol,String,Tuple{Symbol},NamedTuple{(:option_file,),Tuple{String}}}, ::Type{KNITRO.Optimizer}) at /home/jk5839/.julia/packages/KNITRO/hrPhn/src/MOI_wrapper.jl:145
 [4] (::Core.var"#kw#Type")(::NamedTuple{(:option_file,),Tuple{String}}, ::Type{KNITRO.Optimizer}) at ./none:0
 [5] (::OptimizerFactory)() at /home/jk5839/.julia/packages/JuMP/MsUSY/src/JuMP.jl:99
 [6] #set_optimizer#77(::Bool, ::typeof(set_optimizer), ::Model, ::OptimizerFactory) at /home/jk5839/.julia/packages/JuMP/MsUSY/src/optimizer_interface.jl:38
 [7] #Model#7 at ./none:0 [inlined]
 [8] Model(::OptimizerFactory) at /home/jk5839/.julia/packages/JuMP/MsUSY/src/JuMP.jl:193
 [9] top-level scope at REPL[2]:1

Can anyone let me know how to fix this? Thanks!

(v1.3) pkg> status
    Status `~/.julia/environments/v1.3/Project.toml`
  [336ed68f] CSV v0.5.18
  [a93c6f00] DataFrames v0.20.0
  [31c24e10] Distributions v0.21.11
  [2e9cd046] Gurobi v0.7.4
  [b6b21f68] Ipopt v0.6.1
  [4076af6c] JuMP v0.20.1
  [67920dd8] KNITRO v0.8.0 #master (https://github.com/JuliaOpt/KNITRO.jl.git)
  [23992714] MAT v0.7.0
  [b8f27783] MathOptInterface v0.9.7 #master (https://github.com/JuliaOpt/MathOptInterface.jl.git)
  [6405355b] Mosek v1.1.1
  [1ec41992] MosekTools v0.9.1
  [8bb1440f] DelimitedFiles

That looks like a bug in the wrapper:


Presumably, option_file and tuner_file should be supported attributes.

You should open an issue: https://github.com/JuliaOpt/KNITRO.jl/issues/new

cc @frapac

Indeed, this is a bug in the wrapper. This should be fixed by:


We are planning to release Knitro.jl 0.8.0 soon, and that fix should be included in this release.

Thank you so much! I confirm that your solution fixed the bug and successfully passes user options.