SonLe
#1
Hi, I have a question about verifying the SOCP constraint in JuMP.

So far, my SOCP constraint is \epsilon t \geq \theta\|\mathbf{x}\|_{2}+\frac{1}{N} \sum_{i \in[N]} r^{i}

and my code is

`@constraint(model, [ϵ * t * (1/θ) .- (1/θ*N)*sum(r[i] for i in [1:N]); x] in SecondOrderCone()) `

Is my approach true? This is a constraint in model 37, section 6.1 of this paper

1 Like

odow
#2
Couple of small things. You want instead

```
[ϵ * t * (1/θ) - 1/(θ*N)*sum(r[i] for i in 1:N)
```

SonLe
#3
Thanks so much. To make sure my understanding, why we use **-** instead of **.-**?

odow
#4
Use .- for the elementwise subtraction between arrays. In this case, the first element is a scalar, so you don’t need the dot.

It will still work if you include it though.

1 Like