Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error with matrix definition of a linear program

According to the folloing tract https://trac.sagemath.org/ticket/16714

this command works

p = MixedIntegerLinearProgram()
x = p.new_variable()
p.add_constraint(A_matrix*x <= a_vector)

so why the following code returns an error ?

A=[[1,0,0,1,0,0,0,0,0,0,0,0],[0,1,0,0,0,0,1,0,0,0,0,0],[0,0,1,0,0,0,0,0,0,1,0,0],[0,0,0,0,1,0,0,1,0,0,0,0],[0,0,0,0,0,1,0,0,0,0,1,0],[0,0,0,0,0,0,0,0,1,0,0,1]]
U1=[1,1,1,1,1,1]
show(matrix(A))
show(vector(U1))
p = MixedIntegerLinearProgram(binary = true)
x = p.new_variable()
p.add_constraint(A*x <= U1)

p.show()