# Create a random enviroment sampled from a GP with an RBF kernel and specified hyperparameters, mean function 0 
# The enviorment will be constrained by a set of uniformly distributed  sample points of size NUM_PTS x NUM_PTS
ranges = (0., 10., 0., 10.)

world = envlib.Environment(ranges = ranges,
                           NUM_PTS = 20, 
                           variance = 100.0, 
                           lengthscale = 1.0, 
                           visualize = True,
                           seed = seed,
                           MIN_COLOR=MIN_COLOR, 
                           MAX_COLOR=MAX_COLOR)

# Create the evaluation class used to quantify the simulation metrics
evaluation = evalib.Evaluation(world = world, reward_function = reward_function)

# Populate a world with obstacles
# ow = obslib.FreeWorld()
# ow = obslib.BlockWorld(ranges, 1, dim_blocks= (2,2), centers=[(7,7)])
ow = obslib.ChannelWorld(ranges, (2.5,7), 3, 0.2)

# Create the point robot
robot = roblib.Robot(sample_world = world.sample_value, #function handle for collecting observations
                     start_loc = (5.0, 5.0, 0.0), #where robot is instantiated
                     extent = ranges, #extent of the explorable environment
                     kernel_file = None,
                     kernel_dataset = None,
                     prior_dataset =  None, #(data, observations), 
                     init_lengthscale = 1.0, 
                     init_variance = 100.0, 
Ejemplo n.º 2
0
    NOISE = 1.0

world = envlib.Environment(ranges = ranges,
                           NUM_PTS = 100, 
                           variance = VAR,
                           lengthscale = LEN,
                           noise = NOISE,
                           visualize = True,
                           seed = SEED,
                           MAX_COLOR = MAX_COLOR,
                           MIN_COLOR = MIN_COLOR,
			   model = gp_world,
                           obstacle_world = ow)

# Create the evaluation class used to quantify the simulation metrics
evaluation = evalib.Evaluation(world = world, reward_function = REWARD_FUNCTION)

# Generate a prior dataset
'''
x1observe = np.linspace(ranges[0], ranges[1], 5)
x2observe = np.linspace(ranges[2], ranges[3], 5)
x1observe, x2observe = np.meshgrid(x1observe, x2observe, sparse = False, indexing = 'xy')  
data = np.vstack([x1observe.ravel(), x2observe.ravel()]).T
observations = world.sample_value(data)
'''

print "Creating robot!"
# Create the point robot
robot = roblib.Robot(sample_world = world.sample_value, #function handle for collecting observations
                     start_loc = (5.0, 5.0, 0.0), #where robot is instantiated
                     extent = ranges, #extent of the explorable environment