Bonjour,
voici un article sur Les communications des agents JADE
http://djug.developpez.com/java/jade/communication/
vos remarques sont les bienvenues.
Bonjour,
voici un article sur Les communications des agents JADE
http://djug.developpez.com/java/jade/communication/
vos remarques sont les bienvenues.
Bonjour,
j'ai essayer de faire marcher AgentA et AgentB, mais ça ne marche pas.. apparemment, AgentA se block et n'envoie jamais rien à AgentB...
Une idée ?
je viens de retester l'exemple il fonctionne très bien.
comment tu lances tes agents ? quelle est la commande utilisé
dans mon cas j'ai utilisé les deux commandes suivantes (pour lancer chaque agent dans un nouveau Container):
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 java jade.Boot -container AgentA:AgentA java jade.Boot -container AgentB:AgentB
voici le résultat:
dans la fenêtre de l'agent AgentA
et dans la fenêtre de l'agent AgentB:9 sept. 2009 20:19:54 jade.core.Runtime beginContainer
INFO: ----------------------------------
This is JADE 3.5 - revision 5988 of 2007/06/21 11:02:30
downloaded in Open Source, under LGPL restrictions,
at http://jade.tilab.com/
----------------------------------------
9 sept. 2009 20:19:54 jade.core.BaseService init
INFO: Service jade.core.management.AgentManagement initialized
9 sept. 2009 20:19:54 jade.core.BaseService init
INFO: Service jade.core.messaging.Messaging initialized
9 sept. 2009 20:19:54 jade.core.BaseService init
INFO: Service jade.core.mobility.AgentMobility initialized
9 sept. 2009 20:19:54 jade.core.BaseService init
INFO: Service jade.core.event.Notification initialized
9 sept. 2009 20:19:54 jade.core.messaging.MessagingService clearCachedSlice
INFO: Clearing cache
9 sept. 2009 20:19:54 jade.core.AgentContainerImpl joinPlatform
INFO: --------------------------------------
Agent container Container-3@workstation is ready.
--------------------------------------------
---------------------------------------
----------------agent A----------------
---------------------------------------
en attente de l agent B
envoi de la valeur 9
en attente de l agent B
envoi de la valeur 9
en attente de l agent B
envoi de la valeur 8
en attente de l agent B
envoi de la valeur 1
en attente de l agent B
envoi de la valeur 7
en attente de l agent B
envoi de la valeur 7
en attente de l agent B
envoi de la valeur 9
en attente de l agent B
envoi de la valeur 4
en attente de l agent B
envoi de la valeur 3
arret de l'agent
9 sept. 2009 20:19:54 jade.core.Runtime beginContainer
INFO: ----------------------------------
This is JADE 3.5 - revision 5988 of 2007/06/21 11:02:30
downloaded in Open Source, under LGPL restrictions,
at http://jade.tilab.com/
----------------------------------------
9 sept. 2009 20:19:54 jade.core.BaseService init
INFO: Service jade.core.management.AgentManagement initialized
9 sept. 2009 20:19:54 jade.core.BaseService init
INFO: Service jade.core.messaging.Messaging initialized
9 sept. 2009 20:19:54 jade.core.BaseService init
INFO: Service jade.core.mobility.AgentMobility initialized
9 sept. 2009 20:19:54 jade.core.BaseService init
INFO: Service jade.core.event.Notification initialized
9 sept. 2009 20:19:54 jade.core.messaging.MessagingService clearCachedSlice
INFO: Clearing cache
9 sept. 2009 20:19:54 jade.core.AgentContainerImpl joinPlatform
INFO: --------------------------------------
Agent container Container-3@workstation is ready.
--------------------------------------------
---------------------------------------
----------------agent A----------------
---------------------------------------
en attente de l agent B
envoi de la valeur 9
en attente de l agent B
envoi de la valeur 9
en attente de l agent B
envoi de la valeur 8
en attente de l agent B
envoi de la valeur 1
en attente de l agent B
envoi de la valeur 7
en attente de l agent B
envoi de la valeur 7
en attente de l agent B
envoi de la valeur 9
en attente de l agent B
envoi de la valeur 4
en attente de l agent B
envoi de la valeur 3
arret de l'agent
lances les agents avec ces deux commandes et dis moi ce que tu trouve comme résultats
Bonjour,
j'utilise ce que tu donne dans le première article :
Ducoup je lance chaque agent a la suite, en remplacent les paramètres dans les configurations..Et dans l'onglet arguments : tapez le code suivant :
-gui jade.Boot NomDuL'agent:LeNomDuPackage.LeNomDeLaClasse
Dans notre exemple on tape le code suivant :
-gui jade.boot smith:firstAgent.HelloWorldAgent
puis cliquez sur apply pour ne pas refaire cette configuration plusieurs fois dans le même projet
-gui jade.boot AgentA:firstAgent.AgentA
puis
-gui jade.boot AgentB:firstAgent.AgentB
pour le deuxième.
Mais ça ne marche pas..
quand on lance un agent à partir de Eclipse de la manière mentionnée dans le 1er tuto , alors la plateforme JADE sera lancer avant le lancement de l'agent,
dans notre cas (lancement de l'agent AgentA) on va voir comme résultat:
puis l'agent s'arrête et attend l'agent AgentB---------------------------------------
----------------agent A----------------
---------------------------------------
en attente de l agent B
alors si on refait la même procédure pour lancer le 2em agent alors un message d'erreur apparait:
parce que on ne peut pas lancer deux plateforme JADE sur la même machine.GRAVE: Some problem occurred while joining agent platform.
jade.core.ProfileException: Can't get a proxy to the Platform Manager [nested jade.core.IMTPException: The Service Manager was already bound in the RMI Registry [nested java.rmi.AlreadyBoundException: ServiceManager]]
at jade.core.ProfileImpl.createPlatformManager(Unknown Source)
at jade.core.ProfileImpl.getPlatformManager(Unknown Source)
at jade.core.ProfileImpl.getServiceManager(Unknown Source)
at jade.core.AgentContainerImpl.init(Unknown Source)
at jade.core.AgentContainerImpl.joinPlatform(Unknown Source)
at jade.core.Runtime.createMainContainer(Unknown Source)
at jade.Boot.<init>(Unknown Source)
at jade.Boot.main(Unknown Source)
Nested Exception:
jade.core.IMTPException: The Service Manager was already bound in the RMI Registry [nested java.rmi.AlreadyBoundException: ServiceManager]
at jade.imtp.rmi.RMIIMTPManager.exportPlatformManager(Unknown Source)
at jade.core.ProfileImpl.createPlatformManager(Unknown Source)
at jade.core.ProfileImpl.getPlatformManager(Unknown Source)
at jade.core.ProfileImpl.getServiceManager(Unknown Source)
at jade.core.AgentContainerImpl.init(Unknown Source)
at jade.core.AgentContainerImpl.joinPlatform(Unknown Source)
at jade.core.Runtime.createMainContainer(Unknown Source)
at jade.Boot.<init>(Unknown Source)
at jade.Boot.main(Unknown Source)
Nested Exception:
java.rmi.AlreadyBoundException: ServiceManager
at sun.rmi.registry.RegistryImpl.bind(Unknown Source)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at java.rmi.Naming.bind(Unknown Source)
at jade.imtp.rmi.RMIIMTPManager.exportPlatformManager(Unknown Source)
at jade.core.ProfileImpl.createPlatformManager(Unknown Source)
at jade.core.ProfileImpl.getPlatformManager(Unknown Source)
at jade.core.ProfileImpl.getServiceManager(Unknown Source)
at jade.core.AgentContainerImpl.init(Unknown Source)
at jade.core.AgentContainerImpl.joinPlatform(Unknown Source)
at jade.core.Runtime.createMainContainer(Unknown Source)
at jade.Boot.<init>(Unknown Source)
at jade.Boot.main(Unknown Source)
9 sept. 2009 23:10:50 jade.core.Runtime$1 run
INFO: JADE is closing down now.
alors pour lancer le 2e agent nous avons les deux choix suivants:
1. lancer l'agent AgentB à partir de l'interface graphique de la plateforme:
clique droit sur Main-Container >Start new agent > introduire "AgentB" (sans les " )dans la zone du nom de l'agent et de sa classe.
dans ce cas la, il faut que la classe de l'agent soit dans un dossier dont le chemin fait partie de la variable d'environnement classpath
2. lancer l'agent AgentB par la ligne de commande de la manière suivante:
Code : Sélectionner tout - Visualiser dans une fenêtre à part java jade.Boot -container AgentB:AgentB
Ok, merci beaucoup !
Les articles sont très bien, j'espère qu'il y en aura d'autre.
Sinon pour le dernière article, avec les deux agent, pour les lancer proprement dans éclipse on peut faire un agent "Monde" ou AgentZ par exemple et lancer les deux agent AgentA et AgentB par cette agent :
Qu'en pense tu ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 AgentA = container.createNewAgent("AgentA", "MyfirstAgent.AgentA", null); AgentA.start(); AgentB = container.createNewAgent("AgentB", "MyfirstAgent.AgentB", null); AgentB.start();
voici le code d'un agent Lanceur.java" qui va lancer les deux premiers agents l'un après l'autre:
Code java : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 import jade.core.Agent; import jade.core.Runtime; import jade.core.Profile; import jade.core.ProfileImpl; import jade.wrapper.*; public class AgLAg extends Agent { protected void setup(){ System.out.println("je m appel "+ getLocalName()); Runtime rt = Runtime.instance(); Profile p = new ProfileImpl(); ContainerController cc = rt.createAgentContainer(p); AgentController AgentFils; AgentController AgentFils2; System.out.println("l'agent "+ getLocalName()+ " va lancer les deux agents AgentA et AgentB "); try { AgentFils = cc.createNewAgent("AgentA","AgentA",null); AgentFils.start(); AgentFils2 = cc.createNewAgent("AgnetB","AgentB",null); AgentFils2.start(); } catch (StaleProxyException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Parfait
Merci !
bonjour;
alors , j"essaye de faire integré une inerface graphique avec un agent,
mé je ne sé pa comment attacher mon interface avec cette agent; j'attend votre aide les amis , pliiiiiiiiiiiiiz
tu trouvera un exemple sur l'utilisation d'un GUI avec JADE dans la section exemple du JADE
JADE-examples-3.x\jade\src\examples\bookTrading
Bonjour,
je suis nouveau avec la plateforme Jade j'essaie d'exécuter les 2 agents (A et B) en utilisant ton lanceur mais je n'arrive pas à le faire ça m'affiche des erreurs. Svp pouvez-vous m'expliquer comment on l'exécute?
voici ce qui affiché:
Code java : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 5 févr. 2010 20:48:32 jade.core.Runtime beginContainer INFO: ---------------------------------- This is JADE 3.7 - revision 6154 of 2009/07/01 17:34:15 downloaded in Open Source, under LGPL restrictions, at http://jade.tilab.com/ ---------------------------------------- 5 févr. 2010 20:48:34 jade.core.AgentContainerImpl joinPlatform GRAVE: Some problem occurred while joining agent platform. jade.core.ProfileException: Can't get a proxy to the Platform Manager [nested jade.core.IMTPException: The Service Manager was already bound in the RMI Registry [nested java.rmi.AlreadyBoundException: ServiceManager]] at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:574) at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:487) at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:501) at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:342) at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:478) at jade.core.Runtime.createMainContainer(Runtime.java:148) at jade.Boot.<init>(Boot.java:130) at jade.Boot.main(Boot.java:70) Nested Exception: jade.core.IMTPException: The Service Manager was already bound in the RMI Registry [nested java.rmi.AlreadyBoundException: ServiceManager] at jade.imtp.rmi.RMIIMTPManager.exportPlatformManager(RMIIMTPManager.java:276) at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:563) at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:487) at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:501) at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:342) at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:478) at jade.core.Runtime.createMainContainer(Runtime.java:148) at jade.Boot.<init>(Boot.java:130) at jade.Boot.main(Boot.java:70) Nested Exception: java.rmi.AlreadyBoundException: ServiceManager at sun.rmi.registry.RegistryImpl.bind(Unknown Source) at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source) at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source) at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source) at sun.rmi.transport.Transport$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Unknown Source) at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source) at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source) at sun.rmi.server.UnicastRef.invoke(Unknown Source) at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source) at java.rmi.Naming.bind(Unknown Source) at jade.imtp.rmi.RMIIMTPManager.exportPlatformManager(RMIIMTPManager.java:224) at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:563) at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:487) at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:501) at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:342) at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:478) at jade.core.Runtime.createMainContainer(Runtime.java:148) at jade.Boot.<init>(Boot.java:130) at jade.Boot.main(Boot.java:70) 5 févr. 2010 20:48:34 jade.core.Runtime$1 run INFO: JADE is closing down now.
peux-tu indiquer comment tu lances chaque agents (l'ordre d'exécution, les commandes utilisées)?
Bonsoir tous le monde,
je suis un débutant avec les agents mobile, j'ai essayer ce tutoriel (http://djug.developpez.com/java/jade/creation-agent/) qui explique comment crée votre premier agent mobile.
j'ai fais tous ce qu'il dit mais il m'affiche pas le bon résultat, voilà ce qu'il m'affiche :
au lieu de
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63 10 févr. 2010 19:38:46 jade.core.Runtime beginContainer INFO: ---------------------------------- This is JADE 3.7 - revision 6154 of 2009/07/01 17:34:15 downloaded in Open Source, under LGPL restrictions, at http://jade.tilab.com/ ---------------------------------------- 10 févr. 2010 19:38:47 jade.core.AgentContainerImpl joinPlatform GRAVE: Some problem occurred while joining agent platform. jade.core.ProfileException: Can't get a proxy to the Platform Manager [nested jade.core.IMTPException: Communication failure while starting JADE Runtime System. Check if the RMIRegistry CLASSPATH includes the RMI Stub classes of JADE. [nested java.rmi.server.ExportException: Port already in use: 1099; nested exception is: java.net.BindException: Address already in use: JVM_Bind]] at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:574) at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:487) at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:501) at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:342) at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:478) at jade.core.Runtime.createMainContainer(Runtime.java:148) at jade.Boot.<init>(Boot.java:130) at jade.Boot.main(Boot.java:70) Nested Exception: jade.core.IMTPException: Communication failure while starting JADE Runtime System. Check if the RMIRegistry CLASSPATH includes the RMI Stub classes of JADE. [nested java.rmi.server.ExportException: Port already in use: 1099; nested exception is: java.net.BindException: Address already in use: JVM_Bind] at jade.imtp.rmi.RMIIMTPManager.exportPlatformManager(RMIIMTPManager.java:273) at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:563) at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:487) at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:501) at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:342) at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:478) at jade.core.Runtime.createMainContainer(Runtime.java:148) at jade.Boot.<init>(Boot.java:130) at jade.Boot.main(Boot.java:70) Nested Exception: java.rmi.server.ExportException: Port already in use: 1099; nested exception is: java.net.BindException: Address already in use: JVM_Bind at sun.rmi.transport.tcp.TCPTransport.listen(Unknown Source) at sun.rmi.transport.tcp.TCPTransport.exportObject(Unknown Source) at sun.rmi.transport.tcp.TCPEndpoint.exportObject(Unknown Source) at sun.rmi.transport.LiveRef.exportObject(Unknown Source) at sun.rmi.server.UnicastServerRef.exportObject(Unknown Source) at sun.rmi.registry.RegistryImpl.setup(Unknown Source) at sun.rmi.registry.RegistryImpl.<init>(Unknown Source) at java.rmi.registry.LocateRegistry.createRegistry(Unknown Source) at jade.imtp.rmi.RMIIMTPManager.getRmiRegistry(RMIIMTPManager.java:209) at jade.imtp.rmi.RMIIMTPManager.exportPlatformManager(RMIIMTPManager.java:223) at jade.core.ProfileImpl.createPlatformManager(ProfileImpl.java:563) at jade.core.ProfileImpl.getPlatformManager(ProfileImpl.java:487) at jade.core.ProfileImpl.getServiceManager(ProfileImpl.java:501) at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:342) at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:478) at jade.core.Runtime.createMainContainer(Runtime.java:148) at jade.Boot.<init>(Boot.java:130) at jade.Boot.main(Boot.java:70) Caused by: java.net.BindException: Address already in use: JVM_Bind at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(Unknown Source) at java.net.ServerSocket.bind(Unknown Source) at java.net.ServerSocket.<init>(Unknown Source) at java.net.ServerSocket.<init>(Unknown Source) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(Unknown Source) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(Unknown Source) at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(Unknown Source) ... 18 more 10 févr. 2010 19:38:47 jade.core.Runtime$1 run INFO: JADE is closing down now.
et voila mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 -----blablaba ----blablaba -----blablaba sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(Unknown Source) at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(Unknown Source) ... 18 more 10 févr. 2010 19:38:47 jade.core.Runtime$1 run INFO:----------------------------- Agent container Main-container@djug is realy ----------------------------------- Hello word my name is smith
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 package firstAgent; import jade.core.Agent; /** This example shows a minimal agent that just prints "Hello World!" and then terminates. @author Giovanni Caire - TILAB */ public class HelloWorldAgent extends Agent { protected void setup() { System.out.println("Hello World! My name is "+getLocalName()); // Make this agent terminate doDelete(); } }
Je peux savoir Pourquoi ?
Merci d'avance
c'est Bon sa marché pour le premier tuto, le problème étais dans éclipse !
maintenant j'ai essayé le programme avec 2 agents(AgentA et AgentB) et il ne marche pas
j'ai ajouté la class AgLAg.java qui ce charge de lancer les deux class: AgentA et AgentB
il m'affiche dans la console:
PS:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 11 févr. 2010 13:14:14 jade.core.Runtime beginContainer INFO: ---------------------------------- This is JADE 3.7 - revision 6154 of 2009/07/01 17:34:15 downloaded in Open Source, under LGPL restrictions, at http://jade.tilab.com/ ---------------------------------------- 11 févr. 2010 13:14:16 jade.core.BaseService init INFO: Service jade.core.management.AgentManagement initialized 11 févr. 2010 13:14:16 jade.core.BaseService init INFO: Service jade.core.messaging.Messaging initialized 11 févr. 2010 13:14:16 jade.core.BaseService init INFO: Service jade.core.mobility.AgentMobility initialized 11 févr. 2010 13:14:16 jade.core.BaseService init INFO: Service jade.core.event.Notification initialized 11 févr. 2010 13:14:16 jade.core.messaging.MessagingService clearCachedSlice INFO: Clearing cache11 févr. 2010 13:14:16 jade.mtp.http.HTTPServer <init> INFO: HTTP-MTP Using XML parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser 11 févr. 2010 13:14:16 jade.core.messaging.MessagingService boot INFO: MTP addresses: <a href="http://windows-89387e3:7778/acc" target="_blank">http://windows-89387e3:7778/acc</a> 11 févr. 2010 13:14:16 jade.core.AgentContainerImpl joinPlatform INFO: -------------------------------------- Agent container Main-Container@windows-89387e3 is ready. --------------------------------------------
quand je lance l'agentA seulement , il m'affiche:
alors que normalement il m'affiche :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 11 févr. 2010 13:21:36 jade.core.Runtime beginContainer INFO: ---------------------------------- This is JADE 3.7 - revision 6154 of 2009/07/01 17:34:15 downloaded in Open Source, under LGPL restrictions, at http://jade.tilab.com/ ---------------------------------------- 11 févr. 2010 13:21:37 jade.core.BaseService init INFO: Service jade.core.management.AgentManagement initialized 11 févr. 2010 13:21:37 jade.core.BaseService init INFO: Service jade.core.messaging.Messaging initialized 11 févr. 2010 13:21:37 jade.core.BaseService init INFO: Service jade.core.mobility.AgentMobility initialized 11 févr. 2010 13:21:37 jade.core.BaseService init INFO: Service jade.core.event.Notification initialized 11 févr. 2010 13:21:37 jade.core.messaging.MessagingService clearCachedSlice INFO: Clearing cache 11 févr. 2010 13:21:38 jade.mtp.http.HTTPServer <init> INFO: HTTP-MTP Using XML parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser 11 févr. 2010 13:21:38 jade.core.messaging.MessagingService boot INFO: MTP addresses: http://windows-89387e3:7778/acc 11 févr. 2010 13:21:38 jade.core.AgentContainerImpl joinPlatform INFO: -------------------------------------- Agent container Main-Container@windows-89387e3 is ready. --------------------------------------------
merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 --------------------------------------- ----------------agent A---------------- --------------------------------------- en attente de l agent B
comment tu lances les agents? (quelles sont les commandes utilisées)?
c'est Bon Djug j'ai trouvé mon erreur , il faut juste préciser pour les membres que quand vous ajoutez la class AgLAgqui permet de lancer AgentA et AgentB il faut lui attribuer un nom comme dans le premier tuto, contrairement a AgentA et AgentB.
merci Djug
Bonjour,
Dans le tuto concernant les Behaviours, j'ai vu une manière bizarre de créer et initialiser un behaviour pour le passer en argument à addBehaviour(...) :
Pouvez vous m'expliquer celà ? Peut on faire autrement ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 addBehaviour(new TickerBehaviour(this, 2000) { protected void onTick() { System.out.println("Il reste "+(nombreDeSecondes-getTickCount())+" seconds "); } });
Pour un autre bout de code qui est le suivant :
J'ai pue le remplacer par ce qui suit, pour bien le comprendre (mais pour le code concernant les behaviours planifiés, je ne vois pas vraiment) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 addBehaviour(new OneShotBehaviour(this){ public void action(){ System.out.println("Hola blabla"); } });
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 <...> protected void setup() { addBehaviour(new MaClass()); } private class MaClass extends OneShotBehaviour { public void action(){ System.out.println("Hola blabla"); } } <...>
c'est la manière la plus efficace pour ajouter un behaviour.Bonjour,
Dans le tuto concernant les Behaviours, j'ai vu une manière bizarre de créer et initialiser un behaviour pour le passer en argument à addBehaviour(...) :
tu peux aussi faire:
création d'une variable en plus
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 behaviour monBeh =new TickerBehaviour(this, 2000) { protected void onTick() { System.out.println("Il reste "+(nombreDeSecondes-getTickCount())+" seconds "); } } addBehaviour(monBeh );
et j'ai pas bien compris la 2em question (si tu peux la poser d'une autre manière)
Ma deuxième question étais:
comment écrire les Behaviours planifiés de façon a déclarer le Behaviour dans la méthode Setup() mais ses méthodes ( onTick ou bien onWake ) en dehors de Setup() ?
comme les Behaviours simple j'ai pue faire :
mais puisque tu dit que l'autre maniére c'est la plus efficace alors on fait avec .
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 <...> protected void setup() { addBehaviour(new MaClass()); } private class MaClass extends OneShotBehaviour { public void action(){ System.out.println("Hola blabla"); } } <...>
maintenant est ce que je peu savoir quel est l'ordre d'exécution des Behaviours ? quand je lance un programme qui contient un OneShotBehaviour , CyclicBehaviour puis Genéric Behaviour selon cet ordre , il commence par l'éxécution de OneShotBehaviour ensuite CyclicBehaviour ensuite Genéric Behaviour ensuite CyclicBehaviour ensuite Genéric Behaviour.... alors que je m'attendais a l'éxécution de OneShotBehaviour puis CyclicBehaviour( comme une boucle infini puique done() return false ) et l'éxécution de Genéric Behaviour n'aura jamais lieu !!!
pour déclarer un behaviour en dehors de la méthode setup() on peux envisager la méthode suivante (utiliser quand le corps du behaviour est de grande taille et c'est un behaviour quand utilise plusieurs fois):
créer une Inner class (une classe écrite dans le meme fichier que la classe de l'agent en question). on l'appel monBehaviour:
ajouter le behaviour de la manière suivante:
pour définir l'ordre d'exécution, il faut utiliser les FSMBehaviour (une sorte de machine d'états finis)
Code : Sélectionner tout - Visualiser dans une fenêtre à part addBehaviour(new monBehaviour());
PS: il est préférable de poser les questions sur les Behaviour ici
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager