本文整理汇总了Python中solver.Solver.reset方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.reset方法的具体用法?Python Solver.reset怎么用?Python Solver.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solver.Solver
的用法示例。
在下文中一共展示了Solver.reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import reset [as 别名]
#.........这里部分代码省略.........
self.model.current_data_set = self.current_data_set
if self.data_set_bool:
#print('one_set')1
if self.current_iteration == 1 and self.model.current_time == 0:
self.model.load_data_set()
self.solve_iteration()
if self.current_data_set == len(self.data.data_set_list):
# print('finish')
self.current_iteration = 1
self.current_data_set = 0
self.trial_time = 0
else:
while self.current_data_set < len(self.data.data_set_list):
if self.pause_bool:
break
self.model.load_data_set()
self.solve_iteration()
# print(self.current_data_set)
self.current_data_set = 0
def solve_iteration(self):
"""
solves one iteration
:return:
"""
if self.iteration_bool:
if self.model.current_time == 0:
if self.current_iteration == 1:
self.algorithms.start()
self.model.set_sequence(self.algorithms.solution_sequence)
self.solve_whole_step()
self.model.reset()
self.algorithms.next()
self.model.set_sequence(self.algorithms.solution_sequence)
else:
self.algorithms.next()
self.model.set_sequence(self.algorithms.solution_sequence)
self.solve_step()
if self.current_iteration == self.iteration_limit:
self.log_results()
self.current_iteration = 1
else:
while self.current_iteration < self.iteration_limit:
if self.pause_bool:
break
if self.model.current_time == 0:
if self.current_iteration == 1:
self.algorithms.start()
else:
self.algorithms.next()
self.model.set_sequence(self.algorithms.solution_sequence)
# next sequence
self.solve_step()
self.current_iteration = 1
self.log_results()
def solve_step(self):
if self.step_bool:
self.solve_one_step()
else:
self.solve_whole_step()