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


Python Writer.set_chosen_output方法代码示例

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


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

示例1: InteractiveGame

# 需要导入模块: from writer import Writer [as 别名]
# 或者: from writer.Writer import set_chosen_output [as 别名]

#.........这里部分代码省略.........
                return
            next_state = possible_next_outputs * outvar_bdd

            # and assign the next state to current_state:
            next_state = self.__utils.swap_present_next(next_state)
            current_state = self.__utils.keep_only_present(next_state)
            step_count += 1

    def _print_current_state(self, current_state):
        """
        Prints the current state.

        This method prints the current state in the interactive game between
        the environment and the system to STDOUT. In addition to that, the
        state is written to the log file 'spec_debug_results/log.txt' with
        the help of the L{Writer}.

        @param current_state: The state to print.
        @type current_state: L{BDD}
        """

        print "current state:"

        # print the input variables:
        for in_var in self.__utils.input_vars:
            symb = self.__utils.get_val_as_string(current_state, in_var, False)
            print "current " + in_var.name + " is: " + symb
            self.__writer.set_chosen_input(in_var.name, symb)

        # print the output variables:
        for out_var in self.__utils.relevant_out_vars:
            symb = self.__utils.get_val_as_string(current_state, out_var, False)
            print "current " + out_var.name + " is: " + symb
            self.__writer.set_chosen_output(out_var.name, symb);

        # print the ix-variables:
        ix_value = self.__utils.get_decimal_ix_val(current_state, False)
        if ix_value != None:
            print "The environment tries to fulfill fairness condition nr",
            print str(ix_value) + " next";
            self.__writer.set_chosen_aux("ix", str(ix_value))
        else:
            print "The environment has not decided yet which fairness",
            print "condition it will try to reach next"
            self.__writer.set_chosen_aux("ix","?")

        # print the jx-variables:
        nr_changes = self.__utils.how_often_may_jx_change(current_state, \
                                                          self.__z_array)
        self.__writer.set_chosen_aux("jx changes", str(nr_changes))
        jx_value = self.__utils.get_decimal_jx_val(current_state, False);
        if jx_value != None:
            print "I try to keep the system from fulfilling fairness",
            print "condition nr: " + str(jx_value)
            print "I reserve the right to change my opinion on that at most",
            print str(nr_changes) + " times from now"
            self.__writer.set_chosen_aux("jx", str(jx_value))
        else:
            print "I have not decided yet which fairness condition of the",
            print "system I will try to evade";
            self.__writer.set_chosen_aux("jx","?")

        self.__writer.start_next_time_step()


    def _print_next_inputs(self, next_inputs):
开发者ID:johnyf,项目名称:marduk,代码行数:70,代码来源:interactive_game.py


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