MaDKit forum

Welcome All !
Please, use explicit topic names when creating new threads. Thanks.

You are not logged in.

#1 Re: TurtleKit questions (how to) » Run several simulations in parallel » 2016-07-13 16:16:34

Thank you very much Fabien, it was really useful.

#2 TurtleKit questions (how to) » Run multiple threads in each turtle » 2016-07-13 16:12:40

ximog
Replies: 0

Hello,
I am developing a simulation of agents that perform several tasks in a specific dynamic scenario, and it would be really useful knowing how to build turtles that could run several threads at the same time.

For example, one "Listener" thread, where the turtle is processing all the messages that come from the other turtles, and one "Planner", which is calculating the optimum way to do these tasks.

I want to do that in real-time in order to allow planning in dynamic environments, with tasks that vary their positions throughout time, and I can't do it only with the current state machine framework.

Thank you very much in advance,
Ximo.

#3 TurtleKit questions (how to) » Run several simulations in parallel » 2016-06-28 16:48:03

ximog
Replies: 2

Hello,
I am simulating a society of agents which perform several tasks in a space.

My idea potentially is to generate a lot of different scenarios at the same time and extract statistical information about how these agents behave in these scenarios.

As I am not an expert in java, and I have been working with TurtleKit for less than two months, I do not know if it is possible to build several simulations in parallel and how to do it in MadKit/turtleKit.

Furthermore, how could I do to run one simulation after another without having to rerun again everytime the simulation finishes?

Thank you very much,

XG.

#4 TurtleKit questions (how to) » How to launch » 2016-05-02 21:52:47

ximog
Replies: 1

Hi, maybe this is a trivial question, but I am completely new to Java and OOprogramming.
I am trying to run the Termites simulation in turtlekit 2.4.9 and I cannot run it using the Tk2Launcher by using the newSimulation method:

launch.newSimulation("C:\\Users\\Ximo\\Desktop\\TFG\\Tk2\\src\\edu\\turtlekit2\\demos\\termites\\Demo_Termites.xml");
(launch = instance of Tk2Launcher).

The problem is that in the XMLParser (specifically in the method: document = builder.parse( configFile); ) , the compiler throws NullPointerException. Java returned: 1 BUILD FAILED. C:\Users\Ximo\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53:

I thought the program did not recognize the XML file, but I added:

boolean exist = configFile.exists(); just before document = builder.parse( configFile); and the result of the debugger is that exist is true.

I tried to launch the simulation building a single launcher, which is shown as follows:

-------------------------------------------------------------------------------------------------------------------------------
package edu.turtlekit2.demos.termites;

import edu.turtlekit2.kernel.agents.Observer;
import edu.turtlekit2.kernel.agents.Turtle;
import edu.turtlekit2.kernel.agents.Viewer;
import edu.turtlekit2.kernel.environment.TurtleEnvironment;
import madkit.kernel.Agent;
import madkit.kernel.AbstractAgent;
import madkit.kernel.Kernel;

/**
*
* @author Ximo
*/
public class Launcher extends Agent {
   
     public static void main(String args[])  {
          Launcher myLauncher = new Launcher();
          String name = "Termites";
          TurtleEnvironment environment = new TurtleEnvironment();
          environment.initialize(150, 110, true);
         
          myLauncher.launchEnvironment(environment,name);
          PatchInitializer myPatch = new PatchInitializer(0.4f);
          myLauncher.launchObserver (myPatch, name);
          for (int i = 0; i < 400; i++){
              Termite myTerm = new Termite();
              myTerm.initialisation((int) (Math.random() * (double)150), ((int) (Math.random()*(double)110)), environment, i, null);             
          }
         
         
          Viewer myView = new Viewer ();
          myView.cellSize = 10;
          myLauncher.launchObserver (myView, name);
         
        }
     public void launchEnvironment(TurtleEnvironment agent, String name){
         launchAgent(agent, name, true);
     }
     public void launchObserver (Observer obs, String name){
         launchAgent(obs, name, true);
         
     }
             
   
}

-------------------------------------------------------------------------------------------------------

It fails at compiling again, with the same NullPointerException. Java returned: 1 BUILD FAILED. C:\Users\Ximo\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53:
I do not know what is happening. Thank you very much for your help in advance.
Best,
Ximo.

Board footer