Пример #1
0
def make_trivial_mdp(problem,N,actions):
    boundary = problem.gen_model.boundary.boundary
    assert(1 == len(boundary)) # 1 Dim problem
    (l,u) = boundary[0]
    assert(l == 0) # (0,N)
    assert(u == N-1)

    discretizer = discrete.TrivialDiscretizer(N)
    num_samples = 15
    
    builder = MDPBuilder(problem,
                         discretizer,
                         actions,
                         num_samples)
    mdp_obj = builder.build_mdp()
    return (mdp_obj,discretizer)
Пример #2
0
def make_uniform_mdp(problem,N,A):
    boundary = problem.gen_model.boundary.boundary
    grid = [(l,u,N) for (l,u) in boundary]
    discretizer = RegularGridInterpolator(grid)

    action_limits = problem.action_limits
    action_cuts = [np.linspace(l,u,A) for (l,u) in action_limits]
    actions = discrete.make_points(action_cuts)

    num_samples = 150
    
    builder = MDPBuilder(problem,
                         discretizer,
                         actions,
                         num_samples)
    mdp_obj = builder.build_mdp()
  
    return (mdp_obj,discretizer)