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