Exemple #1
0
            csedges.append([r1, r2])

for r1 in rules:
    for r2 in rules:
        if r1.no == r2.no:
            continue
    
        cnt = 0
        
        if MCNetsRule.IC(r1, r2):
            cnt = cnt + 1 
            n_ic = n_ic + 1
            
            c = Constraint()
            
            c.addVariable(xvar(r1), 1.0)
            c.addVariable(xvar(r2), 1.0)
            c.setType(Constraint.LT)
            c.setBound(1.0)
            
            constr.append(c)    # (17)
        
        if MCNetsRule.CS(r1,r2):
            cnt = cnt + 1 
            n_cs = n_cs + 1
            
        if MCNetsRule.CD(r1,r2):
            cnt = cnt + 1 
            n_cd = n_cd + 1
            
            if r2.no > r1.no:
Exemple #2
0

def xevar(g, e):
    global binary
    v = "xe_" + str(g[0]) + "_" + str(g[1]) + "_" + str(e[0]) + "_" + str(e[1])
    binary.add(v)
    return v


#
# Constraints of type (i)
#

for g in p.GS():
    c = Constraint()
    c.addVariable(xvar(g), 1.0)
    c.addVariable(xevar(g, p.h(g)), -1.0)
    c.setType(Constraint.EQ)
    c.setBound(0.0)
    constr.append(c)

#
# Constraints of type (ii)
#

for t in p.T:
    zero = True
    for x in p.T[t]:
        if x != 0:
            zero = False
    if zero:
Exemple #3
0

def xevar(g, e):
    global binary
    v = "xe_" + str(g[0]) + "_" + str(g[1]) + "_" + str(e[0]) + "_" + str(e[1])
    binary.add(v)
    return v


#
# Constraints of type (i)
#

for g in p.GS():
    c = Constraint()
    c.addVariable(xvar(g), 1.0)
    c.addVariable(xevar(g, p.h(g)), -1.0)
    c.setType(Constraint.EQ)
    c.setBound(0.0)
    constr.append(c)

#
# Constraints of type (ii)
#

for t in p.T:
    zero = True
    for x in p.T[t]:
        if x != 0:
            zero = False
    if zero: