当前位置: 首页>>代码示例>>Python>>正文


Python Solver.next_step方法代码示例

本文整理汇总了Python中solver.Solver.next_step方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.next_step方法的具体用法?Python Solver.next_step怎么用?Python Solver.next_step使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在solver.Solver的用法示例。


在下文中一共展示了Solver.next_step方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MainWindow

# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import next_step [as 别名]

#.........这里部分代码省略.........
        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()

    def solve_whole_step(self):
        """
        solves one iterations
        :return:
        """
        while not self.model.finish:
            # if self.model.current_time > 800:
            #
            #     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()

        if self.runtime_table:
            self.runtime_table.update_tables()
            self.runtime_table.activateWindow()

        #add reset
        self.model.finish = False
        self.algorithms.solution_sequence['error'] = self.add_errors()
        self.model.reset()
        if self.current_iteration > 1:
            self.algorithms.calculate()
        self.current_iteration += 1

    def solve_one_step(self):
        """
        goes one time step forward
        :return:
        """

        self.model.next_step()
        # self.simulation.update_image()

        if self.runtime_table:
            self.runtime_table.update_tables()
            self.runtime_table.activateWindow()

        if self.model.finish:
            #finished
开发者ID:mparlaktuna,项目名称:capraz_sevkiyat_yazilimi,代码行数:70,代码来源:gui.py

示例2: GeneralInfo

# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import next_step [as 别名]

#.........这里部分代码省略.........
                    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):
        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
开发者ID:mparlaktuna,项目名称:capraz_sevkiyat_yazilimi,代码行数:70,代码来源:general_info.py


注:本文中的solver.Solver.next_step方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。