# ERROR: type DataType has no field optimizer\_constructor

**URL:** https://discourse.julialang.org/t/error-type-datatype-has-no-field-optimizer-constructor/47920
**Category:** Optimization (Mathematical)
**Tags:** jump, error
**Created:** [October 7, 2020, 11:37am UTC](https://discourse.julialang.org/t/error-type-datatype-has-no-field-optimizer-constructor/47920 "2020-10-07T11:37:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![umbe](https://avatars.discourse-cdn.com/v4/letter/u/f19dbf/32.png) [@umbe](https://discourse.julialang.org/u/umbe)
#### Post date: [October 7, 2020, 11:37am UTC](https://discourse.julialang.org/t/error-type-datatype-has-no-field-optimizer-constructor/47920/1 "2020-10-07T11:37:08Z")

</div>

Hi everyone,  
I’m having a problem with JuMP/Juniper.

For first I create an optimization model

```julia
    m = Model(Juniper.Optimizer)
    set_optimizer_attribute(m, "nl_solver", Ipopt.Optimizer)
    set_optimizer_attribute(m, "mip_solver", Cbc.Optimizer)

```

and then I define all the variables and constraints. Up to this point everithing is ok.  
Successively, I run the optimization. The solver starts to print its outputs in the REPL until it ends, since the convergence is reached.

```julia
EXIT: Optimal Solution Found.
Status of relaxation: LOCALLY_SOLVED

```

However, immediatly after that, the following error appears:

```julia
ERROR: type DataType has no field optimizer_constructor
Stacktrace:
 [1] getproperty(::Type{T} where T, ::Symbol) at .\Base.jl:28
 [2] generate_mip(::Juniper.Optimizer, ::Juniper.JuniperProblem, ::Array{Float64,1}, ::Juniper.TabuList, ::Float64) at C:\Users\user1\.julia\packages\Juniper\Hm6I1\src\fpump.jl:9
 [3] fpump(::Juniper.Optimizer, ::Juniper.JuniperProblem) at C:\Users\user1\.julia\packages\Juniper\Hm6I1\src\fpump.jl:360
 [4] optimize!(::Juniper.Optimizer) at C:\Users\user1\.julia\packages\Juniper\Hm6I1\src\MOI_wrapper\MOI_wrapper.jl:413
 [5] optimize!(::MathOptInterface.Bridges.LazyBridgeOptimizer{Juniper.Optimizer}) at C:\Users\user1\.julia\packages\MathOptInterface\bygN7\src\Bridges\bridge_optimizer.jl:239
 [6] optimize!(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}) at C:\Users\user1\.julia\packages\MathOptInterface\bygN7\src\Utilities\cachingoptimizer.jl:189
 [7] optimize!(::Model, ::Nothing; bridge_constraints::Bool, ignore_optimize_hook::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\user1\.julia\packages\JuMP\YXK4e\src\optimizer_interface.jl:131
 [8] optimize! at C:\Users\user1\.julia\packages\JuMP\YXK4e\src\optimizer_interface.jl:107 [inlined] (repeats 2 times)
 [9] top-level scope at none:0

```

and the optimization results are not provided.  
Unfortunately, I have no idea what it means and looking on the web I did not find anything useful.  
Does anyone know what is going wrong?

---

<div class="post-metadata">

### Author: ![ccoffrin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ccoffrin/32/400_2.png) [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)
#### Post date: [October 7, 2020, 3:14pm UTC](https://discourse.julialang.org/t/error-type-datatype-has-no-field-optimizer-constructor/47920/2 "2020-10-07T15:14:41Z")

</div>

This error is a bit of mystery to me. You might try something like,

```julia
set_optimizer_attribute(m, "mip_solver", optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0))

```

That is how we test the solver. Note that the MIP solver is only used in the feasibility pump, so you can also try omitting it entierly.

@Wikunia, do you have any other suggestions?

---

<div class="post-metadata">

### Author: ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)
#### Post date: [October 7, 2020, 3:24pm UTC](https://discourse.julialang.org/t/error-type-datatype-has-no-field-optimizer-constructor/47920/3 "2020-10-07T15:24:34Z")

</div>

That’s indeed interesting. I think we never tested it that way as we weren’t interested in the long output of the subsolvers. I hope the suggestion by @ccoffrin works for you.  
I’m currently on vacation but I can have a look into it next week. Maybe open an issue on our repo such that I don’t forget it.

---

<div class="post-metadata">

### Author: ![umbe](https://avatars.discourse-cdn.com/v4/letter/u/f19dbf/32.png) [@umbe](https://discourse.julialang.org/u/umbe)
#### Post date: [October 8, 2020, 2:54pm UTC](https://discourse.julialang.org/t/error-type-datatype-has-no-field-optimizer-constructor/47920/4 "2020-10-08T14:54:40Z")

</div>

Thank you very much @ccoffrin and @Wikunia!  
I suppressed the solvers output by writing

```julia
optmod = Model(with_optimizer(Juniper.Optimizer;
                nl_solver = with_optimizer(Ipopt.Optimizer, print_level = 0),
                mip_solver = with_optimizer(Cbc.Optimizer, logLevel = 0)))

```

and the solver ran properly.

As you suggested, I opened [an issue](https://github.com/lanl-ansi/Juniper.jl/issues/201) on the Juniper repository.

Thank you again for your support!
