Defining a lower triangular matrix as the decision variable in JuMP

Dear All,

I am trying to define a decision variable L \in \mathbb{R}^{n\times n} in JuMP, which is lower triangular. As of now, I am defining this matrix as follows.

@variable(my_model, L_mat[1:n, 1:n])

# upper off-diagonal terms of L_mat are zero
for i in 1:n
for j in 1:n
if i < j
fix(L_mat[i,j], 0; force = true)
end
end
end


While this works for my purpose, I was wondering if there is a more efficient way to define this matrix in JuMP? The number n can be quite large for the example that I am trying to solve.

The first thing you can do is to write your j loop from i+1 to n.

No direct support.

But you could make a symmetric matrix and then form the lower triangle?

https://jump.dev/JuMP.jl/stable/manual/variables/#Symmetric-variables

Yes, I tried that @odow , but for some reason, I got a “too few degrees of freedom” error using IPOPT for my problem when doing this (make a symmetric matrix and then form the lower triangle). Okay, for now, let me just stick to how I am defining it, I do not think this is a major issue for my problem. I was just curious to know if there is a direct way.

Too few degrees of freedom is usually when the problem is over determined. Do you have duplicate sets of constraints? It’s not a problem from the triangular matrix directly.

Yes, I think there are some duplicate constraints. Thanks @odow !

1 Like