# Manifold optimization with additional constraints

**URL:** <https://discourse.julialang.org/t/manifold-optimization-with-additional-constraints/62799>\
**Category:** Optimization (Mathematical)\
**Tags:** optimization\
**Created:** [June 12, 2021, 3:29pm UTC](https://discourse.julialang.org/t/manifold-optimization-with-additional-constraints/62799 "2021-06-12T15:29:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jae-Mo\_Lihm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jae-mo_lihm/32/20145_2.png) [@Jae-Mo\_Lihm](https://discourse.julialang.org/u/Jae-Mo_Lihm)\
**Post date:** [June 12, 2021, 3:29pm UTC](https://discourse.julialang.org/t/manifold-optimization-with-additional-constraints/62799/1 "2021-06-12T15:29:06Z")

</div>

I want to minimize f(x), with two constraints: (1) x is a unitary matrix, and (2) f\_i(x) \>= 0 for i=1, …, N. (In my case, f\_i(x) are quadratic functions, e.g. abs(x[1, 1])^2) - 0.5.

Because of the unitarity constraint, I want to use the manifold optimization in Optim.jl. But as I understand, one cannot impose additional constraints like f(x) \>= 0 directly in Optim.jl. Is this correct?

A solution I thought is to implement an augmented Lagrangian method by myself, using Optim.jl as the solver inside it. But I was wondering if there is a simpler or better way.

Any suggestions will be much appreciated!

---

<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:** [June 13, 2021, 9:53pm UTC](https://discourse.julialang.org/t/manifold-optimization-with-additional-constraints/62799/2 "2021-06-13T21:53:25Z")

</div>

This might be better suited to Convex.jl:

[https://jump.dev/Convex.jl/stable/examples/optimization\_with\_complex\_variables/Fidelity%20in%20Quantum%20Information%20Theory/#Fidelity-in-quantum-information-theory](https://jump.dev/Convex.jl/stable/examples/optimization_with_complex_variables/Fidelity%20in%20Quantum%20Information%20Theory/#Fidelity-in-quantum-information-theory)

You could also use JuMP with something like

```nohighlight
N = 3
using JuMP, Ipopt
I = zeros(N, N)
for i in 1:N
    I[i, i] = 1.0
end
model = Model(Ipopt.Optimizer)
@variable(model, x_re[i=1:N, j=1:N], start = I[i, j])
@variable(model, x_im[1:N, 1:N], start = 0.0)
@expression(model, x, x_re .+ x_im)
@expression(model, xt, (x_re .- x_im)')
@constraint(model, xt * x .== I)
optimize!(model)

```

but JuMP doesn’t support complex values, so you need to model both the real and imaginary parts.
