PuLP LP File Dummy Constraints

734 views
Skip to first unread message

Ilia Karmanov

unread,
Sep 30, 2016, 8:42:27 AM9/30/16
to pulp-or-discuss
For some reason when I output my lp with pulp I notice dummy constraints:

_dummy: __dummy = 0
_C362: __dummy <= 1
..
_dummy: __dummy = 0
_C369: __dummy <= 1

I don't get these when I create the problem using gurobi-python API. However, my solution seems to be unaffected (I guess the dummy constraints are forced to 0 trivially) however I dont understand why they appear.

The constraint that causes this is not particularly special ... maybe I can try writing it to a text-file to see what I get:

for k, v in mydictionary.items():
   
if len(v) > 1:
       
for s in g[:-1]:
            model
+= pulp.lpSum(x[t, s] for tin v if sin compatible[mydf.loc[turn].Size]) <= 1


Fernando Badilla Veliz

unread,
Sep 30, 2016, 10:03:44 AM9/30/16
to pulp-or...@googlegroups.com
Can't really answer without looking at the model itself, but normally some preprocessing is made discarding unused variables hence the dummies. (Here you can mess with the solver options)

You could complete the for loop for marking each combination of indices when the x variable is used or not. Something like printing everywhere when the complete clause is true and when the clause is false.

Pseudocode really bad written:

for k, v in mydictionary.items():
   
if len(v) > 1:
       
for s in g[:-1]:
            model
+= pulp.lpSum(x[t, s] for tin v if sin compatible[mydf.loc[turn].Size]) <= 1
for tin v if sin compatible[mydf.loc[turn].Size
print "using" k,v,t,s

this for need decomposition also...
else:
print "not using" k,v,t,s
Goodluck!
Fdo Bad Vel
+56 9 93099326

--
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to pulp-or-discuss@googlegroups.com.
Visit this group at https://groups.google.com/group/pulp-or-discuss.
For more options, visit https://groups.google.com/d/optout.

Rennan Chagas

unread,
Apr 12, 2017, 7:17:00 PM4/12/17
to pulp-or-discuss
Hey guys!

I have the same problem here

there is a constraint set that gives me __dummy <= number constraints. I already printed variables, parameters and indices and everything looks ok

for v in vessellist:
if int(v.id) < len(Vessels)/2:
for k in routelist:
for t in range(k.freq):
prob += v.eta*Y[v.id][k.id][t] <= k.depart[t], 'Rdepart_'+str(v.id)+"_"+str(k.id)+"_"+str(t)

Here is a example of the output lp file

Rdepart_1_1_0: __dummy <= 17
Rdepart_1_1_1: __dummy <= 101
Rdepart_1_2_0: __dummy <= 76
Rdepart_1_2_1: __dummy <= 160

And this is what it should be

Rdepart_1_1_0: 0.0 Y_1_1_0 <= 17.0
Rdepart_1_1_1: 0.0 Y_1_1_1 <= 101.0
Rdepart_1_2_0: 0.0 Y_1_2_0 <= 76.0
Rdepart_1_2_1: 0.0 Y_1_2_1 <= 160.0
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To post to this group, send email to pulp-or...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages