コード例 #1
0
def test_inputs():
    horizon, theta, deadline, solver_type = get_solver_param()
    g, v0_target, v0_searchers, target_motion, belief_distribution = parameters_sim()

    specs = MyInputs()

    specs.set_theta(theta)
    specs.set_deadline(deadline)
    specs.set_solver_type(solver_type)
    specs.set_horizon(horizon)
    specs.set_graph(0)
    specs.set_start_target(v0_target)
    specs.set_start_searchers(v0_searchers)
    specs.set_target_motion(target_motion)
    specs.set_belief_distribution(belief_distribution)

    assert g["name"] == specs.graph["name"]
    assert specs.horizon == horizon
    assert specs.theta == theta
    assert specs.start_target_random is False
    assert specs.start_target_true == v0_target[0]
    assert specs.start_searcher_random is False
    assert specs.start_searcher_v == v0_searchers
    assert specs.target_motion == target_motion
    assert specs.belief_distribution == belief_distribution
コード例 #2
0
def my_specs():
    theta = 2
    deadline = 6
    horizon = 3
    solver_type = 'central'

    graph_file = 'G7V_test.p'
    g = ext.get_graph(graph_file)
    target_motion = 'random'
    belief_distribution = 'uniform'

    v0_target = [7]
    v0_searchers = [1, 2]

    specs = MyInputs()

    specs.set_graph(0)
    specs.set_theta(theta)
    specs.set_deadline(deadline)
    specs.set_solver_type(solver_type)
    specs.set_horizon(horizon)
    specs.set_start_target(v0_target)
    specs.set_start_searchers(v0_searchers)
    specs.set_target_motion(target_motion)
    specs.set_belief_distribution(belief_distribution)

    return specs
コード例 #3
0
def my_specs():
    horizon, theta, deadline, solver_type = get_solver_param()
    g, v0_target, v0_searchers, target_motion, belief_distribution = parameters_sim()

    specs = MyInputs()

    specs.set_graph(0)
    specs.set_theta(theta)
    specs.set_deadline(deadline)
    specs.set_solver_type(solver_type)
    specs.set_horizon(horizon)
    specs.set_start_target(v0_target)
    specs.set_start_searchers(v0_searchers)
    specs.set_target_motion(target_motion)
    specs.set_belief_distribution(belief_distribution)

    return specs
コード例 #4
0
ファイル: call_sam.py プロジェクト: XiaoJake/milp_mespp
def call_sim_ex():
    """Example for changing specs and calling the planner """

    # initialize default inputs
    specs = MyInputs()

    # load graph, either by number (int), iGraph object or .p file name (str)
    specs.set_graph(8)
    # solver parameter: central x distributed
    specs.set_solver_type('distributed')
    # target motion
    specs.set_target_motion('static')
    # searchers' detection: capture range and false negatives
    m = 3
    specs.set_capture_range(0)
    specs.set_size_team(m)

    # time-step stuff: deadline mission (tau), planning horizon (h), re-plan frequency (theta)
    h = 10
    specs.set_all_times(h)
    specs.set_deadline(50)
    specs.set_theta(1)
    # solver timeout (in sec)
    specs.set_timeout(120)

    # belief
    n = len(specs.graph.vs)
    v_maybe = [8, 10, 12, 14, 15, 17]
    b_0 = [0.0 for i in range(n + 1)]
    for v in v_maybe:
        b_0[v] = 1 / 6
    specs.set_b0(b_0)
    specs.set_start_target_vertex(5)
    # searchers initial vertices
    specs.set_start_searchers([1, 1, 1])

    # run simulator
    belief, target, searchers, sim_data = sf.run_simulator(specs)