if passFId < FId: FId = passFId clear_gmsfile.clearfile() shiftLeftNum = shiftLeftNum - len(passVertex) print(f"Block[{n+1}] pass FId: {passFId}") print(f"Block[{n+1}] critical vertex: {passVertex}") #input() n += 1 for n in range(self.Nz): self.BlockList[n].showBlockData() return FId if __name__ == "__main__": clear_gmsfile.clearfile() timer = timer.MyTimer() cstr_test = AlcoholicCSTR(20) cstr_test.setStartDirect(-1) cstr_test.setMVnumber(2) #cstr_test.getData(vertex=[167,179],startDirect=-1) resultFId = cstr_test.solve(3) print(" ") print("Result FId:", resultFId) print("total calculate vertex:", cstr_test.cal_vertex_num) print("other possible vertex:") for dic in cstr_test.similar_vertex: print(dic) timer.getTime(kind="process") timer.getTime(kind="real")
cur_vertex = vertex_F min_FId = 100 critical_vertex = None while dist != 1: dist = dist // 2 poss_vertex_list = self.crtGridVertexList(vertex=cur_vertex, v_range=dist) #print(poss_vertex_list) for vertex in poss_vertex_list: f = self.solve_result(vertex) if f < min_FId: min_FId = f critical_vertex = vertex.copy() cur_vertex = critical_vertex print(cur_vertex) return critical_vertex if __name__ == "__main__": test = SingleTank(3) test.setStartDirect(-1) timer = timer.MyTimer() result_vertex = test.solve_detail([120, 380, 620], 20) using_time = timer.getTime(kind='real') print(result_vertex) print('using time:', using_time) exit()