Quantcast

How to add new agent when the program is in execution?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to add new agent when the program is in execution?

Carter Tsai
Hi..

I am  newbie to Jason.. I am thinking implementing a
trade negotiation system.

I got a question, how to add a new agent into the
program when it is executed?

How to use the .createAgent()?

Thanks.
Carter



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to add new agent when the program is in execution?

Jomi Hubner
Hi Carter,

You can add a new agent into a running MAS using an Internal Action  
inside an AS program (see Jason FAQ at
http://jason.sourceforge.net/faq/). It works for all current Jason  
infrastructures (centralised or saci).

To create a new AS agent from the command prompt (e.g. when an user  
wants to create a new agent that cooperates with agents that was  
already created), you should write a Java program that calls the  
createAgent Internal Action.

It follows an example of such a program that works with the  
"createAgDemo" example that comes with Jason 0.7.1:
-----------------

import jason.stdlib.*;
import org.apache.log4j.*;

/**
  *   This program creates a new agent for SACI infrastructure.
  *   This new agent is named "anotherAg" and enters in a
  *   MAS called "createAgDemo" that must be already running.
  */
public class CreateAgDemo {
   public static void main(String[] args) {
       // setup a logger
       
PropertyConfigurator.configure(createAgent.class.getResource("/
log4j.configuration"));

       // calls an Internal Action to create the agent
       new createAgent().createSaciAg(
          "anotherAg",     // agent name
          "createAgDemo",  // MAS name
          "ag1.asl",       // AgentSpeak source
          false);          // synchronous execution is false
   }
}
--------------------------------

Compile this source with
    javac -classpath ../../bin/jason.jar:../../lib/log4j.jar:.  
CreateAgDemo.java

Run your MAS using the JasonIDE (it must use Saci infrastructure  
instead of Centralised).

Run the above program with
    java -classpath  
../../bin/jason.jar:../../lib/log4j.jar:../../lib/saci.jar:.  
CreateAgDemo


Regards,

Jomi



On Sep 27, 2005, at 4:53 AM, Carter Tsai wrote:

> Hi..
>
> I am  newbie to Jason.. I am thinking implementing a
> trade negotiation system.
>
> I got a question, how to add a new agent into the
> program when it is executed?
>
> How to use the .createAgent()?
>
> Thanks.
> Carter
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads,  
> discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Jason-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jason-users
>



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Loading...