ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 15 Apr 2016 23:57:18 +0200Error with semi-definite program solverhttps://ask.sagemath.org/question/33125/error-with-semi-definite-program-solver/ Hello,
I use sage 7.1 on a debian computer. I am trying to use the sdp solver, but:
p = SemidefiniteProgram()
omega = p.new_variable()
p.set_objective(omega[0])
p.add_constraint(matrix(1,[1]) * omega[0] <= matrix(1,[1]))
p.add_constraint(matrix(1,[1]) * omega[1] <= matrix(1,[1]))
p.show()
returns an error:
ValueError: need more than 1 value to unpack
What does it mean?
Antoine
**After some tests...**
I don't understand what happens but here are some tests I have done:
The sdp solver works when I put all the variables in the objective. So it works with:
p = SemidefiniteProgram()
omega = p.new_variable()
p.set_objective(omega[0] + 0*omega[1])
p.add_constraint(matrix(1,[1]) * omega[0] <= matrix(1,[1]))
p.add_constraint(matrix(1,[1]) * omega[1] <= matrix(1,[1]))
p.show()
If I put the objective after the constraints I get the error again. For example with
p = SemidefiniteProgram()
omega = p.new_variable()
p.add_constraint(matrix(1,[1]) * omega[0] <= matrix(1,[1]))
p.add_constraint(matrix(1,[1]) * omega[1] <= matrix(1,[1]))
p.set_objective(omega[0] + 0*omega[1])
p.show()
I get the error
ValueError: need more than 1 value to unpack
To conclude it means that I need to know all the variables x I will use in my sdp and add 0*x to the objective. It works like that but if someone can explain me the error I would be happy !
AntoineFri, 15 Apr 2016 23:57:18 +0200https://ask.sagemath.org/question/33125/error-with-semi-definite-program-solver/