# Complementarity in MOI wrappers

**URL:** https://discourse.julialang.org/t/complementarity-in-moi-wrappers/47225
**Category:** Optimization (Mathematical)
**Tags:** jump
**Created:** [September 24, 2020, 7:16pm UTC](https://discourse.julialang.org/t/complementarity-in-moi-wrappers/47225 "2020-09-24T19:16:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mrt](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@mrt](https://discourse.julialang.org/u/mrt)
#### Post date: [September 24, 2020, 7:16pm UTC](https://discourse.julialang.org/t/complementarity-in-moi-wrappers/47225/1 "2020-09-24T19:16:12Z")

</div>

I’m writing a MathOptInterface wrapper for a solver, and have been trying to implement complementarity. How do I define the problem attribute for the optimizer? If I naively attempt e.g. :

`comp::Vector{ConstraintInfo{MOI.VectorAffineFunction{Float64}, MOI.Complements{Int}}}`,

as an optimizer attribute in MOI I get a type error:  
`TypeError: in Type{...} expression, expected UnionAll, got Type{MathOptInterface.Complements}`

What am I missing? Adding other constraint types seems not to lead to these type errors.

---

<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: [September 24, 2020, 8:51pm UTC](https://discourse.julialang.org/t/complementarity-in-moi-wrappers/47225/2 "2020-09-24T20:51:09Z")

</div>

The struct is just `MOI.Complements`, with no type parameter: [https://github.com/jump-dev/MathOptInterface.jl/blob/21fd61cc906662834866b287dc15c628723fee34/src/sets.jl#L815-L817](https://github.com/jump-dev/MathOptInterface.jl/blob/21fd61cc906662834866b287dc15c628723fee34/src/sets.jl#L815-L817).

```julia
comp::Vector{
    ConstraintInfo{
        MOI.VectorAffineFunction{Float64}, 
        MOI.Complements
    }
}

```

The wrapper for PATH might be a good example to follow: [https://github.com/odow/PATH.jl/blob/master/src/MOI\_wrapper.jl](https://github.com/odow/PATH.jl/blob/master/src/MOI_wrapper.jl)
