Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Strange result with GLPK

This program

%display latex
m=3
n=2 
A=matrix(m,n,(0,1,1,0,6,18))
bmin=[12,0,70]
bmax=[oo,10,70]
c=matrix(1,n,(4.1,8)) 
show(A,bmin,bmax,c)

p = MixedIntegerLinearProgram(maximization=False, solver = "GLPK") 
x = p.new_variable(integer=False, indices=[0..n-1]) # les nouvelles variables seront x[1]... x[7]}
B = A * x # m
for i in range(m):
    p.add_constraint(B[i], min=bmin[i], max=bmax[i])
for i in range(n):
    p.set_min(x[i],0)
p.set_objective(4.1*x[0]+8*x[1])    
p.show()
p.set_min(x[i],0)

p.set_objective(4.1x[0]+8x[1] p.show() p.solve()

has obviously no solution as show by the result of

z=p.polyhedron()
zz=z.vertices()
zz

(There are no vertices)

but

p.solve()

gives 96 and

valeurs=p.get_values(x) valeurs

gives

${0:0.0,1:12.0}$

but $18 *12 =216 \geq 70$ wich shows the assertion

click to hide/show revision 2
retagged

Strange result with GLPK

This program

%display latex
m=3
n=2 
A=matrix(m,n,(0,1,1,0,6,18))
bmin=[12,0,70]
bmax=[oo,10,70]
c=matrix(1,n,(4.1,8)) 
show(A,bmin,bmax,c)

p = MixedIntegerLinearProgram(maximization=False, solver = "GLPK") 
x = p.new_variable(integer=False, indices=[0..n-1]) # les nouvelles variables seront x[1]... x[7]}
B = A * x # m
for i in range(m):
    p.add_constraint(B[i], min=bmin[i], max=bmax[i])
for i in range(n):
    p.set_min(x[i],0)
p.set_objective(4.1*x[0]+8*x[1])    
p.show()
p.set_min(x[i],0)

p.set_objective(4.1x[0]+8x[1] p.show() p.solve()

has obviously no solution as show by the result of

z=p.polyhedron()
zz=z.vertices()
zz

(There are no vertices)

but

p.solve()

gives 96 and

valeurs=p.get_values(x) valeurs

gives

${0:0.0,1:12.0}$

but $18 *12 =216 \geq 70$ wich shows the assertion