Originally posted by: ACJ4_Telmo_Matos
Hi, thanks for your answer.
Well, you are right, the simple way to do what i want is to set the right hand side (RHS) to zero (to eliminate) or set the RHS to the actual capacity.
Bellow i give an example of a 6 by 5 problem (6 warehouses and 5 customers).
First line is warehouse and customer.
Next line [capacity] [opening cost]
Next So for each customer:
[demand of j]
[cost of allocating all demand of customer to facility
6 5
10 8.
10 7.
10 8.
10 9.
10 6.
10 6.
10
7. 6. 5. 5. 5. 1.
10
8. 8. 9. 6. 5. 1.
10
5. 6. 7. 4. 5. 1.
10
8. 9. 9. 9. 19. 1.
10
7. 7. 7. 7. 5. 1.
I want to eliminate the last warehouse (resulting to a 5 by 5 problem and the capacity of warehouses can serve all the 5 customers). For that i use the CPXchgrhs an i have this (the RHS of c6 is set to zero):
Minimize
obj: 7 x1 + 8 x2 + 5 x3 + 8 x4 + 7 x5 + 6 x6 + 8 x7 + 6 x8 + 9 x9 + 7 x10
+ 5 x11 + 9 x12 + 7 x13 + 9 x14 + 7 x15 + 5 x16 + 6 x17 + 4 x18 + 9 x19
+ 7 x20 + 5 x21 + 5 x22 + 5 x23 + 19 x24 + 5 x25 + x26 + x27 + x28 + x29
+ x30
Subject To
c1: x1 + x2 + x3 + x4 + x5 <= 10
c2: x6 + x7 + x8 + x9 + x10 <= 10
c3: x11 + x12 + x13 + x14 + x15 <= 10
c4: x16 + x17 + x18 + x19 + x20 <= 10
c5: x21 + x22 + x23 + x24 + x25 <= 10
c6: x26 + x27 + x28 + x29 + x30 <= 0
c7: x1 + x6 + x11 + x16 + x21 + x26 >= 10
c8: x2 + x7 + x12 + x17 + x22 + x27 >= 10
c9: x3 + x8 + x13 + x18 + x23 + x28 >= 10
c10: x4 + x9 + x14 + x19 + x24 + x29 >= 10
c11: x5 + x10 + x15 + x20 + x25 + x30 >= 10
End
When i print the solution, the variables x26, x27, x28, x29, x30 appear in the solution.
Is there any way to remove them? I try to use the CPX_PARAM_PREIND but didn't work..
Solution is:
x[0] = 0
x[1] = 0
x[2] = 0
x[3] = 10
x[4] = 0
x[5] = 0
x[6] = 0
x[7] = 0
x[8] = 0
x[9] = 10
x[10] = 10
x[11] = 0
x[12] = 0
x[13] = 0
x[14] = 0
x[15] = 0
x[16] = 0
x[17] = 10
x[18] = 0
x[19] = 0
x[20] = 0
x[21] = 10
x[22] = 0
x[23] = 0
x[24] = 0
x[25] = 0
x[26] = 0
x[27] = 0
x[28] = 0
x[29] = 0
Thank you.
#DecisionOptimization#MathematicalProgramming-General