IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Programmation par agent Java Discussion :

Les communications des agents JADE [Tutoriel]


Sujet :

Programmation par agent Java

  1. #1
    Expert éminent sénior

    Avatar de Djug
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    2 980
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Algérie

    Informations forums :
    Inscription : Mai 2007
    Messages : 2 980
    Points : 17 970
    Points
    17 970
    Par défaut Les communications des agents JADE
    Bonjour,

    voici un article sur Les communications des agents JADE

    http://djug.developpez.com/java/jade/communication/


    vos remarques sont les bienvenues.

  2. #2
    Membre expert
    Avatar de Golgotha
    Homme Profil pro
    Full-stack Web Developer
    Inscrit en
    Août 2007
    Messages
    1 386
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Full-stack Web Developer
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2007
    Messages : 1 386
    Points : 3 531
    Points
    3 531
    Billets dans le blog
    1
    Par défaut
    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 ?
    Consultant et développeur full-stack spécialiste du Web
    faq jQuery - règles du forum - faqs web

  3. #3
    Expert éminent sénior

    Avatar de Djug
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    2 980
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Algérie

    Informations forums :
    Inscription : Mai 2007
    Messages : 2 980
    Points : 17 970
    Points
    17 970
    Par défaut
    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
    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
    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

    lances les agents avec ces deux commandes et dis moi ce que tu trouve comme résultats

  4. #4
    Membre expert
    Avatar de Golgotha
    Homme Profil pro
    Full-stack Web Developer
    Inscrit en
    Août 2007
    Messages
    1 386
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Full-stack Web Developer
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2007
    Messages : 1 386
    Points : 3 531
    Points
    3 531
    Billets dans le blog
    1
    Par défaut
    Bonjour,

    j'utilise ce que tu donne dans le première article :

    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
    Ducoup je lance chaque agent a la suite, en remplacent les paramètres dans les configurations..

    -gui jade.boot AgentA:firstAgent.AgentA
    puis
    -gui jade.boot AgentB:firstAgent.AgentB
    pour le deuxième.

    Mais ça ne marche pas..
    Consultant et développeur full-stack spécialiste du Web
    faq jQuery - règles du forum - faqs web

  5. #5
    Expert éminent sénior

    Avatar de Djug
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    2 980
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Algérie

    Informations forums :
    Inscription : Mai 2007
    Messages : 2 980
    Points : 17 970
    Points
    17 970
    Par défaut
    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:
    ---------------------------------------
    ----------------agent A----------------
    ---------------------------------------
    en attente de l agent B
    puis l'agent s'arrête et attend l'agent AgentB


    alors si on refait la même procédure pour lancer le 2em agent alors un message d'erreur apparait:
    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.
    parce que on ne peut pas lancer deux plateforme JADE sur la même machine.

    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

  6. #6
    Membre expert
    Avatar de Golgotha
    Homme Profil pro
    Full-stack Web Developer
    Inscrit en
    Août 2007
    Messages
    1 386
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Full-stack Web Developer
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2007
    Messages : 1 386
    Points : 3 531
    Points
    3 531
    Billets dans le blog
    1
    Par défaut
    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 :

    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();
    Qu'en pense tu ?
    Consultant et développeur full-stack spécialiste du Web
    faq jQuery - règles du forum - faqs web

  7. #7
    Expert éminent sénior

    Avatar de Djug
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    2 980
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Algérie

    Informations forums :
    Inscription : Mai 2007
    Messages : 2 980
    Points : 17 970
    Points
    17 970
    Par défaut
    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();
    			}
     
     
     
     
    	}
    }

  8. #8
    Membre expert
    Avatar de Golgotha
    Homme Profil pro
    Full-stack Web Developer
    Inscrit en
    Août 2007
    Messages
    1 386
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Full-stack Web Developer
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2007
    Messages : 1 386
    Points : 3 531
    Points
    3 531
    Billets dans le blog
    1
    Par défaut
    Parfait

    Merci !
    Consultant et développeur full-stack spécialiste du Web
    faq jQuery - règles du forum - faqs web

  9. #9
    Candidat au Club
    Inscrit en
    Décembre 2009
    Messages
    2
    Détails du profil
    Informations forums :
    Inscription : Décembre 2009
    Messages : 2
    Points : 2
    Points
    2
    Par défaut
    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

  10. #10
    Expert éminent sénior

    Avatar de Djug
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    2 980
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Algérie

    Informations forums :
    Inscription : Mai 2007
    Messages : 2 980
    Points : 17 970
    Points
    17 970
    Par défaut
    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

  11. #11
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Février 2010
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2010
    Messages : 1
    Points : 1
    Points
    1
    Par défaut
    Citation Envoyé par Djug Voir le message
    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();
    			}
     
     
     
     
    	}
    }
    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.

  12. #12
    Expert éminent sénior

    Avatar de Djug
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    2 980
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Algérie

    Informations forums :
    Inscription : Mai 2007
    Messages : 2 980
    Points : 17 970
    Points
    17 970
    Par défaut
    peux-tu indiquer comment tu lances chaque agents (l'ordre d'exécution, les commandes utilisées)?

  13. #13
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    158
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 158
    Points : 72
    Points
    72
    Par défaut Probléme avec JADE
    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 :
    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.
    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
    -----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
    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
    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

  14. #14
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    158
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 158
    Points : 72
    Points
    72
    Par défaut
    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:
    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.
    --------------------------------------------
    PS:
    quand je lance l'agentA seulement , 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.
    --------------------------------------------
    alors que normalement il m'affiche :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    ---------------------------------------
    ----------------agent A----------------
    ---------------------------------------
    en attente de l agent B
    merci

  15. #15
    Expert éminent sénior

    Avatar de Djug
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    2 980
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Algérie

    Informations forums :
    Inscription : Mai 2007
    Messages : 2 980
    Points : 17 970
    Points
    17 970
    Par défaut
    comment tu lances les agents? (quelles sont les commandes utilisées)?

  16. #16
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    158
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 158
    Points : 72
    Points
    72
    Par défaut
    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

  17. #17
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    158
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 158
    Points : 72
    Points
    72
    Par défaut
    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(...) :

    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 ");
    			} 
    		});
    Pouvez vous m'expliquer celà ? Peut on faire autrement ?

    Pour un autre bout de code qui est le suivant :

    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");
    		  }
    	  });
    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
    7
    8
    9
    10
    11
     
    <...>
    protected void setup() {
       addBehaviour(new MaClass());
    }
    private class MaClass extends OneShotBehaviour {
       public void action(){
          System.out.println("Hola blabla");
       }
    }
    <...>
    Merci

  18. #18
    Expert éminent sénior

    Avatar de Djug
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    2 980
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Algérie

    Informations forums :
    Inscription : Mai 2007
    Messages : 2 980
    Points : 17 970
    Points
    17 970
    Par défaut
    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(...) :
    c'est la manière la plus efficace pour ajouter un behaviour.


    tu peux aussi faire:

    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 );
    création d'une variable en plus



    et j'ai pas bien compris la 2em question (si tu peux la poser d'une autre manière)

  19. #19
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    158
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 158
    Points : 72
    Points
    72
    Par défaut
    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 :
    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");
       }
    }
    <...>
    mais puisque tu dit que l'autre maniére c'est la plus efficace alors on fait avec .
    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 !!!

  20. #20
    Expert éminent sénior

    Avatar de Djug
    Homme Profil pro
    Inscrit en
    Mai 2007
    Messages
    2 980
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Algérie

    Informations forums :
    Inscription : Mai 2007
    Messages : 2 980
    Points : 17 970
    Points
    17 970
    Par défaut
    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:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    addBehaviour(new monBehaviour());
    pour définir l'ordre d'exécution, il faut utiliser les FSMBehaviour (une sorte de machine d'états finis)


    PS: il est préférable de poser les questions sur les Behaviour ici

Discussions similaires

  1. Communication entre des agents jade
    Par Nouur dans le forum Programmation par agent
    Réponses: 0
    Dernier message: 28/04/2014, 23h39
  2. Communication entre des agents jade
    Par Nouur dans le forum Programmation par agent
    Réponses: 0
    Dernier message: 28/04/2014, 23h36
  3. Pour les fanas des Agents
    Par carla-la-belle dans le forum Windows 7
    Réponses: 2
    Dernier message: 12/11/2009, 13h51

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo