wujinq
March 20, 2022, 7:48am
1
I have a large optimization problem written in JuMP.jl
and do not get the expected results. To debug my program, I want to replace the variables in constraints by their values found by an analytical calculation. That is, I want to replace the variables in
2×2 Array{GenericAffExpr{Float64,VariableRef},2}:
xpopstr_expected[21] -xpopstr_expected[22]
xpopstr_expected[22] xpopstr_expected[21]
by actual numbers. Is this supported by JuMP
?
odow
March 20, 2022, 8:22am
2
2 Likes
wujinq
March 20, 2022, 9:31am
3
That’s great. Thank you for your answer.
1 Like
wujinq
March 21, 2022, 3:52pm
4
Oh, there is still a problem: feasibility checking for SDP constraints is not supported yet, so still I need to replace a JuMP variable by a number …
odow
March 21, 2022, 5:48pm
5
Yes, there’s no easy way to do this just yet for non-trivial constraints. You’d have to manually come up with something.
1 Like
wujinq:
That is, I want to replace the variables in
2×2 Array{GenericAffExpr{Float64,VariableRef},2}:
xpopstr_expected[21] -xpopstr_expected[22]
xpopstr_expected[22] xpopstr_expected[21]
by actual numbers. Is this supported by JuMP
?
Use JuMP.value(::Function,::GenericAffExpr)
to evaluate the affine expressions using a function that provides a value for each variable.
1 Like