`LinkManager` is for NetLogo links <http://ccl.northwestern.edu/netlogo/5.0/docs/programming.html#links>, which are a type of visible agent in NetLogo and not exactly an abstraction for data correlation.

What's the purpose of your correlation of turtles with other data? NetLogo doesn't really have anything built in for saying that a turtle is related to some other data. I'm not sure I'm understanding your goals correctly, but, if I am, it sounds like you just want to run NetLogo headlessly and provide your own version of the NetLogo view, which, of course, is kept in sync with the state of the model as it progresses. Is that right? If so, and if you're dealing with the code from the 'headless' branch of NetLogo, then take of a look at 'org.nlogo.mirror.Mirroring <https://github.com/NetLogo/NetLogo/blob/headless/src/main/mirror/Mirroring.scala>'. Using that and its `diffs` method, you can find out what variables have changed in the model since your last snapshot, and then update your visualization according to that diff.

On 05/19/2014 02:01 PM, Brant Horio wrote:
Hello all,

I am currently working on calling NetLogo headless from Java for the purposes of doing my own non-NetLogo visualization, primarily as just an exploratory programming exercise. I am coding in Java and have been able to successfully read in and iterate through the turtle agent list, reading in agent attribute values, coordinate positions, etc, for the visualization. I do so by:

public static HeadlessWorkspace workspace = HeadlessWorkspace.newInstance( );
public static Iterable<Agent> netLogoAgentList;

netLogoAgentList = workspace.world( ).turtles( ).agents( );

... after which I iterate through netLogoAgentList to get the variable values, etc that I need for my visualization.


What I am envisioning is that for each of these agents read in, I create an agent object in Java that carries the read in variable updates from its NetLogo counterpart and my own methods for the visualization. I also want these agent object to carry with them an ArrayList of other agent objects that they are "linked" with, as informed to them by updates from the NetLogo model. Are there any suggestions out there for the best way for me to do so? I suspect it will involve LinkManager, in particular LinkManager.findLinksWith( ).

My current strategy (though I have found no success yet) is to do the following:

 1. iterate through netLogoAgentList, and cast as (Turtle).
      * netLogoAgentList = workspace.world( ).turtles( ).agents( );
      * for (Agent t : netLogoAgentList)
        {
             Turtle tmpAgent = (Turtle)
        workspace.world().turtles().agent(t);
        }
 2. for each Turtle agent, tmpAgent, call LinkManager.findLinksWith(
    ), using tmpAgent and workspace.world( ).turtles( ) as arguments,
    the idea being I can get back an agent set of all turtles linked
    to or from turtle tmpAgent.
 3. Store the linked turtles to my Java agent object in the previously
    mentioned ArrayList, allowing me to later iterate through the list
    and plot out the links in the NetLogo network in my visualization.

I am produce perhaps some of the ugliest code around so I apologize if I'm totally off base in my pseudo code/approach/thought process. I have tried a bunch of different things though and cannot seem to get what *I think* I should be able to get back from LinkManager, which is the turtles that each one is linked from/to. Any advice for how to best access the API to get this data would be very much appreciated.

THANK YOU IN ADVANCE!!!

--
You received this message because you are subscribed to the Google Groups "netlogo-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to