本文整理汇总了Python中solver.Solver.reset_trucks方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.reset_trucks方法的具体用法?Python Solver.reset_trucks怎么用?Python Solver.reset_trucks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solver.Solver
的用法示例。
在下文中一共展示了Solver.reset_trucks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GeneralInfo
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import reset_trucks [as 别名]
#.........这里部分代码省略.........
# next sequence
self.solve_step()
self.current_iteration += 1
#print(self.current_iteration)
self.current_iteration = 1
#print('whole_iteration')
def solve_step(self):
if self.step_bool:
self.solve_one_step()
else:
self.solve_whole_step()
def solve_whole_step(self):
"""
solves one iterations
:return:
"""
while not self.model.finish:
if self.model.current_time > 800:
print('time limit')
break
if self.pause_bool:
break
self.model.next_step()
#finished
for truck in itertools.chain(self.model.outbound_trucks.values(), self.model.compound_trucks.values()):
truck.calculate_error()
#add reset
self.model.finish = False
self.algorithms.solution_sequence['error'] = self.add_errors()
self.model.reset_trucks()
if self.current_iteration > 1:
self.algorithms.calculate()
self.current_iteration += 1
#self.print_results()
def solve_one_step(self):
"""
goes one time step forward
:return:
"""
self.model.next_step()
self.simulation.update_image()
if self.model.finish:
#finished
for truck in self.model.outbound_trucks.values():
truck.calculate_error()
self.model.reset_trucks()
# add reset
self.add_errors()
#self.print_results()
self.current_iteration += 1
self.model.finish = False
self.algorithms.current_sequence['error'] = self.add_errors()
self.algorithms.calculate()
def add_errors(self):
"""
adds absolute values of the errors
:return: