예제 #1
0
파일: __init__.py 프로젝트: pierg/crome
    def composition(nodes: Set[Node], name: str = None, description: str = None) -> Node:

        try:
            new_goal = Goal.composition(nodes, name, description)
        except GoalException as e:
            raise CGGOperationFail(nodes=nodes, operation=CGGFailOperations.algebra_op, goal_ex=e)

        new_node = Node(goal=new_goal)

        new_node.add_children(link=Link.COMPOSITION, nodes=set(nodes))

        return new_node
예제 #2
0
from world.simple_gridworld import SimpleGridWorld
"""Let us instantiate a variables"""
sw = SimpleGridWorld()
t = sw.typeset
"""Definition of a goals"""

g1_a = Goal(name="init_a",
            description="Begin from location a",
            specification=Init(t["a"]))

g1_b = Goal(name="patrol_a_b",
            description="Patrolling of locations a and b",
            specification=Patrolling([t["a"], t["b"]]) & Init(t["a"]))

try:
    g1 = Goal.composition({g1_a, g1_b})
    print(g1)
except GoalException as e:
    raise e

g1 = Goal(
    name="patrol_a_b_init_a",
    description="Patrolling of locations a and b, beginning from location a",
    specification=Patrolling([t["a"], t["b"]]) & Init(t["a"]))

g2 = Goal(
    name="patrol_c_d_init_c",
    description="Patrolling of locations c and d, beginning from location c",
    specification=Patrolling([t["c"], t["d"]]) & Init(t["c"]))

try: