1 / 26

An Agent and Its Threads

An Agent and Its Threads. Initialize. Spawn N negotiation threads. inactive. active. communication thread. negotiation threads. execution thread. core thread. Communication Thread. Get message via socket. Message?. no. yes. Parse message. Message queue.

leon
Download Presentation

An Agent and Its Threads

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Agent and Its Threads Initialize Spawn N negotiation threads inactive active ... communication thread negotiation threads execution thread core thread

  2. Communication Thread Get message via socket Message? no yes Parse message Message queue Accesses by other threads of the agent Add to message queue ...

  3. Execution Thread Setup and Reset Accesses by core thread of the agent Job queue ... Get first job From queue job’s startTime< currentTime? no Sleep yes Apply Execution heuristics yes Remove Job Abandon? Sleep no from job queue Execute Apply Persistence heuristics no Executed? yes yes Wait for data to be uploaded Commited? no from job queue Remove job

  4. Execution Thread: Execution Heuristics Time Conflict If the job is not a tracking task and the expected stop time is later than the start of the next job plus a predefined relax_time, then Abandon = true. Negotiation Conflict If the job is not a tracking task and the agent is currently initiating a tracking coalition, then Abandon = true. Look-Ahead Conflict If the job is not a tracking task and the agent has a tracking task already planned for the near future, then Abandon = true.

  5. Execution Thread: Persistence Heuristics Persistent Commitment If the job is a tracking task and tracking is still viable, then Committed = true.

  6. Executed = true Executed = true Executed = true Executed = false Executed = true Executed = true Execution Thread: Execution Behavior SD1, SD2, SD3 Target Detected? Search and Detect C1, C2, C3 Target Detected? Calibrate Sensor I Success Do nothing M1, M2, M3 Task type? Target Detected? Measure Initial Target T1, T2, T3 Job confirmed? no yes Target Disappeared or Terminated as planned Track

  7. Core Thread Setup Check Messages Check Tasks Check Execution Check Coalition

  8. Core Thread: Setup Profile Manager Setup initializes the agent’s status and configures its neighbors sets up comm. channel with Radsim, creates a socket, allocates msg. queue, sets msg. observer, and activates receiver Comm Manager Task Manager has a lesser role now because the radar tasks are managed by the Execution Manager Think Manager spawns all negotiation threads and links data to each thread; CLIPS processes are forked and pre- defined templates and rules are loaded Negotiation Manager RTSS Manager sets up data stream access for Real-Time Scheduling Service (RTSS) interface and registers threads and agent process IDs CBR Manager loads two case bases, for initiating and responding cases of negotiation initializes the sensor that the agent controls, measures background noise for each sector, turns on the radar observer, adds all neighboring sensors to its radar model Radar Manager Execution Manager sets up the execution thread and executes tasks off the job queue Coalition Manager initializes the coalition vector

  9. Core Thread: Check Messages Access message queue no msg. for prof? Active Negotiation? yes no yes Parse message Discard message message type Check messages completed An acknowledgment A negotiation request Respond to ack Respond to request Check messages completed

  10. Core Thread: Check Messages: Respond to Ack ... acknowledgment Ack type? Discard Confirm Discard tracking task Confirm tracking task completed Job queue

  11. Core Thread: Check Messages: Respond to Request request no CPU? already doing? yes yes no Feasibility Study Agree to request Feasible & neg. idle? no Decline to negotiate yes Modify request? no yes Retrieve best case via CBR Modify Request Upload data Activate negotiation threads thread activated? no yes completed

  12. Core Thread: Check Tasks (Negotiation Tasks Only) ... Task queue Negotiation task Responding & failure Initiating & success Status? Initiating & failure Responding & success Download & Update Data Download & Update Data Download & Update Data Download & Update Data Store Case Store Case Store Case Store Case Update Coalition Update Coalition Transition Task Remove Task Remove Task Remove Task Clear Negotiation Thread CheckTasks Completed

  13. Core Thread: Check Tasks: Update Coalition If the negotiation is successful, the update involves modifying the coalition information to reflect the success. If the negotiation is not successful, the update removes the coalition member (the negotiation partner) from the coalition.

  14. Core Thread: Check Tasks: Transition Task ... New task CPU? yes no Reorganize Thread Allocation Configure Tracking Task Job queue Insert Task to Job Queue Clean up Job Queue Remove Task

  15. Core Thread: Check Execution Execution thread’s current status A job is completed? no CheckExecution Completed yes Job type? Calibrate Sensor Or Search and Detect Tracking Measure Initial Target Idle Clear Execution Thread Clear Execution Thread Finish Measure Init. Target Clear Execution Thread Target detected? Handle Target CheckExecution Completed

  16. ... Core Thread: Handle Target Configure Measuring Task Job queue Insert Task to Job Queue success? yes Clean up Job Queue Handle target completed

  17. Core Thread: Finish Measure Initial Target Execution thread’s current status Target detected? no completed yes Download Target Information Clear Execution Thread Update target w/ Radar Manager Compute sensor-sector list Determine sample size Analyze feasible partners Initiate negotiations completed

  18. ... Core Thread: Initiate Negotiations Sort feasible partners (utility) Retrieve best case via CBR Neg. thread idle? completed no yes Create negotiation task Initialize coalition For all partners Done Task queue Add task to task queue Upload data Update coalition Activate negotiation thread yes thread activated? no

  19. Core Thread: Check Coalition ... Coalition’s current status decided? no CheckCoalition Completed yes coalition fulfilled? no yes Send to all agreed coalition members Acknowledge to Confirm Coalition Acknowledge to Discard Coalition Send to all agreed coalition members Configure Tracking Task Job queue Discard Coalition Insert it to Job Queue Clean up Job Queue Confirm the Task Confirm Coalition

  20. Negotiation Thread Setup and Reset Wait to be activated Download data Responding to a negotiation request Initiating a negotiation request Mode? Initiating Behavior Responding Behavior Update data Wait for data to be uploaded

  21. Negotiation Thread: Initiating Behavior Compose first initiating message Done = no yes Negotiation completed Done? no Send Message Wait for response React & compose message no response? yes Check Coalition yes abort? no Parse response React & Compose Message expired time? still okay

  22. Negotiation Thread: Initiating Behavior: Check Coalition If the coalition has gathered enough help for CPU reallocation, then Abort = true. If the tracking coalition has been satisfied, then Abort = true. If the tracking coalition is no longer possible, then Abort = true.

  23. Negotiation Thread: Initiating Behavior: React & Compose Message Response message type? modify time no go out of time stop more info counter Check Coalition Acceptability Check Coalition Acceptability accept? no agree no Compose More Info accept? yes Failure Failure yes null? Update Coalition Update Coalition Initiate Success yes no Info_Null Info

  24. Negotiation Thread: Responding Behavior Compose first responding message Done = no yes Reset CLIPS Done? no Send Message Negotiation completed Wait for response React & compose message no response? yes Parse response React & Compose Message expired time? still okay

  25. Negotiation Thread: Responding Behavior: React & Compose Message Response message type? info abort out of time stop CLIPS: Rule-Based Reasoning info null agree Compute evidence support yes CPU? CPU? no Success yes no Counter Failure > persuas. thresh? React CPU Stop yes no Agree More Info

  26. Negotiation Thread: Responding Behavior: React CPU If the current CPU willing to give up is greater than or equal to the desired CPU (by the initiator), and the desired CPU is smaller than or equal to the maximum CPU willing to give up, then Agree. If the current CPU willing to give up is greater than the maximum CPU willing to give up, then Counter with maximum CPU willing to give up. If time allocated for the negotiation is running out, then Counter. If the current CPU willing to give up is grater than the maximum CPU willing to give up, Counter with the latter value. Otherwise, Counter with the former.

More Related