def six_3(): # Process input and returns graph dictionary G = ip.process_input_6_3() # Changing attributes of the graph to maintain different terms used; # Pass boolean value to tell the method if a 'min' value is wanted in the graph newG = ip.changeGraphAttributes(G, False, 'ToCapFlow') ts1 = datetime.datetime.now() resG = FF1.fordfulkersan(newG) ts2 = datetime.datetime.now() ft.write('\n 6.3 FF :'+ str((ts2 - ts1).microseconds)+ 'ms') # Modify result graph to 'max' newResG = ip.changeGraphAttributes(resG, False, 'ToMaxMin') A, B = mc.create_min_cut_sets(newResG, [], 'S', []) profit, output = mc.computeProfit_Output(A, B, G) file_result = open('Result_File_6.3.txt', 'ab') file_result.write('\nFF Tasks Chosen and Profit: \n') file_result.write('6.3: Tasks Chosen: '+ str(output)+'\n') file_result.write('6.3: Total Profit: ' + str(profit)+ '\n')
def six_3(): # process input and returns graph dictionary G = ip.process_input_6_3() # ip.draw_graph(G, 'Original Graph_6.3') ts1 = datetime.datetime.now() max_flow, F, nim, RG = EK.edmond_karp(G, "6.3", None) ts2 = datetime.datetime.now() ft.write("\n 6.3 EK : " + str((ts2 - ts1).microseconds) + "ms") # ip.draw_graph(RG, 'Residual Graph_6.3') # print RG, F A, B = mc.create_min_cut_sets(RG, F, "S", nim) profit, output = mc.computeProfit_Output(A, B, G) file_result = open("Result_File_6.3.txt", "ab") file_result.write("EK Tasks Chosen and Profit: \n") file_result.write("6.3: Tasks Chosen: " + str(output) + "\n") file_result.write("6.3: Total Profit: " + str(profit) + "\n")
def six_3(): #process input and returns graph dictionary G = ip.process_input_6_3() #ip.draw_graph(G, 'Original Graph_6.3') ts1 = datetime.datetime.now() max_flow, F, nim, RG = EK.edmond_karp(G, '6.3', None) ts2 = datetime.datetime.now() ft.write('\n 6.3 EK : ' + str((ts2 - ts1).microseconds) + 'ms') #ip.draw_graph(RG, 'Residual Graph_6.3') #print RG, F A, B = mc.create_min_cut_sets(RG, F, 'S', nim) profit, output = mc.computeProfit_Output(A, B, G) file_result = open('Result_File_6.3.txt', 'ab') file_result.write('EK Tasks Chosen and Profit: \n') file_result.write('6.3: Tasks Chosen: ' + str(output) + '\n') file_result.write('6.3: Total Profit: ' + str(profit) + '\n')