Beispiel #1
0
    def __init__(self):
        """A basic test where Alice wants to give the object to Bob.
        Expected result : Alice moves to take the object and gives it to Bob."""
        alice = UAgent( 'Alice',
                        ['move', 'take', 'give'],
                        goals = [('know', 'Alice', ('location', 'pipo', 'Bob'))],
                        knowledge = [
                            ('know', 'Alice', ('location', 'pipo', 2)),
                            ('know', 'Alice', ('location', 'Bob', 1)),
                            ('know', 'Alice', ('free', 'Bob', True)),
                        ]
                )
        bob = UAgent( 'Bob',
                      ['move', 'put'],
                      [('know', 'Bob', ('location', 'pipo', 0))],
                      knowledge = [
                      ]
                )
                      
        pipo = UObject('pipo')

        uni = Universe(3)
        uni.add(alice, 0)
        uni.add(bob, 1)
        uni.add(pipo, 2)

        self.agents = [alice, bob]
        self.objects = [pipo]
        self.universe = uni
        self.nb_iteration_max = 6
        self.test_name = 'Test with Alice giving an object to Bob and Bob putting it somewhere else'
Beispiel #2
0
    def __init__(self):
        """A basic test where Alice can only order and wants to move the item.
        Bob can move and take/put items.
        Expected result : Alice orders Bob to move, take the item, move, put
        the item."""
        alice = UAgent('Alice',
                       can_do=['order'],
                       goals=[('know', 'Alice', ('location', 'pipo', 0))],
                       knowledge=[
                           ('know', 'Alice', ('location', 'pipo', 2)),
                           ('know', 'Alice', ('location', 'Bob', 1)),
                           ('know', 'Alice', ('free', 'Bob', True)),
                       ])
        bob = UAgent('Bob', ['move', 'take', 'put'],
                     goals=[],
                     knowledge=[('know', 'Bob', ('location', 'pipo', 2))])

        pipo = UObject('pipo')

        uni = Universe(3)
        uni.add(alice, 0)
        uni.add(bob, 1)
        uni.add(pipo, 2)

        self.agents = [alice, bob]
        self.objects = [pipo]
        self.universe = uni
        self.nb_iteration_max = 6
        self.test_name = 'Test with Alice ordering Bob to move the object.'
Beispiel #3
0
    def __init__(self):
        """A basic test where Alice puts objects in a box."""
        alice = UAgent(
            'Alice', ['move', 'take', 'put', 'place_in_box', 'fetch_from_box'],
            [(('know', 'Alice', ('location', 'pipo', 'pipobox')), ),
             (('know', 'Alice', ('location', 'pipo2', 'pipobox')), )],
            knowledge=[
                ('know', 'Alice', ('location', 'pipo', 1)),
                ('know', 'Alice', ('location', 'pipo2', 1)),
                ('know', 'Alice', ('location', 'pipobox', 2)),
                ('know', 'Alice', ('full', 'pipobox', False)),
            ],
            max_length_plan=9)

        pipo = UObject('pipo')
        pipo2 = UObject('pipo2')
        pipobox = Box('pipobox', 2)

        uni = Universe(3)
        uni.add(alice, 0)
        uni.add(pipo, 1)
        uni.add(pipobox, 2)
        uni.add(pipo2, 1)

        self.agents = [alice]
        self.objects = [pipo, pipo2, pipobox]
        self.universe = uni
        self.nb_iteration_max = 9
        self.test_name = 'Test with Alice putting 2 objects in the box'
Beispiel #4
0
    def __init__(self):
        """A basic test where Alice can move, take and put and wants to change
        the location of an object.
        Expected result : Alice moves to the item, takes it and moves it."""

        alice = UAgent(
            'Alice',
            ['move', 'take', 'put'],
            [
                ('know', 'Alice', ('location', 'pipo', 0)),
            ],
            [
                ('know', 'Alice', ('location', 'pipo', 1)),
            ],
        )
        pipo = UObject('pipo')

        uni = Universe(2)
        uni.add(alice, 0)
        uni.add(pipo, 1)

        self.agents = [alice]
        self.objects = [pipo]
        self.universe = uni
        self.nb_iteration_max = 4
        self.test_name = 'Test with Alice changing an object\'s position.'
Beispiel #5
0
    def __init__(self):
        """Basic test where Alice can only order and Bob can only move. Alice
        wants Bob to change his location.
        Expected result : Alice orders Bob to move."""

        alice = UAgent('Alice', ['order'],
                       [('know', 'Alice', ('location', 'Bob', 2))],
                       [('know', 'Alice', ('location', 'Bob', 1))])
        bob = UAgent('Bob', ['move'], [])

        uni = Universe(3)
        uni.add(alice, 0)
        uni.add(bob, 1)

        self.agents = [alice, bob]
        self.objects = []
        self.universe = uni
        self.nb_iteration_max = 3
        self.test_name = 'Test of Alice ordering moving to Bob.'
Beispiel #6
0
    def __init__(self):
        """A basic test where Alice asks Bob about the object she wants to take."""
        alice = UAgent('Alice', ['take', 'ask_if', 'ask_ref'], [
            (('know', 'Alice', ('location', 'pipo', 'Alice')), ),
        ], [],
                       max_length_plan=3)

        bob = UAgent('Bob', ['move', 'inform_if', 'inform_ref'], [],
                     [('know', 'Bob', ('location', 'pipo', 0))])

        pipo = UObject('pipo')

        uni = Universe(3)
        uni.add(alice, 0)
        uni.add(bob, 2)
        uni.add(pipo, 0)

        self.agents = [alice, bob]
        self.objects = [pipo]
        self.universe = uni
        self.nb_iteration_max = 6
        self.test_name = 'Test with Alice asking Bob about the object.'
Beispiel #7
0
    def __init__(self):
        """ Trivial test
        Alice is at location 0, can move, and wants herself to be in location 1.
        Expected result : Alice moves from 0 to 1."""
        alice = UAgent('Alice', ['move'],
                       [('know', 'Alice', ('location', 'Alice', 1))])

        uni = Universe(2)
        uni.add(alice, 0)

        self.agents = [alice]
        self.objects = []
        self.universe = uni
        self.nb_iteration_max = 2
        self.test_name = 'Test of the move action.'
Beispiel #8
0
    def __init__(self):
        """A basic test where Alice wants to move an item and then move to
        another position."""
        alice = UAgent('Alice', ['move', 'take', 'put'], [
            (('know', 'Alice', ('location', 'pipo', 0)),
             ('know', 'Alice', ('location', 'Alice', 2))),
        ], [('know', 'Alice', ('location', 'pipo', 1))])

        pipo = UObject('pipo')

        uni = Universe(3)
        uni.add(alice, 0)
        uni.add(pipo, 1)

        self.agents = [alice]
        self.objects = [pipo]
        self.universe = uni
        self.nb_iteration_max = 5
        self.test_name = 'Test with Alice moving an item and moving.'