Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Linear programming sum and doble sum

I wonder why those syntax are invalid

p = MixedIntegerLinearProgram(solver='GLPK')
v = p.new_variable(nonnegative=True)
p.add_constraint(sum([v[i,1] for i in [0,3]) <= 1)
show(p)

or

p = MixedIntegerLinearProgram(solver='GLPK')
v = p.new_variable(nonnegative=True)
p.add_constraint(sum(sum([v[i,j] for i in [0,3]),for j  in [1, 5])  <= 1)
show(p)
click to hide/show revision 2
None

Linear programming sum and doble sum

I wonder why those syntax are invalid

p = MixedIntegerLinearProgram(solver='GLPK')
v = p.new_variable(nonnegative=True)
p.add_constraint(sum([v[i,1] for i in [0,3]) <= 1)
show(p)

or

p = MixedIntegerLinearProgram(solver='GLPK')
v = p.new_variable(nonnegative=True)
p.add_constraint(sum(sum([v[i,j] for i in [0,3]),for j  in [1, 5])  <= 1)
show(p)
click to hide/show revision 3
retagged

Linear programming sum and doble sum

I wonder why those syntax are invalid

p = MixedIntegerLinearProgram(solver='GLPK')
v = p.new_variable(nonnegative=True)
p.add_constraint(sum([v[i,1] for i in [0,3]) <= 1)
show(p)

or

p = MixedIntegerLinearProgram(solver='GLPK')
v = p.new_variable(nonnegative=True)
p.add_constraint(sum(sum([v[i,j] for i in [0,3]),for j  in [1, 5])  <= 1)
show(p)