SMAS 2.0bA Primer |
5. LISP Code for the Examples (Scenarios)
Scenarios include specifications of the steps to be executed at different logical times. Actions can be requested directly from specific agents, or channeled to agents through the use of a special proxy agent.
SC-1 is defined as follows:
(defscenario SC-1 (1 MUL-2 :request MULTIPLY (25 25) (4 FACTORIAL :request DUMB-FACTORIAL (4)))
SC-1 includes two steps:
The simulation will halt when the internal scheduler detects that there are no more pending tasks to execute.
In a simple usage of the simulator all delays and time to execute skills are given by default values.
SC-2 is defined as follows:.
(defscenario SC-2 (1 PROXY :request SEND-REQUEST ((FACTORIAL DUMB-FACTORIAL (5)))))
This step instructs the proxy agent to send a request to the FACTORIAL agent to compute 5 factorial using a specific DUMB-FACTORIAL skill.
(defscenario SC-3 (1 FACTORIAL :request FAST-FACTORIAL (4))) (defscenario SC-4 (1 FACTORIAL :request FAST-FACTORIAL (5))) (defscenario SC-5 (1 FACTORIAL :request FAST-FACTORIAL (7)))
SC-6 and SC-7 illustrate the use of the proxy agent.
(defscenario SC-6 (1 PROXY :request SEND-REQUEST ((FACTORIAL DUMB-FACTORIAL (5))))) (defscenario SC-7 (1 PROXY :request SEND-REQUEST ((FACTORIAL FAST-FACTORIAL (5)))))
SC-8 illustrate the use of an unknown skill (BERZECK) together with a timeout option.
(defscenario SC-8 (1 PROXY :request SEND-REQUEST ((FACTORIAL BERZECK (5) :timeout 4))))
The skill selection mechanism is simple and somewhat resembles the use of a method in an object-oriented environment. It could be easily modified to include more sophisticated procedures.
Copyrignt Jean-Paul Barthès@UTC, 1998 Last update, Jan 99