The output value of LpInteger variable is LpContinuous

548 views
Skip to first unread message

ukyo

unread,
Mar 2, 2010, 2:14:07 AM3/2/10
to pulp-or-discuss
Hello all,

I'm currently using pulp-1.4.7 on python 2.6.4 in Windows Seven and
having a problem with the output value of LpInteger variables
(d,dc,dr,ar,at) (actually, it's a binary) which it should return 0 or
1. However, when I've added some constraints (constraint 3.39-3.40) to
the problem, the returned output values is between [0,1].

So my question is "Is Pulp automatically relax the LpInteger to
LpContinuous variable?"

Thank you
Ukyo


The code below presents some parts of my code.

# create an instance to LP problem
prob = LpProblem("sub and power assignment in coding
aware",LpMaximize)

# create variables
z = LpVariable ("z", 0.001, None,
LpContinuous)
r = LpVariable.dicts ("r", (SD_r,T), 0, None,
LpContinuous)
rc= LpVariable.dicts ("r_C", (SDC,T), 0, None,
LpContinuous)
rr= LpVariable.dicts ("r_R", (SDR,T), 0, None,
LpContinuous)
p = LpVariable.dicts ("p", (SD_pd,K,T), 0, None,
LpContinuous)
pc= LpVariable.dicts ("p_C", (SDC,K,T), 0, None, LpContinuous)
pr= LpVariable.dicts ("p_R", (SDR,K,T), 0, None,
LpContinuous)
d = LpVariable.dicts ("d", (SD_pd,K,T), 0, 1,
LpInteger)
dc= LpVariable.dicts ("d_C", (SDC,K,T), 0, 1, LpInteger)
dr= LpVariable.dicts ("d_R", (SDR,K,T), 0, 1,
LpInteger)
ar= LpVariable.dicts ("ar", (V,T), 0, 1,
LpInteger)
at= LpVariable.dicts ("at", (V,T), 0, 1,
LpInteger)
...
#--------------------------------------------------------------
# 7. Transmission and receive constraints
#--------------------------------------------------------------
for t in T:
# --- ar ---
# constraint 3.39 (BS)
prob += C*ar["BS"][t] >= sum([dc["RS,MS1"][k][t]+dr["RS,BS"][k][t]
for k in K]),"Constraint 3.39 (n="+"BS"+",T="+t+")"

# constraint 3.39 (RS)
prob += C*ar["RS"][t] >= sum([d["BS,RS"][k][t]+d["MS1,RS"][k][t]
for k in K]),"Constraint 3.39 (n="+"RS"+",T="+t+")"

# constraint 3.39 (MS1)
prob += C*ar["MS1"][t] >= sum([dc["RS,MS1"][k][t] for k in
K]),"Constraint 3.39 (n="+"MS1"+",T="+t+")"

# --- at ---
# constraint 3.40 (BS)
prob += C*at["BS"][t] >= sum([d["BS,RS"][k][t] for k in
K]),"Constraint 3.40 (n="+"BS"+",T="+t+")"

# constraint 3.40 (RS)
prob += C*at["RS"][t] >= sum([dc["RS,MS1"][k][t]+dr["RS,BS"][k][t]
for k in K]),"Constraint 3.40 (n="+"RS"+",T="+t+")"

# constraint 3.40 (MS1)
prob += C*at["MS1"][t] >= sum([d["MS1,RS"][k][t] for k in
K]),"Constraint 3.40 (n="+"MS1"+",T="+t+")"

for n in V:
# constraint 3.41
prob += ar[n][t]+at[n][t] == 1,"Constraint 3.41 (n="+n+",T="+t
+")"

prob.writeLP("lp_ca_w_time.lp")

# solve the problem using coin
prob.solve()

Stu

unread,
Mar 2, 2010, 3:51:41 PM3/2/10
to pulp-or-discuss
If you send me (off list if you want) the whole file I will run and
test it for you

I suspect that perhaps the problem is infeasible in some way and pulp
does not return the optimal integer solution.

Please check the status returned by LpProblem.solve()

like this
>>> status = prob.solve()
>>> print LpStatus[status]

and see what is returned.

Please see my next Email for a possible solution.

Vinaka
Stu

Stu

unread,
Mar 3, 2010, 3:56:23 PM3/3/10
to pulp-or-discuss, bja...@maximalsoftware.com, coi...@list.coin-or.org
I have found your problem there is a known problem with coinMP that I
am forwarding on to its maintainer that is reflected in the output of
>>> pulpTestSolver(COINMP_DLL)
Testing continuous LP solution
Testing maximize continuous LP solution
Testing unbounded continuous LP solution
Error in CoinMP it reports Optimal
Testing MIP solution
Testing MIP relaxation
Testing feasibility problem (no objective)
Testing an infeasible problem
Testing an integer infeasible problem
Error in CoinMP to be fixed, reports Optimal
Testing column based modelling
Testing column based modelling with empty constraints
Testing dual variables and slacks reporting
Testing resolve of problem
Testing Sequential Solves
Testing fractional constraints
Testing elastic constraints (no change)
Testing elastic constraints (freebound)
Testing elastic constraints (penalty unchanged)
Testing elastic constraints (penalty unbounded)
>>>

Note that Integer Infeasible problems are reported as optimal because
the lpsolver in CoinMP will report optimality.
This issue will hopefully be fixed soon on CoinMP but in the mean time
use COIN_CMD or GUROBI as your solver which will report Undefined and
Infeasible status respectively.

Vinaka
Stu

ukyo

unread,
Mar 3, 2010, 9:50:25 PM3/3/10
to pulp-or-discuss
Thanks Stuart.
Reply all
Reply to author
Forward
0 new messages