linear programming - How to formulate x != y in lpsolve? -
i'm trying formulate variables x,y,z must different , accept values 1, 2 or 3 (this is, of course, toy example):
min: x+y+z; 1 <= x <= 3; 1 <= y <= 3; 1 <= z <= 3;
but make work still need either access boolean operators or != operator, don't seem exist in lpsolve! how can go this? wanted this:
x != y; x != z; y != z;
thanks
edit:
here's current code:
/* objective function */ min: 1; /* variable bounds */ 1 <= x1 <= 4; 1 <= x2 <= 4; 1 <= x3 <= 4; 1 <= x4 <= 4; x1 + x2 + x3 + x4 = 10; x1 < x2; x2 < x3; x3 < x4; int x1; int x2; int x3; int x4;
lpsolve giving me result:
x1 = 1 x2 = 3 x3 = 3 x4 = 3
which wrong. why?
Comments
Post a Comment