本文整理汇总了Python中salma.model.world.World.getDomain方法的典型用法代码示例。如果您正苦于以下问题:Python World.getDomain方法的具体用法?Python World.getDomain怎么用?Python World.getDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类salma.model.world.World
的用法示例。
在下文中一共展示了World.getDomain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __l
# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import getDomain [as 别名]
def __l(world: World, step=None, **kwargs):
positions = []
assignments = []
brokenstates = []
robots = sorted(world.getDomain("robot"))
for rob in robots:
positions.append((rob.xpos, rob.ypos))
assignments.append(rob.next_task)
brokenstates.append(rob.broken)
columns = [step, world.time]
for p in positions:
columns.extend(p)
columns.extend(assignments)
columns.extend(brokenstates)
for ws in sorted(world.getDomain("workstation")):
columns.append(ws.delivered_item_count)
coordinator = world.getEntityById("coordinator1")
columns.append(translate_entities(coordinator.request_queue))
fd.write(";".join(list(map(str, columns))) + "\n")
fd.flush()
示例2: break_when_all_broken
# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import getDomain [as 别名]
def break_when_all_broken(world: World, **kwargs):
for r in world.getDomain("robot"):
if r.broken is False:
return None
return NOT_OK
示例3: break_when_all_delivered
# 需要导入模块: from salma.model.world import World [as 别名]
# 或者: from salma.model.world.World import getDomain [as 别名]
def break_when_all_delivered(world: World, **kwargs):
for i in world.getDomain("item"):
if i.delivered_to is None:
return None
return OK