23.08.2015 Views

Here - Agents Lab - University of Nottingham

Here - Agents Lab - University of Nottingham

Here - Agents Lab - University of Nottingham

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

1 org - model SmartHome {23 roles :4 HomeAdmin , Thermostat , ...;56 interfaces :7 Conditioner , Thermometer , Log , ...;89 workspace mainRoom {10 log : Log ;11 majordomo : HomeAdmin ;12 ...13 }1415 workspace bedroom {16 therm : Thermometer ;17 cond : Conditioner ;18 thermostat : Thermostat ;19 ...20 }21 }1 org ACMESmartHome implements SmartHome {23 workspace mainRoom {4 log = Logger ();5 majordomo = ACMEHomeAdmin ();6 }78 workspace bedroom {9 therm = ACMEThermometer ();10 cond = ACMEConditioner ();11 thermostat = Thermostat12 ( conditioner : cond13 thermometer : therm );14 ...15 }1617 }Fig. 5. Example <strong>of</strong> the definition <strong>of</strong> an organization model in simpAL (on the left) andthe a main organization file implementing the model (on the right).Finally, the explicit declaration <strong>of</strong> observable properties (in interfaces) and (hidden)state variables in artifact templates – the latter can be declared also localvariable in operations – allow for checking errors in the implementation <strong>of</strong> operationsabout the use <strong>of</strong> unknown observable properties/variables or about theassignment <strong>of</strong> values with a wrong type.3.4 Typing the Overall Program StructureIn simpAL we use the notion <strong>of</strong> organization to define the structure <strong>of</strong> the overallmulti-agent program, and we introduce then the type <strong>of</strong> an organization calledorganization model to explicitly declare the set <strong>of</strong> roles and interfaces which areused inside any organization <strong>of</strong> that type, and the set <strong>of</strong> workspaces that areavailable in any organization <strong>of</strong> that type. The declaration <strong>of</strong> the workspace caninclude then explicit declaration <strong>of</strong> the identifier (literals) <strong>of</strong> instances <strong>of</strong> artifactsand agents – along with their types – that are known to be available in thatworkspace 5 . Such identifiers are like global references that can be then referredin any agent script (so at to identify “well-known” agents to communicate with orartifacts to use) which explicitly declares to play a role R inside that organizationmodel.As a simple example, Fig. 5 shows the definition <strong>of</strong> the SmartHome, with amainRoom workspace hosting an artifact log <strong>of</strong> type Log and an agent majordomo<strong>of</strong> type HomeAdmin. Given this org model definition, then it is possible e.g. inthe KeepTemperature plan <strong>of</strong> the ACMEThermostat script to refer directly to theartifact log @ mainRoom (in spite <strong>of</strong> its actual implementation).5 In general, a workspace can contain at runtime also agents/artifacts not declared inthe model: their types, however, must be among the types described in the model.145

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!