Error with semi-definite program solver

asked 2016-04-15 16:57:18 -0500

agrospel gravatar image

updated 2016-04-18 06:16:35 -0500

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 !

Antoine

edit retag flag offensive close merge delete