0

I have a small example:

/* 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;

Indeed, there are different solutions possible but my question is, how can I force the similarity of these variables. If I run this example in the lp_solve IDE the result will be: x1=x2=0; x3=x4=0.5; x5=x6=1;

I would like to force the solution x1=x2=x3=x4=x5=x6=0.5 is there a possibility to do that in lp_solve? So, I need something, where the variables are as similar as possible.

mathew11
  • 3,382
  • 3
  • 25
  • 32

1 Answers1

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 */
RAZA
  • 1
  • 1