![Page 1: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/1.jpg)
IDK5151 kohtumine kaugõppijatega 26.04.2013
Prof Kuldar Taveter,
Tallinna Tehnikaülikool
![Page 2: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/2.jpg)
Hindamine
Analüüsimudelite kaitsmine: 10% Disainimudelite kaitsmine: 10% Kirjalik aruanne, umbes 2000 sõna koos
lisadega, joonistega, tabelitega ja lähtekoodi näidetega: 20%
Töö lõpukaitsmine: 10% Kahetunnine kirjalik eksam: 50%
![Page 3: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/3.jpg)
Ajakava• Esimene kohtumine 01.02.2013: Sissejuhatus
• 15.02.2013: Tähtaeg tiimide moodustamiseks ja teemade valikuks
• Teine kohtumine 12.04.2013: Analüüsimudelite kaitsmine
• Kolmas kohtumine 26.04.2013: Disainimudelite kaitsmine
• 08.05.2013: Tähtaeg miniprojekti esitamiseks
• Neljas kohtumine 10.05.2010: miniprojekti lõpukaitsmine
![Page 4: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/4.jpg)
Miniprojektid Nõudmised:
• Mudelid korralikult vormistatud seletuskirjaga (k.a. sissejuhatus)• Esitamise tähtaeg: 8. mai
Kaitsmine 10. mail kell 19.30-21.00:• Ettekanne igalt tiimilt umbes 10 minutit 2-4 slaidiga• Realisatsiooni demo• Küsimused tiimi liikmetele
Hindamine:• Lahenduse hajutatud iseloom• AOM-i vaatepunktide raamistiku 6 ülemise lahtri kaetus mudelitega• Mudelite põhjendused (miks on vaja üht või teist liiki mudeleid?)• Mudelite seostatus• Mudelite korrektsus• Realisatsioon
1
![Page 5: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/5.jpg)
Kirjandus Sterling, L. & Taveter, K. (2009). The art of agent-
oriented modeling. MIT Press. Wooldridge, M. (2009). Introduction to multi-agent
systems, 2nd Edition. Addison-Wesley. d'Inverno, M. & Luck, M. (2001). Understanding
agent systems. Springer-Verlag. Padgham, L. & Winikoff, M. (2004). Developing
intelligent agent systems: A practical guide. John Wiley and Sons.
Bellifemine, F., Caire, G, & Greenwood, D. (2005). Developing multi-agent systems with JADE. John Wiley & Sons.
Bordini, R. H., Hübner, J. F., & Wooldridge, M. (2007). Programming multi-agent systems in AgentSpeak using Jason. John Wiley & Sons.
![Page 6: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/6.jpg)
JADE (Java Agent DevelopmentEnvironment)
Distributed agent platform which can be splitamong several hosts
Java Application Programmer’s Interface. Graphical User Interface to manage several
agents from the same Remote ManagementAgent
Library of FIPA interaction protocols, such asContract Net
Available at http://jade.tilab.com/
![Page 7: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/7.jpg)
JADE Agent Platform
![Page 8: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/8.jpg)
Agents, Containers and Platforms
![Page 9: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/9.jpg)
AMS and DF AMS – Agent Management System
• Providing naming services
DF – Directory Facilitator
• Provides Yellow Pages service
![Page 10: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/10.jpg)
Creating JADE agent
import jade.core.Agent;import jade.core.AID;
public class PhysicianAgent extends Agent {
protected void setup() { // Printout a welcome message System.out.println("Hello! Physician-agent "+getAID().getName()+" is ready."); }}
![Page 11: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/11.jpg)
Running JADE agent
javac -classpath <JADE-classes> PhysicianAgent.java
java -classpath <JADE-classes> jade.Boot -gui physician1:PhysicianAgent
Classpath can/should be set beforehand.
![Page 12: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/12.jpg)
Passing arguments to an agent
import jade.core.Agent;import jade.core.AID;public class PhysicianAgent extends Agent {
private String specialty; protected void setup() { // Printout a welcome message System.out.println("Hello! Physician-agent "+getAID().getName()+" is ready.");
Object[] args = getArguments(); if (args != null && args.length > 0){
specialty = (String) args [0]; System.out.println("My area of specialisation is "+specialty);
} else { System.out.println("No specialty has been assigned."); doDelete();
} } protected void takeDown(){
System.out.println("Physician-agent "+getAID().getName()+" terminated"); } }
![Page 13: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/13.jpg)
Running JADE agent with arguments
javac PhysicianAgent.java
java jade.Boot -gui physician1:PhysicianAgent(Cardiologist)
![Page 14: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/14.jpg)
Terminating JADE agentimport jade.core.Agent;import jade.core.AID;public class PhysicianAgent extends Agent {
private String specialty; protected void setup() { // Printout a welcome message System.out.println("Hello! Physician-agent "+getAID().getName()+" is ready.");
Object[] args = getArguments(); if (args != null && args.length > 0){
specialty = (String) args [0]; System.out.println("My area of specialisation is "+specialty);
} else { System.out.println("No specialty has been assigned."); doDelete();
} } protected void takeDown(){
System.out.println("Physician-agent "+getAID().getName()+" terminated"); } }
![Page 15: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/15.jpg)
Agent life cycle
![Page 16: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/16.jpg)
Concurrent tasks
An agent must be able to carry out several concurrent tasks in response to different external events
Every JADE agent is composed of a single execution thread
Concurrent tasks are modelled and can be implemented as instances of jade.core.behaviours.Behaviour
![Page 17: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/17.jpg)
Agent thread
![Page 18: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/18.jpg)
Hierarchy of behaviours
![Page 19: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/19.jpg)
Defining JADE agentspackage DigitalPet;import jade.core.*;
public class Tamagotchi extends Agent {
// Put agent initializations hereprotected void setup() {
// Adding behavioursaddBehaviour(new MessageHandler (this));…
}
// If needed, put agent clean-up operations hereprotected void takeDown() {
System.out.println(“Tamagotchi “+getAID().getName()+” terminating.”);
…}
}
![Page 20: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/20.jpg)
Defining behaviourspackage DigitalPet;
import jade.core.*;
import jade.core.behaviours.*;
import jade.lang.acl.*;
public class MyOneShotBehaviour extends OneShotBehaviour {
public void action() {
// perform operation X
}
}
public class MyCyclicBehaviour extends CyclicBehaviour {
public void action() {
// perform operation Y
}
}
![Page 21: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/21.jpg)
Sending messagesACLMessage msg = new ACLMessage(ACLMessage.INFORM);msg.addReceiver(new AID(“tama1”, false);msg.setLanguage(“English”);msg.setOntology(“Weather-forecast-ontology”);msg.setContent(“Today it’s raining”);myAgent.send(msg);
// Message carrying a request for offerACLMessage cfp = new ACLMessage(ACLMessage.CFP);for (int i = 0; i < sellerAgents.lenght; ++i) {
cfp.addReceiver(sellerAgents[i]);}cfp.setContent(targetBookTitle);myAgent.send(cfp);
![Page 22: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/22.jpg)
Receiving messages
public void action() {ACLMessage msg = myAgent.receive();if (msg != null) {
// Message received. Process it...
}else {
block();}
}
![Page 23: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/23.jpg)
Setting classpath
Please include in the classpath the following library files:• …\jade\lib\jade.jar
• …\jade\lib\jadeTools.jar
• …\jade\lib\http.jar
• …\jade\lib\iiop.jar
Please include in the classpath the location(s) of your Java class files
![Page 24: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/24.jpg)
Compiling and running JADE agents
javac Tamagotchi.java Behaviours.java
…
java jade.Boot –gui -platform
java jade.Boot –container tama1:DigitalPet.Tamagotchi
![Page 25: IDK5151 kohtumine kaugõppijatega 26.04.2013 Prof Kuldar Taveter, Tallinna Tehnikaülikool](https://reader038.vdocuments.pub/reader038/viewer/2022102818/56649e575503460f94b4f062/html5/thumbnails/25.jpg)
Please consult API!
http://jade.tilab.com/doc/api/index.html