def getValidSolution(nodes, Xcase): while (True): G, D, C = designConstraintGraph(nodes, Xcase) Gx = copy.deepcopy(G) Dx = copy.deepcopy(D) Cx = copy.deepcopy(C) d, e = AC_I(Gx, Dx, Cx) if (d == True): break return G, D, C
def runExecution(Xcase, Ycase): start = 0 end = 0 Xaxis = [] Yaxis = {} Yaxis[1] = [] Yaxis[2] = [] Yaxis[3] = [] Yaxis[4] = [] solutionFound = 0 r1 = 3 r2 = 200 inc = 10 if Xcase == 1: #nodes r1 = 3 r2 = 200 inc = 10 elif Xcase == 2: #edges r1 = 3 r2 = 100 inc = 10 elif Xcase == 3: #density r1 = 48 r2 = 3 inc = -5 # elif Xcase==4: # r1=10 # r2=15 # inc=10 for nodes in range(r1, r2, inc): print("edges-------------->>>", nodes) T1 = 0 T2 = 0 T3 = 0 T4 = 0 for turn in range(0, 10): #change here pls !!!!!!!!!!!!!! # G, D, C = designConstraintGraph(nodes,1) # nodes vs G, D, C = designConstraintGraph(nodes, Xcase) # edge vs # G,D,C= getValidSolution(nodes,Xcase) # G, D, C = getManualGraph(185,510) # print("turn-------->") t1, t2, t3, t4 = 0, 0, 0, 0 D1, t1 = runAC(1, G, D, C, Ycase) D2, t2 = runAC(2, G, D, C, Ycase) D3, t3 = runAC(3, G, D, C, Ycase) D4, t4 = runAC(4, G, D, C, Ycase) T1 = (T1 * turn + t1) / (turn + 1.0) T2 = (T2 * turn + t2) / (turn + 1.0) T3 = (T3 * turn + t3) / (turn + 1.0) T4 = (T4 * turn + t4) / (turn + 1.0) if (D1 == D2 and D2 == D3 and D3 == D4): print("Solution Found") if Xcase == 3: Xaxis.append(nodes / 100.0) else: Xaxis.append(nodes) print("======", T1, T2, T3, T4) Yaxis[1].append(T1) Yaxis[2].append(T2) Yaxis[3].append(T3) Yaxis[4].append(T4) # print(Yaxis[1]) drawGraph(Xaxis, Yaxis, Xcase, Ycase)
k, m = edge d, cntch = REVISE(k, m, D, C) cnstcheck += cntch if (d): neighbours = G.neighbors(k) for p in neighbours: if (p <= i and p != m): queue2.append((p, k)) # print(e) # x,y=e # if(x==k and y<=i and y!=m): # queue2.append((y,x)) # elif(y==k and x<=i and x!=m): # queue2.append((x,y)) queue1 = queue2 queue2 = [] return cnstcheck if __name__ == '__main__': G, D, C = designConstraintGraph(10) AC_II(G, D, C) print(D)