# KNITRO 'option\_file' is not working

**URL:** <https://discourse.julialang.org/t/knitro-option-file-is-not-working/32410>\
**Category:** Optimization (Mathematical)\
**Created:** [December 17, 2019, 10:31pm UTC](https://discourse.julialang.org/t/knitro-option-file-is-not-working/32410 "2019-12-17T22:31:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SingingKim](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Post date:** [December 17, 2019, 10:31pm UTC](https://discourse.julialang.org/t/knitro-option-file-is-not-working/32410/1 "2019-12-17T22:31:31Z")

</div>

Hi all,

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

```julia
using JuMP, KNITRO
m = Model(with_optimizer(KNITRO.Optimizer, option_file="knitro.opt"))

```

```julia
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!

```julia
(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

```

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [December 18, 2019, 1:50am UTC](https://discourse.julialang.org/t/knitro-option-file-is-not-working/32410/2 "2019-12-18T01:50:23Z")

</div>

That looks like a bug in the wrapper:  
[https://github.com/JuliaOpt/KNITRO.jl/blob/dbad51abd69e11f53f4231ef2fbdc57bf038c207/src/MOI\_wrapper.jl#L241-L247](https://github.com/JuliaOpt/KNITRO.jl/blob/dbad51abd69e11f53f4231ef2fbdc57bf038c207/src/MOI_wrapper.jl#L241-L247)  
Presumably, `option_file` and `tuner_file` should be supported attributes.

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

cc @frapac

---

<div class="post-metadata">

**Author:** ![frapac](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frapac/32/6879_2.png) [@frapac](https://discourse.julialang.org/u/frapac)\
**Post date:** [December 18, 2019, 8:07am UTC](https://discourse.julialang.org/t/knitro-option-file-is-not-working/32410/3 "2019-12-18T08:07:12Z")

</div>

Indeed, this is a bug in the wrapper. This should be fixed by:  
[https://github.com/JuliaOpt/KNITRO.jl/pull/139](https://github.com/JuliaOpt/KNITRO.jl/pull/139)  
We are planning to release Knitro.jl 0.8.0 soon, and that fix should be included in this release.

---

<div class="post-metadata">

**Author:** ![SingingKim](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@SingingKim](https://discourse.julialang.org/u/SingingKim)\
**Post date:** [December 18, 2019, 8:32am UTC](https://discourse.julialang.org/t/knitro-option-file-is-not-working/32410/4 "2019-12-18T08:32:24Z")

</div>

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