Displaying Agents in Debug Mode

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Displaying Agents in Debug Mode

Tina Balke
Hi Rafael and Jomi,
I have a display problem in the debug mode. At the beginning of my
simulation I use a simulator agent to create all other agents.
if(action.equals(Literal.parseLiteral("create_agent"))){
        for(int i=0; i<numAgent; i++){
        model.setAgent("ag_" + i);
        createAgent("ag_" + i, "src/asl/agent.asl");
        }
        result = true;
        }
This works completely fine and the new agents are created and used in the
simulation. Thus, when I run the simulation in the normal mode the agents
are interacting, etc. and when I pause the simulation and click on the debug
mode I see all agents with their intentions,... However, if I run the
simulation in the debug mode right from the start, in the debug window only
the simulator agent is shown for analysis and although the other agents are
created and the simulation is running with them, they are not added for the
detailed analysis in the debug window. I'm using the Jason for Windows and
the eclipse plugin and have the problem when I'm running the simulation from
eclipse as well as from the Jason tool itself. A friend of mine who is using
Jason as well (he is using a version for the Mac that was delivered with
eclipse), has been running my code and gets the agent display (off all
agents) in the debug mode. Do you have any idea on how to solve this issue,
as obviously the debug analysis is quit important to the simulation?
Thanks in advance,
Tina


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|

Re: Displaying Agents in Debug Mode

Jomi Fred Hubner-4
Dear Tina,

the agents you are creating have to be "aware" that they will run in "debug mode" (aka SyncMode). In the their creation you have to define some parameters to say that, as in the following code

    public boolean executeAction(String agName, Structure action) {
        logger.info("creating agent");
        try {
            // create settings for sync execution
            Settings stts = new Settings();
           
            // if we are running in debug mode...
            if (RunCentralisedMAS.getRunner().getControllerInfraTier() != null) {
                stts.setSync(true);
            }
           
            getEnvironmentInfraTier().getRuntimeServices().createAgent("newag", "n.asl", null, null, null,stts);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

When the debug window appears, click on "Run" button some times and them the "newag" will be included in the list of agents.

Note that this solution will work only with centralised architecture.

HTH,

Jomi

ps.: it has worked on MacOS by change, due to a different thread allocations.

On 28/06/2010, at 10:52, Tina Balke wrote:

> Hi Rafael and Jomi,
> I have a display problem in the debug mode. At the beginning of my
> simulation I use a simulator agent to create all other agents.
> if(action.equals(Literal.parseLiteral("create_agent"))){
>         for(int i=0; i<numAgent; i++){
>         model.setAgent("ag_" + i);
>         createAgent("ag_" + i, "src/asl/agent.asl");
>         }
>         result = true;
>        }
> This works completely fine and the new agents are created and used in the
> simulation. Thus, when I run the simulation in the normal mode the agents
> are interacting, etc. and when I pause the simulation and click on the debug
> mode I see all agents with their intentions,... However, if I run the
> simulation in the debug mode right from the start, in the debug window only
> the simulator agent is shown for analysis and although the other agents are
> created and the simulation is running with them, they are not added for the
> detailed analysis in the debug window. I'm using the Jason for Windows and
> the eclipse plugin and have the problem when I'm running the simulation from
> eclipse as well as from the Jason tool itself. A friend of mine who is using
> Jason as well (he is using a version for the Mac that was delivered with
> eclipse), has been running my code and gets the agent display (off all
> agents) in the debug mode. Do you have any idea on how to solve this issue,
> as obviously the debug analysis is quit important to the simulation?
> Thanks in advance,
> Tina
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Jason-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jason-users

--
Jomi Fred Hubner
Federal University of Santa Catarina
Department of Automation and Systems Engineering
PO Box 476, Florianópolis, SC
88040-900 Brazil
http://www.das.ufsc.br/~jomi


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|

Re: Displaying Agents in Debug Mode

Jomi Fred Hubner-4
In reply to this post by Tina Balke
Tina, please ignore the previous code and use the following that also updates the number of agents the debug are considering.

    public boolean executeAction(String agName, Structure action) {
        logger.info("creating agent");
        try {
            // create settings for sync execution
            Settings stts = new Settings();
           
            // if we are running in debug mode...
            CentralisedExecutionControl ec = RunCentralisedMAS.getRunner().getControllerInfraTier();
            if (ec != null) {
                stts.setSync(true);
            }
           
            getEnvironmentInfraTier().getRuntimeServices().createAgent("newag", "n.asl", null, null, null,stts);
           
            if (ec != null) {
                ec.getUserControl().updateNumberOfAgents();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }


On 28/06/2010, at 10:52, Tina Balke wrote:

> Hi Rafael and Jomi,
> I have a display problem in the debug mode. At the beginning of my
> simulation I use a simulator agent to create all other agents.
> if(action.equals(Literal.parseLiteral("create_agent"))){
>         for(int i=0; i<numAgent; i++){
>         model.setAgent("ag_" + i);
>         createAgent("ag_" + i, "src/asl/agent.asl");
>         }
>         result = true;
>        }
> This works completely fine and the new agents are created and used in the
> simulation. Thus, when I run the simulation in the normal mode the agents
> are interacting, etc. and when I pause the simulation and click on the debug
> mode I see all agents with their intentions,... However, if I run the
> simulation in the debug mode right from the start, in the debug window only
> the simulator agent is shown for analysis and although the other agents are
> created and the simulation is running with them, they are not added for the
> detailed analysis in the debug window. I'm using the Jason for Windows and
> the eclipse plugin and have the problem when I'm running the simulation from
> eclipse as well as from the Jason tool itself. A friend of mine who is using
> Jason as well (he is using a version for the Mac that was delivered with
> eclipse), has been running my code and gets the agent display (off all
> agents) in the debug mode. Do you have any idea on how to solve this issue,
> as obviously the debug analysis is quit important to the simulation?
> Thanks in advance,
> Tina
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Jason-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jason-users

--
Jomi Fred Hubner
Federal University of Santa Catarina
Department of Automation and Systems Engineering
PO Box 476, Florianópolis, SC
88040-900 Brazil
http://www.das.ufsc.br/~jomi


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users