# binary linear programming

to whom it may concern greeting

I have written a binary linear programing. It seems ok.

But the result is MIPSolverException: 'GLPK : Solution is undefined'

I will appreciate if you can help me and describe the reason

Regards Aissan

edit retag close merge delete

It's usually not possible to debug a program without seeing it. If you can edit your question and add a minimal example the recreates your problem then someone can try to help.

( 2012-11-03 10:50:36 -0600 )edit

Sort by » oldest newest most voted

this my code, it is too long, so, I hope that you can understand it :

scheduling=MixedIntegerLinearProgram(maximization=false )

from sage.numerical.mip import Sum

#####variables

f = scheduling.new_variable (dim=4, binary=true)
#f is the source to destination in time t

l = scheduling.new_variable (dim=4, binary=true)
#L id 0 if link op not selected for demand k in time t

A  = scheduling.new_variable(dim=6,binary=true)
# A is binary s to d in link op in time t for demand k
z_op=scheduling.new_variable(dim=2,binary=true)
#Z is 1 if is link op is on
y = scheduling.new_variable(dim=1,binary=true)

#####parameters
Num_demand_slice= 1
#number of the time slice

# power of the link op that is considered as cost

demand_traffic_kt = matrix ([1]);
# 0/1 matrix if demand has traffic in t is 1

rate_k= [2];
#rate of the trafic of the demand k

# zero if not exist this link in graph, others capacity of that 5 or 6 (not binary matrix)
power_sw_o= [[0,0,2,2,2]]
#power of the sw o if is zero means that it is server
V=5
K=1
B=Num_demand_slice * K

#####constraint
# v is the num of the node
# K is the num of the node

for o in range (0,V):
for p in range (0,V):
for t in range (0,Num_demand_slice):
for k in range (0,K):

for t in range (0,Num_demand_slice ):
for k in range (0,K):
if demand_traffic_kt[k][t]==0 :
for s in range (0,V ):
for d in range (0,V ):

for t in range (0,Num_demand_slice ):
for k in range (0,K):
if demand_traffic_kt[k][t]==0 :
for o in range (0,V ):
for p in range (0,V ):

for t in range(0,Num_demand_slice):
for d in range(0,V ):
for k in range(0,K ):
for o in range(0,V ):
for p in range(0,V ):
for s in range(0,Num_demand_slice ):
scheduling.add_constraint(f[s][d][k][t] + l[o][p][k][t]- 1 <= A[s][d][k][o][p][t])

for t in range(0,Num_demand_slice ):
for d in range(0,V ):
for k in range(0,K ):
for o in range(0,V ):
for p in range(0,V ):
for s in range(1,Num_demand_slice+1 ):
scheduling.add_constraint(f[s][d][k][t] + l[o][p][k][t] >= 2* A[s][d][k][o][p][t])

for t in range(0,Num_demand_slice ):
for k in range(0,K):
for ...
more