Ask Your Question
0

binary linear programming

asked 2012-11-03 12:39:15 +0100

updated 2012-11-03 16:49:14 +0100

benjaminfjones gravatar image

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 flag offensive close merge delete

Comments

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.

benjaminfjones gravatar imagebenjaminfjones ( 2012-11-03 16:50:36 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-11-04 11:51:33 +0100

updated 2012-11-05 11:35:51 +0100

kcrisman gravatar image

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_link_op= matrix ([[1,1,1,1,1],[1,1,1,1,1],[1,1,1,1,1],[1,1,1,1,1],[1,1,1,1,1]]) 
    # 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 

link_capacity_op= matrix ([[0,0,30,30,30],[0,0,30,30,30],[30,30,0,0,0],[30,30,0,0,0],[30,30,0,0,0]])
    # 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):
        if (link_capacity_op[o][p]==0):
            for t in range (0,Num_demand_slice):
                for k in range (0,K):
                    scheduling.add_constraint(l[o][p][k][t]==0)



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 ):
                    scheduling.add_constraint(f[s][d][k][t]==0)




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 ):
                    scheduling.add_constraint(l[o][p][k][t]==0)




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)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-11-03 12:39:15 +0100

Seen: 817 times

Last updated: Nov 05 '12