Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs)...

16
Modeling in ATC Peter Robinson [email protected] – p.1/16

Transcript of Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs)...

Page 1: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Modeling in ATCPeter Robinson

[email protected]

– p.1/16

Page 2: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Topics

� Qu-Prolog� Threads� ICM� Elvin� Message Management� Agents� ATC Controller Example: Architecture� Details� Future Directions� Example Run

– p.2/16

Page 3: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Qu-Prolog

� Extension of Prolog:� Logic programming language� Built-in search� Rapid prototyping

� Support for agent programming

– p.3/16

Page 4: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Threads

Built-in support for creation and management of threads.� thread_fork(Name, Goal)

� thread_sleep(Secs)

� thread_atomic_goal(Goal)

� thread_wait_on_goal(Goal)

� thread_exit(Name)

– p.4/16

Page 5: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

ICM

� InterAgent Communications Model - Frank McCabe� Processes register names with ICM server� High-level message sends are of the form

� Term ->> ThreadName

� Term ->> ThreadName:ProcessName

� Term ->> ThreadName:ProcessName@Machine

� Server(s) store messages until named process iscreated (connected)

– p.5/16

Page 6: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Elvin

� Subscription/Notification style communication -Mantara

� Threads register interest in messages withsubscriptions - e.g.elvin_add_subscription(require(data) && name == "fred")

� Threads ‘broadcast’ messages as notifications - e.g.elvin_add_notification([data = 42, name = "fred"])

� If a thread is not subscribed it will not receivecorresponding messages

– p.6/16

Page 7: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Message Management

Each thread has a message buffer that contains receivedbut unprocessed messages

� Message <<- Address

� Message <<= Address

� message_choice (

Msg1 <<- Addr1 -> Goal1

;

Msg2 <<- Addr2 :: Guard -> Goal2

;

timeout(Time) ->> Goaln

)

– p.7/16

Page 8: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Agents

� Agents as processes� Agents as threads in one process� Typically an agent is made up of collection of threads

with the different threads taking on different roles withinthe agent - e.g.� thread for communication,� thread for ‘percepts’,� thread for calculating and evaluating intentions.

– p.8/16

Page 9: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Architecture

Environment

Controller

Visualization

Plane1

Plane2

Plane3

– p.9/16

Page 10: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Environment I

� Compute plane positions over time� Compute percepts for agents and send results to

agents� Manages ‘sleeping’ for agents: models decision

making time

– p.10/16

Page 11: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Environment II

env_loop :-

simulation_length(SimTime),

horizontal_separation_violation_distance(HSVD),

atcSetHS(HSVD),

global_state_set(time, 0),

repeat,

atcStepCT,

( gui(on) -> broadcast_env_info ; true ),

check_timeouts, % See if agent should be woken

call_percept_goals, % Inform agents about percepts

atcGetCT(CT),

global_state_set(time, CT),

CT > SimTime,!. % End after SimTime secs

– p.11/16

Page 12: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Controller Agent I

Main controller thread: scan, detect conflict, resolve conflict.Use weights to make choice of activity (probability)controller_loop :-

percepts_ready <<= _,

controller_ready ->> env,

repeat,

calculate_all_weights(WeightsRelation),

select_activity(WeightsRelation, ControllerTaskGoal),

call(ControllerTaskGoal),

fail.

– p.12/16

Page 13: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Controller Agent II

Controller percept thread: process plane information fromenvironmentpercepts :-

add_percept(controller_percepts, get_planes) ->> comms,

done_add_percept(controller_percepts, get_planes) <<= comms,

percepts_ready ->> controller,

percept_loop.

percept_loop :-

repeat,

planes_info(Time, PlanesInfo) <<= Environment,

thread_atomic_goal(update_plane_info(PlanesInfo)),

done ->> Environment,

fail.

– p.13/16

Page 14: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Plane Agents

In this model planes are very simple: respond to change offlight level messages from controller:plane_loop(Name, FP) :-

pilot_response_time(T1, T2),

repeat,

message_choice (

end_of_simulation <<- _ -> thread_exit

;

new_level(Level) <<- controller ->

height_changed ->> controller,

random(T1, T2, PRT),

agent_sleep_for(Name, PRT),

call_goal(new_level(Name, Level)) ->> comms,

log(Name - new_level_action(Level))

....

– p.14/16

Page 15: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Parameters etc

� The file data.ql contains all parameters, functions forcomputing weights, and switches for setting logging,GUI and stats.

� The behavior of the controller can be modified bychanging parameters and functions.

� Effectiveness of the controller can be determined bytaking a Monte Carlo approach: running a particularsimulation (fixing parameters) for a number of timesand collecting statistics for later analysis.

– p.15/16

Page 16: Modeling in ATC - ACCS · 2016. 8. 21. · thread_fork(Name, Goal) thread_sleep(Secs) thread_atomic_goal(Goal) thread_wait_on_goal(Goal) thread_exit(Name) { p.4/16. ICM InterAgent

Future

� Make controller more sophisticated.� Add more controllers; investigate hand-over issues� Flight plans� Free flight

– p.16/16