Revision history [back]

Linearization of the objective in "MixedIntegerLinearProgram"

I have a Mixed integer program with non lineazr objective. But as it is the product of power there is no difficulty to linearize. But the program refuses the following modelization.

    po=[0.6,0.5,0.55,0.45,0.62,0.54,0.58,0.5]
c=vector([ln(u) for u in po])
nc=3 #nombre de contraintes
nv=8 #nombre de variables
A=matrix(nc,nv,[1,1,1,1,0,0,0,0,
0,0,0,0,1,1,1,1,
500,550,600,700,420,460,500,580])
B0=[40,30,45000] #borne inférieure
B1=[0,0,0] #borne supérieure
P=MixedIntegerLinearProgram(maximization=True, solver="GLPK")
x=P.new_variable(integer=True, nonnegative=False, indices=[0..nv-1])
B

=A*x
zz=c*x
P.set_objective(zz)
for i in range(0,nc):
for i in range(0,nv):
P.set_min(x[i],0)
#xi doit avoir pour minimum 0
P.show()


obviously its P.set_objective(zz) which doesn't work.

 2 retagged FrédéricC 5141 ●3 ●43 ●112

Linearization of the objective in "MixedIntegerLinearProgram"

I have a Mixed integer program with non lineazr objective. But as it is the product of power there is no difficulty to linearize. But the program refuses the following modelization.

    po=[0.6,0.5,0.55,0.45,0.62,0.54,0.58,0.5]
c=vector([ln(u) for u in po])
nc=3 #nombre de contraintes
nv=8 #nombre de variables
A=matrix(nc,nv,[1,1,1,1,0,0,0,0,
0,0,0,0,1,1,1,1,
500,550,600,700,420,460,500,580])
B0=[40,30,45000] #borne inférieure
B1=[0,0,0] #borne supérieure
P=MixedIntegerLinearProgram(maximization=True, solver="GLPK")
x=P.new_variable(integer=True, nonnegative=False, indices=[0..nv-1])
B

=A*x
zz=c*x
P.set_objective(zz)
for i in range(0,nc):

obviously its P.set_objective(zz) which doesn't work.