コード例 #1
0
def test():
    """
    Prueba del entorno y los agentes

    """
    print "Test TwoRoomsBlind enviroment with random agent"
    enviroment.simulate(TwoRoomsBlind(),
                        RandomAgent(['goA', 'goB', 'clean', 'noOp']),
                        ('A', 'dirty', 'dirty'), 100)

    print "Test TwoRoomsBlind enviroment with model-based reflex agent"
    enviroment.simulate(TwoRoomsBlind(), ModelReflexAgentTwoRoomsBlind(),
                        ('A', 'dirty', 'dirty'), 100)
コード例 #2
0
def test():
    """
    Prueba del entorno y los agentes

    """
    print "Test TwoRoomsBlind enviroment with random agent"
    enviroment.simulate(TwoRoomsBlind(),
                       RandomAgent(['goA', 'goB', 'clean', 'noOp']),
                       ('A', 'dirty', 'dirty'), 100)

    print "Test TwoRoomsBlind enviroment with model-based reflex agent"
    enviroment.simulate(TwoRoomsBlind(),
                       ModelReflexAgentTwoRoomsBlind(),
                       ('A', 'dirty', 'dirty'), 100)
コード例 #3
0
def test():
    """
    Prueba del entorno y los agentes

    """
    print "Prueba del entorno de dos cuartos con un agente aleatorio"
    enviroment.simulate(TwoRooms(),
                        RandomAgent(['goA', 'goB', 'clean',
                                     'noOp']), ('A', 'dirty', 'dirty'), 100)

    print "Prueba del entorno de dos cuartos con un agente reactivo"
    enviroment.simulate(TwoRooms(), ReflexAgentTwoRooms(),
                        ('A', 'dirty', 'dirty'), 100)

    print "Prueba del entorno de dos cuartos con un agente reactivo"
    enviroment.simulate(TwoRooms(), ModelReflexAgentTwoRooms(),
                        ('A', 'dirty', 'dirty'), 100)
コード例 #4
0
def test():
    """
    Enviroment and agents tests

    """
    default_state = ((0,0), {(0,0):"dirty", (0,1):"dirty", (0,2):"dirty", (1,0):"dirty", (1,1):"dirty", (1,2):"dirty"})
    print "Test SixRooms enviroment with random agent"
    enviroment.simulate(SixRooms(),
                       SixRoomsRandomAgent(),
                       deepcopy(default_state),
                        100)

    print "Test SixRooms enviroment with reflex agent"
    enviroment.simulate(SixRooms(),
                       ReflexAgentSixRooms(),
                       deepcopy(default_state),
                        100)

    print "Test SixRooms enviroment with model-based reflex agent"
    enviroment.simulate(SixRooms(),
                       ModelReflexAgentSixRooms(),
                       deepcopy(default_state),
                        100)
コード例 #5
0
def test():
    """
    Enviroment and agents tests

    """
    default_state = ((0, 0), {
        (0, 0): "dirty",
        (0, 1): "dirty",
        (0, 2): "dirty",
        (1, 0): "dirty",
        (1, 1): "dirty",
        (1, 2): "dirty"
    })
    print "Test SixRooms enviroment with random agent"
    enviroment.simulate(SixRooms(), SixRoomsRandomAgent(),
                        deepcopy(default_state), 100)

    print "Test SixRooms enviroment with reflex agent"
    enviroment.simulate(SixRooms(), ReflexAgentSixRooms(),
                        deepcopy(default_state), 100)

    print "Test SixRooms enviroment with model-based reflex agent"
    enviroment.simulate(SixRooms(), ModelReflexAgentSixRooms(),
                        deepcopy(default_state), 100)
コード例 #6
0
from copy import deepcopy

six_rooms_default = ((0, 0), {
    (0, 0): "dirty",
    (0, 1): "dirty",
    (0, 2): "dirty",
    (1, 0): "dirty",
    (1, 1): "dirty",
    (1, 2): "dirty"
})
two_rooms_default = ('A', 'dirty', 'dirty')

print "_" * 80
print "Excersice 1,2: SixRooms"
random_performance = enviroment.simulate(SixRooms(), SixRoomsRandomAgent(),
                                         deepcopy(six_rooms_default), 100,
                                         False)[2][-1]
model_performance = enviroment.simulate(SixRooms(), ModelReflexAgentSixRooms(),
                                        deepcopy(six_rooms_default), 100,
                                        False)[2][-1]
print "Random Agent performance:             " + str(random_performance)
print "Model-based Reflex Agent performance: " + str(model_performance)
print "\nModel-based Agent is " + str(
    float(random_performance) /
    float(model_performance)) + " times better than Random Agent."
print "*Based on a 100 step simulation"

print "_" * 80
print "\n\nExcersice 3: TwoRoomsBlind"
random_performance = enviroment.simulate(
    TwoRoomsBlind(), RandomAgent(['goA', 'goB', 'clean', 'noOp']),
コード例 #7
0
"""
__author__ = 'Manuel Valle'

import enviroment
from six_rooms import *
from two_rooms_blind import *
import two_rooms_stochastic as trs
from copy import deepcopy

six_rooms_default = ((0,0), {(0,0):"dirty", (0,1):"dirty", (0,2):"dirty", (1,0):"dirty", (1,1):"dirty", (1,2):"dirty"})
two_rooms_default = ('A', 'dirty', 'dirty')

print "_"*80
print "Excersice 1,2: SixRooms"
random_performance = enviroment.simulate(SixRooms(), 
                                         SixRoomsRandomAgent(), 
                                         deepcopy(six_rooms_default), 
                                         100, False)[2][-1]
model_performance = enviroment.simulate(SixRooms(), ModelReflexAgentSixRooms(), deepcopy(six_rooms_default), 100, False)[2][-1]
print "Random Agent performance:             " + str(random_performance)
print "Model-based Reflex Agent performance: " + str(model_performance)
print "\nModel-based Agent is " + str(float(random_performance)/float(model_performance)) + " times better than Random Agent."
print "*Based on a 100 step simulation"


print "_"*80
print "\n\nExcersice 3: TwoRoomsBlind"
random_performance = enviroment.simulate(TwoRoomsBlind(), 
                                         RandomAgent(['goA', 'goB', 'clean', 'noOp']),
                                         two_rooms_default, 
                                         100, 
                                         False)[2][-1]