frederick99

task3.ispl

Apr 22nd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 8.29 KB | None | 0 0
  1.  
  2. ---Environment agent
  3. Agent Environment
  4.  
  5.     Obsvars:
  6.         reached: BOOLEAN;
  7.     k: 2..3;
  8.     END Obsvars
  9.  
  10.     Vars:
  11.         state: {idle, detected, initiated, completed};
  12.     END Vars
  13.  
  14.     Actions = {NONE, task_detected_, task_initiated_, task_completed_};
  15.  
  16.     Protocol:
  17.         state = idle: {task_detected_};
  18.         state = detected: {task_initiated_};
  19.         state = completed: {task_completed_};
  20.     END Protocol
  21.  
  22.     Evolution:
  23.         reached = TRUE IF
  24.             ((k = 2) AND
  25.                 ((Robot1.Action=received_confirm) OR (Robot2.Action=received_confirm) OR (Robot3.Action=received_confirm))) OR
  26.             ((k = 3) AND
  27.                 ((Robot1.Action=received_confirm) AND (Robot2.Action=received_confirm)) OR
  28.         ((Robot1.Action=received_confirm) AND (Robot3.Action=received_confirm)) OR
  29.         ((Robot2.Action=received_confirm) AND (Robot3.Action=received_confirm)));
  30.  
  31.         state = detected IF ((state = idle) AND ((Robot1.Action = task_detected) OR (Robot2.Action = task_detected) OR (Robot3.Action = task_detected)))
  32.             AND (Action=task_detected_);
  33.  
  34.         state = initiated IF (state = detected) AND (reached=TRUE) AND (Action=task_initiated_);
  35.  
  36.         state = completed IF (Action=task_completed_) AND
  37.       (((k = 2) AND (
  38.         ((Robot1.Action=task_completed) AND (Robot2.Action=task_completed)) OR
  39.         ((Robot1.Action=task_completed) AND (Robot3.Action=task_completed)) OR
  40.         ((Robot2.Action=task_completed) AND (Robot3.Action=task_completed))
  41.       )) OR ((k = 3) AND
  42.         ((Robot1.Action=task_completed) AND (Robot2.Action=task_completed) AND (Robot3.Action=task_completed))
  43.       ));
  44.     END Evolution  
  45. END Agent
  46.  
  47.  
  48. ---Robot1
  49. Agent Robot1
  50.  
  51.     Vars:
  52.         state: {idle, busy, ready, promised};
  53.     END Vars
  54.  
  55.     Actions = {task_detected, send_confirm, send_request, send_willing, received_request, received_willing, received_engaged, received_confirm, received_not_required, task_completed};
  56.  
  57.     Protocol:
  58.         state = idle: {task_detected, received_request};
  59.         state = ready: {send_request, send_confirm, received_willing, received_engaged};
  60.         state = busy: {task_completed};
  61.         state = promised: {received_confirm, received_not_required, send_willing};
  62.     END Protocol
  63.  
  64.     Evolution:
  65.         state = idle IF ((state = idle) AND (Action = task_detected) AND ((Robot2.Action = task_detected) OR (Robot3.Action = task_detected))) OR
  66.                 ((state = busy) AND (Action = task_completed) AND (
  67.             ((Environment.k = 2) AND ((Robot2.Action = task_completed) OR (Robot3.Action = task_completed))) OR
  68.             ((Environment.k = 3) AND ((Robot2.Action = task_completed) AND (Robot3.Action = task_completed))))) OR
  69.                 ((state= promised) AND (Action=received_not_required));
  70.        
  71.         state = ready IF ((state = idle) AND (Action = task_detected) AND (
  72.             ((Environment.k = 2) AND ((Robot2.Action = received_request) OR (Robot3.Action = received_request))) OR
  73.             ((Environment.k = 3) AND ((Robot2.Action = received_request) AND (Robot3.Action = received_request))))) OR
  74.                 ((state=ready) AND ((Action = received_willing) OR (Action = received_engaged)));
  75.          
  76.         state = busy IF ((state = ready) AND (Action = send_confirm)) OR
  77.                 ((state = promised) AND (Action=received_confirm));
  78.        
  79.         state = promised IF ((state = idle) AND (Action=received_request) AND (Robot2.Action=send_request)) OR
  80.                ((state = promised) AND (Action=send_willing) AND (Robot2.Action=received_willing)) OR
  81.          ((state = idle) AND (Action=received_request) AND (Robot3.Action=send_request)) OR
  82.                ((state = promised) AND (Action=send_willing) AND (Robot3.Action=received_willing));              
  83.    END Evolution
  84. END Agent
  85.  
  86.  
  87. ---Robot2
  88. Agent Robot2
  89.  
  90.     Vars:
  91.         state: {idle, busy, ready, promised};
  92.     END Vars
  93.  
  94.     Actions = {task_detected, send_confirm, send_request, send_willing, received_request, received_willing, received_engaged, received_confirm, received_not_required, task_completed};
  95.  
  96.     Protocol:
  97.         state = idle: {task_detected, received_request};
  98.         state = ready: {send_request, send_confirm, received_willing, received_engaged};
  99.         state = busy: {task_completed};
  100.         state = promised: {received_confirm, received_not_required, send_willing};
  101.     END Protocol
  102.  
  103.     Evolution:
  104.         state = idle IF ((state = idle) AND (Action = task_detected) AND ((Robot1.Action = task_detected) OR (Robot3.Action = task_detected))) OR
  105.                 ((state = busy) AND (Action = task_completed) AND (
  106.             ((Environment.k = 2) AND ((Robot1.Action = task_completed) OR (Robot3.Action = task_completed))) OR
  107.             ((Environment.k = 3) AND ((Robot1.Action = task_completed) AND (Robot3.Action = task_completed))))) OR
  108.                 ((state= promised) AND (Action=received_not_required));
  109.        
  110.         state = ready IF ((state = idle) AND (Action = task_detected) AND (
  111.             ((Environment.k = 2) AND ((Robot1.Action = received_request) OR (Robot3.Action = received_request))) OR
  112.             ((Environment.k = 3) AND ((Robot1.Action = received_request) AND (Robot3.Action = received_request))))) OR
  113.                 ((state=ready) AND ((Action = received_willing) OR (Action = received_engaged)));
  114.          
  115.         state = busy IF ((state = ready) AND (Action = send_confirm)) OR
  116.                 ((state = promised) AND (Action=received_confirm));
  117.        
  118.         state = promised IF ((state = idle) AND (Action=received_request) AND (Robot1.Action=send_request)) OR
  119.                ((state = promised) AND (Action=send_willing) AND (Robot1.Action=received_willing)) OR
  120.          ((state = idle) AND (Action=received_request) AND (Robot3.Action=send_request)) OR
  121.                ((state = promised) AND (Action=send_willing) AND (Robot3.Action=received_willing));              
  122.    END Evolution
  123. END Agent
  124.  
  125.  
  126. ---Robot3
  127. Agent Robot3
  128.  
  129.     Vars:
  130.         state: {idle, busy, ready, promised};
  131.     END Vars
  132.  
  133.     Actions = {task_detected, send_confirm, send_request, send_willing, received_request, received_willing, received_engaged, received_confirm, received_not_required, task_completed};
  134.  
  135.     Protocol:
  136.         state = idle: {task_detected, received_request};
  137.         state = ready: {send_request, send_confirm, received_willing, received_engaged};
  138.         state = busy: {task_completed};
  139.         state = promised: {received_confirm, received_not_required, send_willing};
  140.     END Protocol
  141.  
  142.     Evolution:
  143.         state = idle IF ((state = idle) AND (Action = task_detected) AND ((Robot1.Action = task_detected) OR (Robot2.Action = task_detected))) OR
  144.                 ((state = busy) AND (Action = task_completed) AND (
  145.             ((Environment.k = 2) AND ((Robot1.Action = task_completed) OR (Robot2.Action = task_completed))) OR
  146.             ((Environment.k = 3) AND ((Robot1.Action = task_completed) AND (Robot2.Action = task_completed))))) OR
  147.                 ((state= promised) AND (Action=received_not_required));
  148.        
  149.         state = ready IF ((state = idle) AND (Action = task_detected) AND (
  150.             ((Environment.k = 2) AND ((Robot1.Action = received_request) OR (Robot2.Action = received_request))) OR
  151.             ((Environment.k = 3) AND ((Robot1.Action = received_request) AND (Robot2.Action = received_request))))) OR
  152.                 ((state=ready) AND ((Action = received_willing) OR (Action = received_engaged)));
  153.          
  154.         state = busy IF ((state = ready) AND (Action = send_confirm)) OR
  155.                 ((state = promised) AND (Action=received_confirm));
  156.        
  157.         state = promised IF ((state = idle) AND (Action=received_request) AND (Robot1.Action=send_request)) OR
  158.                ((state = promised) AND (Action=send_willing) AND (Robot1.Action=received_willing)) OR
  159.          ((state = idle) AND (Action=received_request) AND (Robot2.Action=send_request)) OR
  160.                ((state = promised) AND (Action=send_willing) AND (Robot2.Action=received_willing));              
  161.    END Evolution
  162. END Agent
  163.  
  164.  
  165. Evaluation
  166.       ready_var IF ( (Robot1.state=ready) OR (Robot2.state=ready) OR (Robot3.state=ready) );
  167.  
  168.         bad_condition IF (
  169.                  ((Robot1.state=promised) AND (Robot2.state=idle) AND (Robot3.state=idle)) OR
  170.                  ((Robot1.state=idle) AND (Robot2.state=promised) AND (Robot3.state=idle)) OR
  171.                  ((Robot1.state=idle) AND (Robot2.state=idle) AND (Robot3.state=promised)));
  172. END Evaluation
  173.  
  174.  
  175. InitStates
  176.     (Robot1.state = idle) AND
  177.     (Robot2.state = idle) AND
  178.     (Robot3.state = idle) AND
  179.     (Environment.reached=FALSE) AND (Environment.state=idle);
  180. END InitStates
  181.  
  182.  
  183. Fairness
  184.   ready_var;
  185. END Fairness
  186.  
  187.  
  188. Formulae
  189.     AG(!bad_condition);
  190. END Formulae
Add Comment
Please, Sign In to add comment