If I set my variable to be lower trianglar, how can I supply an initial guess? The following gives me an error that has to do with the difference in the data type between the variable X and the initial guess X0
using JuMP
using LinearAlgebra
n = 4
model = Model()
@variable(model, X[1:n, 1:n], Symmetric)
X = LowerTriangular(X)
X0 = ones(n,n)
# Xl0 = LowerTriangular(X0)
set_start_value.(X, X0)
# set_start_value.(X, Xl0)
MethodError: no method matching set_start_value(::AffExpr, ::Float64)
Closest candidates are:
set_start_value(::ConstraintRef{<:AbstractModel, <:MathOptInterface.ConstraintIndex{<:MathOptInterface.AbstractVectorFunction, <:MathOptInterface.AbstractVectorSet}}, ::Any) at ~/.julia/packages/JuMP/60Bnj/src/constraints.jl:141
set_start_value(::ConstraintRef{<:AbstractModel, <:MathOptInterface.ConstraintIndex{<:MathOptInterface.AbstractScalarFunction, <:MathOptInterface.AbstractScalarSet}}, ::Any) at ~/.julia/packages/JuMP/60Bnj/src/constraints.jl:168
set_start_value(::VariableRef, ::Union{Nothing, Float64}) at ~/.julia/packages/JuMP/60Bnj/src/variables.jl:1015
@odow Actually this did does not work. For some reason, if you check the initial value for the variable Xl by typing
start_value.(Xl)
or
start_value(Xl[1,1])
and
start_value(Xl[1,2])
, you will see that only the diagonal elements of of X0 are stored as starting values, and the rest of the elements of Xl do not store the starting value!! It’s weird.
Is there any other way to store this starting value with this lower triangular matrix formulation?
I think it does NOT have to do with the Lower triangular structure since the error appears before. I am still not sure why it only takes the diagonal elements of A0
Ah. I misunderstood your question. The issue is that JuMP represents the symmetric matrix as upper triangular, and your A0 is lower triangular. Do set_start_value.(A, A0').