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


Python World.create_new_world方法代码示例

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


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

示例1: setUp

# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import create_new_world [as 别名]
 def setUp(self):
     print("setup")
     World.create_new_world()
     world = World.instance()
     world.add_additional_expression_context_global("random", random)
     world.load_declarations()
     world.deactivate_all_events()
开发者ID:salmatoolkit,项目名称:salma,代码行数:9,代码来源:event_scheduling_test.py

示例2: setUp

# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import create_new_world [as 别名]
 def setUp(self):
     print("setup")
     World.create_new_world(erase_properties=True)
     world = World.instance()
     world.load_declarations()
     world.set_constant_value("gravity", [], 9.81)
     world.register_clp_function("robotLeftFrom")
     self.configure_events_default()
开发者ID:salmatoolkit,项目名称:salma,代码行数:10,代码来源:world_test_base.py

示例3: initialize

# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import create_new_world [as 别名]
    def initialize(self):
        if self.world is None:
            World.create_new_world(erase_properties=False)
            self.__world = World.instance()
            self.world.load_declarations()
            self.augment_world_context()

        self.create_entities()
        self.world.initialize()
        self.setup_distributions()
        self.create_initial_situation()
开发者ID:salmatoolkit,项目名称:salma,代码行数:13,代码来源:experiment.py

示例4: setUp

# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import create_new_world [as 别名]
    def setUp(self):
        self.dataFile = None
        self.dataBuffer = None

        World.create_new_world()
        world = World.instance()
        world.addFluent(Fluent("xpos", "float", [("r", "robot")], range=(20, 480)))
        world.addFluent(Fluent("ypos", "float", [("r", "robot")], range=(20, 480)))

        world.addFluent(Fluent("attached", "boolean", [("r", "robot"), ("i", "item")]))

        world.addFluent(Fluent("direction", "float", [("r", "robot")], range=(0, 2 * math.pi)))
        world.addFluent(Fluent("velocity", "float", [("r", "robot")], range=(0, 5.0)))

        world.addFluent(Fluent("light_sensor_value", "float", [("r", "robot"), ("s", "light_sensor")], range=(0, 1.0)))
        world.addFluent(
            Fluent("distance_sensor_value", "float", [("r", "robot"), ("s", "distance_sensor")], range=(0, 1.0)))

        world.addFluent(Fluent("item_sensor_value", "item", [("r", "robot")]))
        world.addFluent(Fluent("target_wavelength", "wavelength", [("r", "robot")]))
        world.addFluent(Fluent("light_active", "boolean", [("l", "light_source")]))

        update_direction = ParametricStochasticAction('update_direction',
                                                      [
                                                          ('rob', 'robot'),
                                                          ('direction', 'float'),
                                                          ('error', UniformDistribution('float', (0, 0)))
                                                      ], immediate=False)

        world.addAction(update_direction)

        update_velocity = ParametricStochasticAction('update_velocity',
                                                     [
                                                         ('rob', 'robot'),
                                                         ('velocity', 'float'),
                                                         ('error', UniformDistribution('float', (0, 0)))
                                                     ], immediate=False)

        world.addAction(update_velocity)

        update_light_sensor = ParametricStochasticAction('update_light_sensor',
                                                         [
                                                             ('rob', 'robot'),
                                                             ('sensor', 'light_sensor'),
                                                             ('wavelength', 'wavelength'),
                                                             ('error', UniformDistribution('float', (0, 0)))
                                                         ], immediate=True)
        world.addAction(update_light_sensor)

        update_distance_sensor = ParametricStochasticAction('update_distance_sensor',
                                                            [
                                                                ('rob', 'robot'),
                                                                ('sensor', 'distance_sensor'),
                                                                ('error', UniformDistribution('float', (0, 0)))
                                                            ], immediate=True)
        world.addAction(update_distance_sensor)

        world.addAction(
            DeterministicAction('grab',
                                [
                                    ('rob', 'robot'),
                                    ('i', 'item')
                                ], immediate=False)
        )

        world.addAction(
            DeterministicAction('drop',
                                [
                                    ('rob', 'robot'),
                                    ('i', 'item')
                                ], immediate=False)
        )

        world.addAction(
            UniformStochasticAction('sense_for_item', [('r', 'robot')],
                                    [RandomActionOutcome('update_item_sensor', [('r', 'robot')]),
                                     NOP_OUTCOME
                                    ]
            )
        )
开发者ID:salmatoolkit,项目名称:salma,代码行数:82,代码来源:ASCENS_robotic_scenario1.py

示例5: setUp

# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import create_new_world [as 别名]
 def setUp(self):
     self.logger = logging.getLogger('salmalab')
     World.create_new_world()
     world = World.instance()
     world.load_declarations()
开发者ID:salmatoolkit,项目名称:salma,代码行数:7,代码来源:info_transfer_test.py

示例6: setUp

# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import create_new_world [as 别名]
 def setUp(self):
     World.create_new_world()
     world = World.instance()
     world.load_declarations()
开发者ID:salmatoolkit,项目名称:salma,代码行数:6,代码来源:robot-simple-test.py


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