Ejemplo n.º 1
0
def default_specs():
    """Define specs for simulation of SS-2
    m = 3
    """
    specs = MyInputs2()

    # 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 = 5
    specs.set_all_times(h)
    specs.set_theta(1)
    # solver timeout (in sec)
    specs.set_timeout(10)

    specs.use_default()

    # danger stuff (uncomment to change)
    # specs.set_threshold(value, 'kappa')
    # specs.set_threshold(value, 'alpha')
    # specs.set_danger_data(eta_priori, eta_check)

    return specs
Ejemplo n.º 2
0
def get_believes():
    specs = specs_num_sim()

    for turn in specs.list_turns:

        # set seed according to run #
        specs.set_seeds(turn)
        # set new belief
        n = 46
        b0 = MyInputs2.pick_random_belief(n, specs.target_seed)

        # print(b0)

        if turn > 30:
            break
Ejemplo n.º 3
0
def get_specs_prob():
    specs = MyInputs2()
    # test graph
    specs.set_graph(4)

    # 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 = 2
    specs.set_capture_range(0)
    specs.set_size_team(m)
    # position
    v0 = [1, 1]
    specs.set_start_searchers(v0)
    b_0 = [0.0 for i in range(10)]
    b_0[8] = 0.5
    b_0[6] = 0.5
    specs.set_b0(b_0)

    # time-step stuff: deadline mission (tau), planning horizon (h), re-plan frequency (theta)
    h = 3

    specs.set_all_times(h)
    specs.set_theta(1)
    # solver timeout (in sec)
    specs.set_timeout(10)

    # danger stuff
    specs.set_threshold([3, 4], 'kappa')
    specs.set_danger_perception('prob')

    specs.set_threshold([0.9, 0.9], 'alpha')

    eta_true = [1, 3, 3, 4, 5, 3, 4, 4, 1]
    # transform in distribution
    eta_priori = []
    for level in eta_true:
        eta = MyDanger.eta_from_z(level, 1)
        eta_priori.append(eta)

    specs.set_danger_data(eta_true, 'true')
    specs.set_danger_data(eta_priori, 'priori')

    return specs
Ejemplo n.º 4
0
def get_specs():

    specs = MyInputs2()
    specs.set_graph(4)

    # 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 = 2
    specs.set_capture_range(0)
    specs.set_size_team(m)
    # position
    v0 = [1, 1]
    specs.set_start_searchers(v0)
    b_0 = [0.0 for i in range(10)]
    b_0[8] = 0.5
    b_0[6] = 0.5
    specs.set_b0(b_0)

    # time-step stuff: deadline mission (tau), planning horizon (h), re-plan frequency (theta)
    h = 3

    specs.set_all_times(h)
    # specs.set_theta(3)
    # solver timeout (in sec)
    specs.set_timeout(10)

    # danger stuff
    specs.set_threshold([3, 4], 'kappa')
    eta_true = [1, 3, 3, 4, 5, 3, 4, 4, 1]
    eta_priori = eta_true

    specs.set_danger_data(eta_true, 'true')
    specs.set_danger_data(eta_priori, 'priori')

    return specs
Ejemplo n.º 5
0
def specs_basic():
    # initialize default inputs
    specs = MyInputs2()
    # ------------------------
    # graph number -- SS-2: 8
    specs.set_graph(8)
    # solver parameter: central x distributed
    specs.set_solver_type('distributed')
    # solver timeout (in seconds)
    specs.set_timeout(10)
    # ------------------------
    # time stuff: deadline mission (tau), planning horizon (h), re-plan frequency (theta)
    specs.set_horizon(14)
    specs.set_deadline(100)
    specs.set_theta(1)
    specs.set_capture_range(0)
    specs.set_zeta(None)
    # ------------------------
    # target motion
    specs.set_target_motion('static')
    specs.set_start_target_vertex(None)

    return specs