0

I am quite new to CPLEX and I am writing a very simple model that CPLEX does not want to satisfy. I know my model is "verbose" as I have variables that simply equal other variables, but it is my first step to a more complicated model so I want it this way. I don't see why would this upset CPLEX.

The model I have is:

Minimize
obj: v1
Subject To

l1: i_AB1 + i_AC1 - i_AB2 - i_AC3 = 1
l2: - i_AB1 + I_BB = 0
l3: I_CA + I_CC = 0


e5:   i_AB2 + i_BD2 - I_BB = 0

e8:   - i_AC1 - I_CA = 0
e9:   i_AC3 + i_CD3 - I_CC = 0


\Indicator constraints

\For each connection XY

c1:  bAB = 1-> i_AB1 - 1 v1 = 0
c2:  bAB = 1-> i_AB2 - 1 v2 = 0

c5:  bAC = 1-> i_AC1 - 1 v1 = 0
c6:  bAC = 1-> i_AC3 - 1 v3 = 0

c9:  bBD = 1-> i_BD2 - 1 v2 = 0

c13: bCD = 1-> i_CD3 - 1 v3 = 0

c15: bAB = 1
c16: bAC = 1
c17: bBD = 1
c18: bCD = 1


Bounds
    0 <= v1 <= 1000
-1000 <= v2 <= 1000
-1000 <= v3 <= 1000


General

Binaries
bAB bAC bBD bCD
End

This, apparently does not have a solution (it does, or at least that is my intention, but CPLEX says no!).

But then I substitute the equation e8 into l3 and I get the solution I wanted! Here is the code:

Minimize
obj: v1
Subject To


\budget: 

l1: i_AB1 + i_AC1 - i_AB2 - i_AC3 = 1
l2: - i_AB1 + I_BB = 0
l3: - i_AC1  + I_CC = 0

e5:   i_AB2 + i_BD2 - I_BB = 0

\Row C
\e8:   - i_AC1 - I_CA = 0
e9:   i_AC3 + i_CD3 - I_CC = 0


\Indicator constraints

\For each connection XY

c1:  bAB = 1-> i_AB1 - 1 v1 = 0
c2:  bAB = 1-> i_AB2 - 1 v2 = 0

c5:  bAC = 1-> i_AC1 - 1 v1 = 0
c6:  bAC = 1-> i_AC3 - 1 v3 = 0

c9:  bBD = 1-> i_BD2 - 1 v2 = 0

c13: bCD = 1-> i_CD3 - 1 v3 = 0

c15: bAB = 1
c16: bAC = 1
c17: bBD = 1
c18: bCD = 1


Bounds
    0 <= v1 <= 1000
-1000 <= v2 <= 1000
-1000 <= v3 <= 1000


General

Binaries
bAB bAC bBD bCD
End

Both are, to my eyes, the exact same model. What am I doing wrong so that the first model does not have a solution even though it seems equivalent to the second which does have a solution?

Btw, the solution is:

Populate: phase I 
Tried aggregator 2 times.
MIP Presolve eliminated 4 rows and 4 columns.
Aggregator did 11 substitutions.
All rows and columns eliminated.
Presolve time =    0.00 sec.

Populate: phase II 
Solution status: 129.
Objective value of the incumbent: 1
Incumbent: Column v1:  Value =                 1
Incumbent: Column i_AB1:  Value =                 1
Incumbent: Column i_AC1:  Value =                 1
Incumbent: Column i_AB2:  Value =               0.5
Incumbent: Column i_AC3:  Value =               0.5
Incumbent: Column I_BB:  Value =                 1
Incumbent: Column I_CC:  Value =                 1
Incumbent: Column i_BD2:  Value =               0.5
Incumbent: Column i_CD3:  Value =               0.5
Incumbent: Column bAB:  Value =                 1
Incumbent: Column v2:  Value =               0.5
Incumbent: Column bAC:  Value =                 1
Incumbent: Column v3:  Value =               0.5
Incumbent: Column bBD:  Value =                 1
Incumbent: Column bCD:  Value =                 1

The solution pool contains 1 solutions.
0 solutions were removed due to the solution pool relative gap parameter.
In total, 1 solutions were generated.
The average objective value of the solutions is 1.

Solution        Objective   Number of variables
                value       that differ compared to
                            the incumbent
p1              1         0 / 15

The problem itself is not even a MIP (because I fixed my booleans in this initial version, but it will be a proper MIP). Does this change something? I really don't see what the issue is.

Thanks

excalibur1491
  • 1,201
  • 2
  • 14
  • 29

1 Answers1

1

I believe the problem is due to the fact that by default I_CA has a lower bound of 0. In the Bounds section in the documentation for the LP format it says

Upper and lower bounds may also be entered separately ... with the default lower bound of 0 (zero) and the default upper bound of +∞ remaining in effect until the bound is explicitly changed.

If you add I_CA free to the bounds section for your first LP file, then it becomes feasible.

rkersh
  • 4,447
  • 2
  • 22
  • 31
  • Great, thanks! In a very related topic: should I be concerned about having so many "trivial" equalities (the constraints called "e")? I just want to have them for readability, but I don't want them to make CPLEX slow. The main decisions cplex must do is on the binary variables for my problem. – excalibur1491 Jul 10 '16 at 23:34
  • Personally, I can't say whether this will affect performance or not in the end (you didn't say how large your problems will be nor whether you had some time constraint in mind). Modeling can be an art form in itself. From a programming point of view, I'm not a fan of including things that are not essential (i.e., I wouldn't add them until they are actually needed). However, you said that this is for readability (which is important) and that the problem will get more complex (presumably meaning that they will be needed at some point). So, perhaps it's more a matter of taste. – rkersh Jul 11 '16 at 18:38
  • You are probably right, I don't think I need them, the I_XX won;t be used anywhere else, it's just the "XX" has an actual meaning when looking at edges in a graph for my problem. But you are right, I'll get rid of them, they don't really help that much. As for size, I was planing on going around 10^6 equalities of size at most 16 (the lx and ex in my model merged together), then 10^6 indicator constraints. A total of 10^6 unknowns. Is this an order of magnitude CPLEX can handle? Thanks – excalibur1491 Jul 11 '16 at 23:27
  • Yes, CPLEX can handle a problem of that size. See, for example, [this](https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014470015) developerWorks thread here for more details. – rkersh Jul 12 '16 at 18:43