# @SDconstraint not working

**URL:** https://discourse.julialang.org/t/sdconstraint-not-working/96685
**Category:** Optimization (Mathematical)
**Tags:** control, jump, optimization, mosek, convex-optimization
**Created:** [March 27, 2023, 10:35pm UTC](https://discourse.julialang.org/t/sdconstraint-not-working/96685 "2023-03-27T22:35:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![shaurya](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shaurya/32/30468_2.png) [@shaurya](https://discourse.julialang.org/u/shaurya)
#### Post date: [March 27, 2023, 10:35pm UTC](https://discourse.julialang.org/t/sdconstraint-not-working/96685/1 "2023-03-27T22:35:16Z")

</div>

Hi,

I’m new to Julia and this might be something very simple but I’m struggling to implement in JuMP.

```julia
julia> using JuMP

julia> using MosekTools

julia> model = Model();

julia> @variable(model, x)
x

julia> a = [x 2x
                   0 x];

julia> b = [1 2
                  3 4];

julia> cref = @SDconstraint(model, a ⪰ b)
ERROR: UndefVarError: @SDconstraint not defined

```

What am I doing wrong here? This is borrowed from an example given [here](https://docs.juliahub.com/JuMP/DmXqY/0.21.6/autodocs/#JuMP.@SDconstraint-Tuple)

---

<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: [March 27, 2023, 11:02pm UTC](https://discourse.julialang.org/t/sdconstraint-not-working/96685/2 "2023-03-27T23:02:28Z")

</div>

You’ve stumbled upon some very old documentation that isn’t maintained by us.

Here’s the official documentation: [Introduction · JuMP](https://jump.dev/JuMP.jl/stable/)

Here’s some links to get you started:

- [Variables · JuMP](https://jump.dev/JuMP.jl/stable/manual/variables/#Semidefinite-variables)
- [Constraints · JuMP](https://jump.dev/JuMP.jl/stable/manual/constraints/#Semidefinite-constraints)
- [Simple semidefinite programming examples · JuMP](https://jump.dev/JuMP.jl/stable/tutorials/conic/simple_examples/)

Your example would be:

```julia
using JuMP
using MosekTools
model = Model(Mosek.Optimizer);
@variable(model, x)
a = [x 2x; 0 x];
b = [1 2; 3 4];
@constraint(model, a >= b, PSDCone())

```

---

<div class="post-metadata">

### Author: ![shaurya](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shaurya/32/30468_2.png) [@shaurya](https://discourse.julialang.org/u/shaurya)
#### Post date: [March 29, 2023, 8:00pm UTC](https://discourse.julialang.org/t/sdconstraint-not-working/96685/3 "2023-03-29T20:00:18Z")

</div>

Thanks a lot! This worked for me! 😃
