Hello, Thank you for your reply. Based on the documentation provided about Netlogo extensions, I am not sure if building a Netlogo extension is actually the solution in my case.
I lean towards using the controlling API. I will do my best to explain the model below: I want a java main class to activate my Netlogo simulation in which the turtles will start moving in random directions. At a defined point in time, I want the positions of the turtles retrieved from Netlogo and reported to java. These positions are to be preprocessed in the java main class. Then, the processed data will be sent to an AMPL model to execute an ILP optimization using CPLEX (AMPL API used). After the ILP optimization is complete, a final position (goal generated by the ILP) is disseminated back to the each turtle in Netlogo (Each turtle will now adjust its movement and go to that specific position). The challenge is that I want the Netlogo simulation to keep running while the ILP optimization is being executed. Also, I want the ILP optimization to be triggered several times during one simulation (each time for a different group of turtle). I hope it is clear. Thank you in advance. Gaby On Tuesday, 22 January 2019 14:13:31 UTC-5, Bryan Head wrote: > > Hi Gaby, > > There are two options I see for this. The first, and probably simplest, is > to wrap the ILP optimization library in a NetLogo extension. For instance, > the matrix extension wraps the JAMA java library: > https://github.com/NetLogo/Matrix-Extension (though it's a little on the > old side). A simpler example, if you're comfortable with Scala, is the CSV > extension, which wraps the Apache Commons CSV library: > https://github.com/NetLogo/CSV-Extension. The basic workflow is that you > would add a reporter primitive to your extension that takes as an argument > the necessary data for ILP and then returns the output of the optimization. > > The other option would the controlling API, which allows NetLogo to be > used as a library in another Java program: > https://github.com/NetLogo/NetLogo/wiki/Controlling-API. > > This sounds like a perfect case for an extension, so I would recommend > that approach over the controlling API approach. > > Hope that helps! > Bryan > > On Tue, Jan 22, 2019 at 7:09 AM <gabyjoe...@gmail.com <javascript:>> > wrote: > >> Hello, >> >> I would like to use Netlogo in combination with a Java code that run an >> ILP optimization. >> During the simulation, input data (for the optimization) is required from >> Netlogo and the output of the optimization is to be disseminated back to >> Netlogo. >> >> I am not sure if it is possible to invoke and control the NetLogo >> application from the Java program (in which the optimization takes place) >> while maintaining the flow of data between NetLogo and java, or if there is >> a more practical technique to do that. >> >> Thanks, >> Gaby >> >> -- >> 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 netlogo-deve...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > Bryan Head > PhD Candidate, Computer Science > Center for Connected Learning and Computer-Based Modeling > Department of Electrical Engineering and Computer Science > Northwestern University > -- 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 netlogo-devel+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.