# how to minimize cost function in integer programming with groebner basis

below are maple code

3*rho1 - 2*rho2 + rho3 - rho4 = -1

4*rho1 + rho2 - rho3 = 5

original without cost function:

with(Groebner): K := {y1-(x1^3)(x2^4),y2-(x2^(1+2))(w^2),y3-(x1^(1+1))*(w^1),y4-(x2^1)w,(y1^1000)(y2^1)(y3^1)(y4^100)- x1*x2*w + 1}; G := Basis(K, plex(x1, x2, w, y1, y2, y3, y4)); Reduce((x2^(5+1))*(w^1), G, plex(x1, x2, w, y1, y2, y3, y4));

after have cost function 1000*rho1 + rho2 + rho3 + 100*rho4, i guess to introduce new variable x3

however, the reuslt is not equal to the correct solution (1,3,2,0)

y1-(x1^3)(x2^4)(x3^1000) y2-(x2^(3))(x3^(3))(w^2) y3-(x1^(2))(x3^(2))(w^1) y4-(x2^1)*(x3^(101))*w x1*x2*x3*w - 1

with(Groebner): K := {y1-(x1^3)(x2^4)(x3^1000),y2-(x2^(1+2))(x3^(1+2))(w^2),y3-(x1^(1+1))(x3^(1+1))(w^1),y4-(x2^1)*(x3^(100+1))*w,x1*x2*x3*w - 1}; G := Basis(K, plex(x1, x2, w, y1, y2, y3, y4)); Reduce((x2^(5+1))*(w^1), G, plex(x1, x2, w, y1, y2, y3, y4));

subs({rho1=1,rho2=1,rho3=0,rho4=2},3*rho1 - 2*rho2 + rho3 - rho4); subs({rho1=1,rho2=1,rho3=0,rho4=2},4*rho1 + rho2 - rho3 ); subs({rho1=1,rho2=1,rho3=0,rho4=2},1000*rho1 + rho2 + rho3 + 100*rho4 );

subs({rho1=1,rho2=3,rho3=2,rho4=0},3*rho1 - 2*rho2 + rho3 - rho4); subs({rho1=1,rho2=3,rho3=2,rho4=0},4*rho1 + rho2 - rho3 ); subs({rho1=1,rho2=3,rho3=2,rho4=0},1000*rho1 + rho2 + rho3 + 100*rho4 );

-