Revision history [back]

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)

 2 None Iguananaut 1708 ●8 ●33 ●55

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)

 3 retagged FrédéricC 5143 ●3 ●43 ●112

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)