I am trying to use complements in Julia-JuMP. I appreciate the work put into this wonderful package, the manual is not detailed enough unfortunately.

A working example that uses this feature in an optimization problem would be great.

Otherwise I would appreciate some help completing the following which the JuMP manual here says has a solution of 0.5.

```
using JuMP
function cake_eating()
model = Model()
@variable(model, x >= 0)
@constraint(model, 2x - 1 ⟂ x)
print(model)
value(x)
end
cake_eating()
```

The only thing I see missing is actually calling the solver to solve the model. Did you not get an exception for calling `value`

in an unsolved model?

2 Likes

@Henrique_Becker. How to call the solver in this case is exactly where my question is.

I have tried the following but it does not get me anywhere.

```
using Ipopt, JuMP
function cake_eating()
model = Model(Ipopt.Optimizer)
@variable(model, x >= 0)
@constraint(model, 2x - 1 ⟂ x)
print(model)
optimize!(model)
value(q)
end
cake_eating()
```

This returns:

```
Constraints of type MathOptInterface.VectorAffineFunction{Float64}-in-MathOptInterface.Complements are not supported by the solver and there are no bridges that can reformulate it into supported constraints.
```

The error message is completely self-explanatory. The solver you are using do not support such constraints and JuMP is missing any code that could work-around this lack of support by the solver. The documentation of the solver you are using says it supports this kind of constraints?

1 Like

Solvers currently supporting Complements are: PATH and KNITRO.

3 Likes

@Henrique_Becker, @joaquimg. Thanks for the heads up. No access to KNITRO. But will install PATH and see what I get. Will report back.

UPDATE: I have now tried both solvers (PATH and KNITRO) and they returned the correct solution. Thanks for the assistance.

1 Like