我有一个小例子:
/* LPSolver */
/* Objective function */
min: -x1 -x2 -x3 -x4 -x5 -x6 + 3;
/* Constraints */
C1: +x1 -x2 >= 0;
C2: +x3 -x4 >= 0;
C3: +x5 -x6 >= 0;
C4: -x1 -x2 -x3 -x4 -x5 -x6 + 3 > 0;
/* Variable bounds */
x1 <= 1;
x2 <= 1;
x3 <= 1;
x4 <= 1;
x5 <= 1;
x6 <= 1;
确实,有不同的解决方案可能,但我的问题是,我如何强制这些变量的相似性。如果我在lp_solve IDE中运行此示例,结果将是: X 1 = X = 0; X3 = X4 = 0.5; X5 = X6 = 1;
我想强制求解x1 = x2 = x3 = x4 = x5 = x6 = 0.5是否有可能在lp_solve中执行此操作?所以,我需要一些变量尽可能相似的东西。
答案 0 :(得分:0)
min: -x1 -x2 -x3 -x4 -x5 -x6 + 3;
/* Constraints */
C1: +x1 -x2 >= 0;
C2: +x3 -x4 >= 0;
C3: +x5 -x6 >= 0;
C4: -x1 -x2 -x3 -x4 -x5 -x6 + 3 > 0;
/* Variable bounds */
x1 <= 1;
x2 <= 1;
x3 <= 1;
x4 <= 1;
x5 <= 1;
x6 <= 1;
x1=x2;
x1=x3;
x1=x4;
x1=x5;
x1=x6;
x2=x3;
x2=x4;
x2=x5;
x2=x6;
x3=x4;
x3=x5;
x3=x6;
x4=x5;
x4=x6;
x5=x6;
/* raza.me@suit.edu.pk */