Re: [netlogo-devel] Re: getting netlogo-extension-plugin to work

2019-07-29 Thread Jason Bertsche
Yep!  The primary line that enables that is this line 
<https://github.com/NetLogo/Sound-Extension/blob/hexy/build.sbt#L14> 
(which tells SBT where to find Java source files).  SBT has good support 
for both Scala and Java (and possibly even other JVM languages).  For 
the most part, SBT is just a build tool.  But it just so happens that 
it's the only build tool that the NetLogo Extension Plugin works with.


Jason

On 7/29/19 3:54 PM, Steve Scott wrote:
I noticed that the sound extension uses sbt to build, but uses  java 
source code?


On Mon, Jul 8, 2019 at 3:46 PM Jason Bertsche 
<mailto:jason.berts...@northwestern.edu>> wrote:


Hi Steve,

If your goal is to make a new extension, you shouldn't need to
compile that plugin at all.  We've already compiled it and hosted
it somewhere where everyone can access it.  If you want to use the
plugin, just go to the 'project/plugins.sbt' file /in your
extension's directory/ and add this code to it:

resolvers += Resolver.url( "NetLogo-JVM",
url("http://dl.bintray.com/content/netlogo/NetLogo-JVM

<https://urldefense.proofpoint.com/v2/url?u=http-3A__dl.bintray.com_content_netlogo_NetLogo-2DJVM=DwMFaQ=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI=yNsUyBBYoqZUndVuw_Ooy7FW1vqkXHXr1pI4WAA6dK8=0lXsuN5-OeJz3_mvq3ZBuXERk-X7QV9q2joqmZ300T0=>"))(
Resolver.ivyStylePatterns) addSbtPlugin("org.nlogo" %
"netlogo-extension-plugin" % "3.2")


In general, when in doubt about the boilerplate that goes into
making your run-of-the-mill NetLogo extension, I recommend using
the Sample Scala Extension

<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_NetLogo_Sample-2DScala-2DExtension=DwMFaQ=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI=yNsUyBBYoqZUndVuw_Ooy7FW1vqkXHXr1pI4WAA6dK8=SQQxRfM-OYaOl3dPd0o8AG6lY8nMdqP8xDlDE6TNM6M=>
as a point of reference, or even just cloning it and then
modifying it to add your primitives and preferred extension name,
etc..

On Saturday, July 6, 2019 at 8:46:50 PM UTC-5, Steve Scott wrote:

Hello. Just joined this group. Name is Steve. Pleased to meet you.

I am finally able to compile netlogo-extension-plugin master
using
|
sbt package
|
Entercode here...
|


|

This generated the file
|
netlogo-extension-plugin-3.2.jar
|
I renamed it
|
netlogo-extension-plugin
|
I am getting the error:
|
Bad extension 'netlogo-extension-plugin': Can't find extension
name in Manifest.
|

Where is the manifest set in netlogo-extension-plugin? Inside
src\sbt-test.netlogo-extension-plugin\basic\ there is
something called build.sbt with the name "Hello-Extension" and
netLogoExtName := "helloscala" but those aren't found in netlogo.

Am I compiling in the wrong directory? I was not able to
create a package from the basic directory.

Thanks for your insight.

-- 
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
<mailto:netlogo-devel+unsubscr...@googlegroups.com>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/netlogo-devel/b30a6c8e-e7d3-4b0e-af2d-2649495fbebe%40googlegroups.com

<https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_netlogo-2Ddevel_b30a6c8e-2De7d3-2D4b0e-2Daf2d-2D2649495fbebe-2540googlegroups.com-3Futm-5Fmedium-3Demail-26utm-5Fsource-3Dfooter=DwMFaQ=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI=yNsUyBBYoqZUndVuw_Ooy7FW1vqkXHXr1pI4WAA6dK8=2pWlMXuZO5kRazHqRcvQG4rnEGNKGxc1BTrHE90wLUE=>.



--
From the personal email account of Steve Scott.
--
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 
<mailto:netlogo-devel+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netlogo-devel/CA%2BM9PAMmdJEPAa%2BhQqnrFbs5NWJa%2BYhYE6qmnisNDMZjJ7QQcA%40mail.gmail.com 
<https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_netlogo-2Ddevel_CA-252BM9PAMmdJEPAa-252BhQqnrFbs5NWJa-252BYhYE6qmnisNDMZjJ7QQcA-2540mail.gmail.com-3Futm-5Fmedium-3Demail-26utm-5Fsource-3Dfooter=DwMFaQ=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI=yNsUyBBYoqZUndVuw_Ooy7FW1vqkXHX

[netlogo-devel] Re: getting netlogo-extension-plugin to work

2019-07-08 Thread Jason Bertsche
Hi Steve,

If your goal is to make a new extension, you shouldn't need to compile that 
plugin at all.  We've already compiled it and hosted it somewhere where 
everyone can access it.  If you want to use the plugin, just go to the 
'project/plugins.sbt' file *in your extension's directory* and add this 
code to it:

resolvers += Resolver.url(
  "NetLogo-JVM",
  url("http://dl.bintray.com/content/netlogo/NetLogo-JVM;))(
Resolver.ivyStylePatterns)

addSbtPlugin("org.nlogo" % "netlogo-extension-plugin" % "3.2")


In general, when in doubt about the boilerplate that goes into making your 
run-of-the-mill NetLogo extension, I recommend using the Sample Scala 
Extension  as a point of 
reference, or even just cloning it and then modifying it to add your 
primitives and preferred extension name, etc..

On Saturday, July 6, 2019 at 8:46:50 PM UTC-5, Steve Scott wrote:
>
> Hello. Just joined this group. Name is Steve. Pleased to meet you.
>
> I am finally able to compile netlogo-extension-plugin master using 
> sbt package
> Enter code here...
>
>
>
> This generated the file 
> netlogo-extension-plugin-3.2.jar
> I renamed it 
> netlogo-extension-plugin
> I am getting the error:
> Bad extension 'netlogo-extension-plugin': Can't find extension name in 
> Manifest.
>
> Where is the manifest set in netlogo-extension-plugin? Inside 
> src\sbt-test.netlogo-extension-plugin\basic\ there is something called 
> build.sbt with the name "Hello-Extension" and netLogoExtName := 
> "helloscala" but those aren't found in netlogo.
>
> Am I compiling in the wrong directory? I was not able to create a package 
> from the basic directory.
>
> Thanks for your insight.
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netlogo-devel/b30a6c8e-e7d3-4b0e-af2d-2649495fbebe%40googlegroups.com.


Re: [netlogo-devel] Re: Getting Tortoise running on my own machine?!

2019-07-03 Thread Jason Bertsche
Your `nlogo` variable needs to contain the string form of a valid 
NetLogo model file (i.e. a '.nlogo' file).  In order to compile code 
into something useful, NetLogo needs a lot more information than just 
your procedures (e.g. it needs to know if there are any global variables 
that are declared in widgets).


To make this example of yours work, just get ahold of a '.nlogo' file 
for a blank model in either NetLogo or NetLogo Web.  '.nlogo' files are 
text files that are delimited by instances of @#$#@#$#@ .  Add the code 
for your NetLogo procedures before the first instance of the delimiter. 
Then, copy the entire contents of that file as the value for your 
`nlogo` variable in your JavaScript program, and it should work.


On 7/3/2019 6:06 AM, Daniel Graungaard wrote:
The answer provided in #3 was exactly what I was looking for. Thanks 
so much for that.


However I keep getting "success false", with the message: "Models must 
have 12 sections, this had 1".


I have looked through both test and code from Galapagos, and have 
tried different values for the nlogo string. However I keep getting 
the error.


Do you have any idea why or can you provide the format for the nlogo 
string?


I have attached screenshots of my code and outputs below.

//Daniel



On Wednesday, 3 July 2019 08:40:27 UTC+2, Daniel Graungaard wrote:

Hi Jeremy

Thank you so much for your very detailed answer. The use case I am
working on is closest to #3.

I had been looking on Galapagos and Teletortoise (which I know is
discontinued) to see if I could come up with how to use tortoise.

However your instructions was really helpful. I am going to try
them out, and see how it goes.

Thank you :)

//Daniel

On Tuesday, 2 July 2019 23:44:53 UTC+2, Jeremy Baker wrote:

Hey Daniel!  Welcome.

The answer here really depends on what you're trying to use
Tortoise for, but I tried to cover the possibilities below.
 If I missed you're use case, just let me know and I'll try to
fill in more details.

0) The first thing I'd point out is that Tortoise is just the
compiler and engine for NetLogo Web, it doesn't include any
front-end UI or view code.  For that, there is Galapagos,
which gives a UI for loading models and also runs models,
updating a view for them while they go:
https://github.com/NetLogo/Galapagos

.
 If you want to make changes to Tortoise and see those in a
front-end, check out the instructions in the Galapagos repo
for that:

https://github.com/NetLogo/Galapagos/wiki/Contributing#publishing-tortoise-changes



1) If you're trying to make changes to the Tortoise code to do
things like adding features or changing existing primitives,
you're probably best served using the tests built into
Tortoise in order to "use" it.  You can take a look at
`Tortoise.txt` to see how add simple NetLogo language tests,
or `Model.scala` to add a whole model for testing if you
prefer to test that way.  More info on tests:
https://github.com/NetLogo/Tortoise/wiki/Tortoise-Tests



2) If you're trying to compile and run models headless-ly,
then I'd recommend using NetLogo desktop, as it's probably
going to be better for that purpose than Tortoise, especially
with BehaviorSpace.

3) If you're trying to build your own UI around Tortoise from
within Javascript (or just want to play with it), then the
best reference will probably be the Galapagos project code.
 The short steps to using the Tortoise compiler and engine
from a Javascript runtime (a web page loaded in a browser,
Node.js):

  * Get the `tortoise-engine.js` and `tortoise-compiler.js`
files added/loaded to your environment.  If you run
`netLogoWeb/package` from within sbt, you'll get a copy of
those in the `netlogo-web/target/classes` folder to copy off.
  * Run 

Re: [netlogo-devel] How to get the information about UI widgets and plotting data?

2019-04-29 Thread Jason Bertsche

Hi John,

Apologies for the delayed reply.

So, like before, you run (new BrowserCompiler()).fromNlogo(nlogo, []) to 
compile your NetLogo model's source.  If it's successful, you'll get 
back an object of the form { model: { success: true, result: jsCode }, 
widgets: widgetJSONArray }. Thus far, I believe you've only made use of 
the model/result part of that.  But, if you want to add widget support, 
you'll need to make use of the widgets part of that, and you'll need to 
process that part first, since the widget variables need to be in place 
because we evaluate the JS code from result to initialize the "interface 
global" variables (e.g. the variables that are bound to Sliders and 
Switches and things).


So what should you do with widgets? Well, first understand that it's a 
JSON string.  Use JSON.parse on it, and you'll get back a JS array of JS 
objects, where each of those objects represents a widget.


And what will the individual widget objects contain?  Every widget 
contains a left, right, top, and bottom that tells you where to position 
it (in terms of absolute pixel coordinates in NetLogo's "Interface" 
tab).  Beyond that, there isn't documentation on the widget JSON format, 
and you'll need to examine the source code of each type of widget to 
learn what properties it has and how to use them.


The source code for the netlogoweb.org widget implementations can all be 
found here 
. 
The relevant files in the linked directory are:


 * button
 * chooser
 * input
 * label
 * monitor
 * output
 * plot
 * slider
 * switch
 * view

For example, let's look at slider.coffee (here 
). 
Go down to the slider value in the partials object towards the bottom of 
the file.  Inside the slider value, look for every reference to widget. 
This is all of them:


 * direction
 * maxValue
 * minValue
 * stepValue
 * currentValue
 * display
 * units

Okay.  That gives us a list of all things in a slider object that we 
could /possibly/ make use of.  And the HTML template also shows you 
/how/ they're used (in terms of building the HTML for the element).  But 
it's also up to you whether you even want to add support for each of 
those values. currentValue is pretty mandatory, but, things like 
direction and units can be easily skipped.  For each widget type, you'll 
probably find that it has a number of non-essential properties, which 
you can simply implement later (if ever).


Regarding currentValue in particular, one of the major and essential 
challenges of building a UI for Tortoise is going to be setting up 
two-way binding of widget currentValues and their in-engine counterparts 
(which are accessed via world.observer.getGlobal and 
world.observer.setGlobal).  This situation is kind of complicated in 
NetLogo, because changes to widgets need to affect the variable values 
stored in the engine, but, also, Command Center code and button code 
that change variables in the engine should also update the widgets.  Put 
another way: values for the interface globals in the engine need to be 
kept in sync with the values in the interface, and changes to the values 
can happen either in the interface (e.g. moving a slider) or in the 
engine (e.g. running set my-little-switch false in the Command Center).


Moving on to Plot widgets... most of the plotting work is done in the 
engine, but you will still need to supply a plotting library. Hopefully, 
you can use Highcharts for your plots in the mobile app.  We didn't have 
good luck with finding many other plotting libraries that easily did 
everything we wanted.  So, if you need to use a different plotting 
library, that's doable, but you might not be able to support all of 
NetLogo's plotting features with it.  Either way, it will require some 
effort on your part.  You will need to define a new PlotOps class/object 
for your library, which must implement the interface described here 
. 
The example PlotOps for HighCharts can be found here 
.


Once you have a PlotOps, you'll need to "shim" it into NetLogo Web. The 
shims 
 
are objects defined in Galapagos (GUI NLW) that allow Tortoise (headless 
NLW) to talk to the GUI.  There many primitives (especially in 
extensions) that require a shim function in order to work.  The 
reasoning behind this architecture is that Tortoise is headless, so it 
knows nothing about things like mouse coordinates, but, still, Tortoise 
needs to be aware of the mouse-xcor primitive and needs to be able 

Re: [netlogo-devel] Extension error

2019-04-09 Thread Jason Bertsche
Alright, looks like your build is misconfigured.  One thing that you 
might want to fix (but that isn't the source of your problem) is that 
your build is needlessly dumping out a 'lib' folder that contains 
'scala-library.jar' and 'netlogo.jar'.  That whole folder is unnecessary 
and massively increases the size of your '.jar' file.


Anyway, the source of your actual problem is where your build is putting 
the manifest file.  It is currently being placed at the root of the 
archive, as 'manifest.txt'.  Instead, that manifest needs to be placed 
at '/META-INF/MANIFEST.MF' (relative to the root of the archive).  If 
you do that, it should work.


On 4/9/19 11:36 AM, Jake Saunders wrote:
Oh sure! bare in midn the extension jsut passes a value back and forth 
currently as i have not added the full code yet.


https://drive.google.com/drive/folders/182iBcrI-zbNPGRV-7FgRCApR4Bw52Xwn?usp=sharing

On Tuesday, April 9, 2019 at 5:10:42 PM UTC+1, Jason Bertsche wrote:

Hi Jake,

Could you send the '.jar' file for your extension?

On 4/9/19 10:53 AM, Jake Saunders wrote:

Hi

I am currently trying to develop my first extension for NetLogo
and have come across a error that i cannot fix: "Bad extension
'astarpathfind': Cant find extension name in Manifest".

initially i thought this was an issues with the text file but
after experimentation i couldn't fix it.

Some context

i created the files in eclipse and built them with ant using the
NetLogo and Scala jar.

My folder contains the eclipse source files (including
dependency's), the built jar file and the manifest.

*src code files(aStarPathFind\src\aStarPathFind):*

manager.java
pathFind.java


I built my manifest file based on the example extension :

*Manifest file: *

/Manifest-Version: 1.0/
/Extension-Name: aStarPathFind/
/Class-Manager: aStarPathFind.manager/
/NetLogo-Extension-API-Version: 6.0/

please inform me if i have missed some details that are needed to
aid debugging.

Thank you for any help
Jake
-- 
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 netlog...@googlegroups.com .
For more options, visit https://groups.google.com/d/optout

<https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout=DwMFaQ=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI=bp6UgL4IUsckQvt8heHd8owem_54EflkVPEK2qWgyKU=lVJrRNlHmDKkrbssghpDZrJMhIAbXWJSDdW0j3R1HWk=>.


--
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 
<mailto:netlogo-devel+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout 
<https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout=DwMFaQ=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI=Glck4cjSsG3brEVpJHAfXpHoH5bC6S06C_Ik-BCeRYg=nBcJUnAWm4ipHHDo_ceYI9BnR-SjFUxYXmUXBR6aaWs=>.


--
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.


Re: [netlogo-devel] Extension error

2019-04-09 Thread Jason Bertsche

Hi Jake,

Could you send the '.jar' file for your extension?

On 4/9/19 10:53 AM, Jake Saunders wrote:

Hi

I am currently trying to develop my first extension for NetLogo and 
have come across a error that i cannot fix: "Bad extension 
'astarpathfind': Cant find extension name in Manifest".


initially i thought this was an issues with the text file but after 
experimentation i couldn't fix it.


Some context

i created the files in eclipse and built them with ant using the 
NetLogo and Scala jar.


My folder contains the eclipse source files (including dependency's), 
the built jar file and the manifest.


*src code files(aStarPathFind\src\aStarPathFind):*

manager.java
pathFind.java


I built my manifest file based on the example extension :

*Manifest file: *

/Manifest-Version: 1.0/
/Extension-Name: aStarPathFind/
/Class-Manager: aStarPathFind.manager/
/NetLogo-Extension-API-Version: 6.0/

please inform me if i have missed some details that are needed to aid 
debugging.


Thank you for any help
Jake
--
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 
.


--
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.


[netlogo-devel] Is is possible to remove the DOM dependency?

2019-03-30 Thread Jason Bertsche
as the engine.js currently depends on DOM components (like the 
window), it cannot run in V8 and has to embed within a CEF (Chrome 
Embedded Framework). While to remove the DOM dependency may solve it, 
I wonder if this is possible?


I don't understand.  What DOM dependencies are you referring to? I'm not 
aware of any.  Tortoise runs in GraalVM without any GUI. And we have a 
benchmarking suite that runs the Tortoise engine in V8, and it works 
fine.  Are you running into anything beyond a couple of references to 
`window`?


Is there something that we can do in Tortoise to remove the references 
to `window` and have things work both in the browser and V8?  I'm not 
actually familiar with the current suggested best practices for this.


UPDATE: Part of the problem has been solved. [...] In fact, other code 
in engine.js also calls window, but I can use a dummy window = {} to 
solve it.


Indeed.  You can do that or `var window = global;`.


I noticed that Scala.js runs extremely slow in V8 but not in Chromium.


How could that be?  Chromium runs its JS through V8.

That said, Scala.js is slow, in general.

Since we already separated between compiler and engine, and it is 
possible to run a compiled Javascript model without the compiler


Yeah, I imagine that the compiler will be ungodly slow in a mobile 
environment.  It's already impressively slow in the browser.  You might 
even be better off (for demo purposes, at least) with having the app 
make compilation requests to some server that runs the compiler and then 
sends back the JavaScript.


However, there exists a Random module in Scala.js, and I wonder if it 
is OK to replace it with pure Javascript in a separate build?


The reason that we have `MersenneTwister` in NetLogo Web at all is to 
have a fast-ish, seedable random number generator that provides 
reproducible model behavior (and that even exactly reproduces the 
behavior of models in desktop NetLogo).  If you're not worried about 
reproducible results or the `random-seed` primitive, you can just 
replace it with your own custom RNG object that makes calls to the 
standard JavaScript `Math.random` function.


The alternative being rewriting 1000 lines of `MersenneTwister`'s 
bit-twiddling Scala code into raw, bit-twiddling JavaScript code and 
hoping that there weren't any errors in the translation, which, you 
know... not a task that /I/ plan on attempting, at least.  I know myself 
well enough to know that that wouldn't go too well if /I/ tried it


Jason

John Chen wrote:


Dear All,
Thanks for your last response and I am now able to compile & run it in 
browsers. However, as the engine.js currently depends on DOM 
components (like the window), it cannot run in V8 and has to embed 
within a CEF (Chrome Embedded Framework). While to remove the DOM 
dependency may solve it, I wonder if this is possible?


Meanwhile, I noticed that Scala.js runs extremely slow in V8 but not 
in Chromium. I will investigate into it later, since I decided to move 
to CEF for now. Since we already separated between compiler and 
engine, and it is possible to run a compiled Javascript model without 
the compiler, the only required component now is the engine. However, 
there exists a Random module in Scala.js, and I wonder if it is OK to 
replace it with pure Javascript in a separate build?


In mobile platforms, where sometimes the accuracy isn't our priority, 
I guess the size and the overall performance for models will also 
improve with this variation.


UPDATE: Part of the problem has been solved. I am not familiar with 
Scala.js, but I know it works with node.js... In fact, other code in 
engine.js also calls window, but I can use a dummy window = {} to 
solve it.


--
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.


Re: [netlogo-devel] NetLogo Native error, and NetLogo 3D question

2019-01-18 Thread Jason Bertsche

Hello,

To help myself and potentially others, I have drafted a wiki to 
document the process here: 
https://github.com/dlshcbmuipmam/NetLogo/wiki/Docuent-on-building-NetLogo


Thanks for your ambitiousness in putting that together.  You mentioned a 
wiki page for making releases, but are you aware of the existence of the 
NetLogo team's document on building NetLogo from source 
?  If so, are there 
any particular shortcomings of the existing documents that you're aiming 
to improve upon in your new document?


I cannot understand why the executable NetLogo and NetLogo3D binaries 
in "NetLogo/dist/target/linux-aggregate-universal/NetLogo 6.0.4/" are 
not working, they give the error [...]


I can confirm that NetLogo 3D is not working on Linux, and that it 
hasn't worked for quite a while.  I discovered this when looking into 
your report, and consequently opened a ticket for it here 
.



Is it caused by some mysterious problems of openjdk?


That's hard to say.  We would need more information to safely conclude 
that.  I definitely had problems with launching NetLogo with OpenJDK on 
Linux many years back, but I don't know it's still problematic.  I just 
use the Oracle JDK, and things end up working fine. The NetLogo FAQ 
briefly touches upon this topic. 



I can't say that it seems likely to me, though, that OpenJDK is the 
culprit here.  I mean, it works for you when you do `java -jar 
netlogo-6.0.4.jar`, right?  What's the Java version that `java` refers 
to for your from the command line?  I wouldn't expect it to be different 
from what's used when launching the executable.


Which leads me to wonder... are you sure that both 'NetLogo' and 
'NetLogo 3D' fail?  I'm able to reproduce your error with the latter, 
but not with the former.  If the error's only with 'NetLogo 3D', I think 
the problem is just on our end, and you don't need to worry about 
conducting any further investigation.


For example, can I run NetLogo3D by adding some arguments to "java 
-jar netlogo-6.0.4.jar"? 


You can.  Documentation on this is sparse.  It's not something that we 
usually encourage people to do (for reasons that I'll cover soon).  
Messing with command line flags usually isn't necessary, because, in 
theory, the installers Just Work™.  There's some documentation about 
unofficially supported command line flags, which you can find here 
 
(but that one doesn't include how to launch NetLogo 3D).  But sometimes 
the thing you want isn't a standard command line argument, and you want 
a JVM system property instead (which also get passed in by way of the 
command line).  See this page 
 
for the list of supported JVM system properties for NetLogo (including 
the one for launching with NetLogo 3D).


Anyway, like I said, we don't encourage this sort of thing.  One reason 
for that is that it's usually not as simple as just setting one flag or 
system property and having everything work.  If you look at the old 
'netlogo-headless.sh' script 
, 
there's some stuff in the comments about what the different arguments 
you can set are. `java.library.path` is important for NetLogo 3D.  So 
copying and modifying 'netlogo-headless.sh' was how I came up with this 
as this script that /should/ launch NetLogo 3D on Linux:


```
cd "`dirname "$0"`"
java -Djava.library.path=./natives -Djava.ext.dir= -XX:MaxPermSize=128m 
-Xmx1024m -Dfile.encoding=UTF-8 -Dorg.nlogo.is3d=true -jar 
netlogo-6.0.4.jar "$@"

```

That's the correct way to do it (as far as I know), but, as I explain in 
the GitHub ticket that I linked at the beginning of this message, it 
looks like NetLogo 3D is simply broken on Linux right now, so I guess 
you'll have to wait until we put out a fix for this, try NetLogo 3D on a 
different operating system, or use one of the NetLogo 5.x releases for 
the time being.


Sorry for the inconvenience.

Jason

On 1/18/19 6:48 AM, bmuipmam dlshc wrote:

Hi everyone,

I follow the wiki page to build NetLogo 6.0.4 release. To help myself 
and potentially others, I have drafted a wiki to document the process 
here: 
https://github.com/dlshcbmuipmam/NetLogo/wiki/Docuent-on-building-NetLogo


I cannot understand why the executable NetLogo and NetLogo3D binaries 
in "NetLogo/dist/target/linux-aggregate-universal/NetLogo 6.0.4/" are 
not working, they give the error:


NetLogo Error invoking method.
NetLogo Failed to launch JVM

In the meanwhile, I can run the GUI by going to 
"NetLogo/dist/target/linux-aggregate-universal/NetLogo 6.0.4/app" and 
run "java -jar netlogo-6.0.4.jar"


Is it caused by some mysterious problems 

Re: [netlogo-devel] Controlling Netlogo 3D from Java

2018-03-28 Thread Jason Bertsche
It's possible that that documentation is a bit out of date.  It looks to 
me like `invokeLater` was moved to `org.nlogo.awt.EventQueue` 
.


On 3/28/2018 2:35 PM, blackdog.whitef...@gmail.com wrote:

Dear Seth,
I am trying to follow your suggestion and the suggesstion from Github: 
https://github.com/NetLogo/NetLogo/wiki/Controlling-API


Howeverorg.nlogo.awt.Utils.invokeLater does not have the class Utils.

I am using Netlogo 6.0.2.

Any suggestion on what to import?

public  static  void  main(String[] args) {
   org.nlogo.awt.Utils.invokeLater(
 new  Runnable() {
   public  void  run() {
System.setProperty("org.nlogo.is3d","true");
HeadlessWorkspace  workspace=  HeadlessWorkspace.newInstance() ;
try  {
  workspace.open("models/3D/Sample Models/"
+  "DLA 3D.nlogo");
  workspace.command("set wiggle-angle 70");
  workspace.command("random-seed 0");
  workspace.command("setup");
  workspace.command("repeat 50 [ go ]") ;
System.out.println(workspace.report(
"count patches with [pcolor = green]"));
  workspace.dispose();
}
catch(Exception  ex) {
  ex.printStackTrace();
}}});
}



Em terça-feira, 23 de janeiro de 2018 20:18:35 UTC-2, Seth Tisue 
escreveu:


I'm not sure if it's been tried before. I think it will probably
just work if you do:

System.setProperty("org.nlogo.is3d", "true");

before calling App.main. It's worth a try.

Seth

--
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 
.


--
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.


Re: [netlogo-devel] Status of Teletortoise...?

2017-11-29 Thread Jason Bertsche
I noticed in the /HeadlessWorkspace/ docs there is a reference to a 
/RenderInterface/ object in the constructor, is there any way to hook 
into that mechanism to generate draw events for a WebSocket connection?


Conceivably, but that sounds terrifying to me.  If you want to go that 
route, the best way to go about getting to diffs is to use 
`org.nlogo.mirror.Mirroring`.  The "mirroring" stuff generates updates 
of the viewable model state.  Look here 
<https://github.com/NetLogo/Tortoise/blob/c14974f94916b181fb312b09e1046a01fb93d67e/netlogo-web/src/test/scala/dock/DockingFixture.scala#L139> 
for an example of how we use it in the Tortoise testing infrastructure.  
To give an overview of what's going on there, Tortoise generates these 
updates as the simulation engine runs, and then we use 
`org.nlogo.mirror.Mirroring` with a headless instance of NetLogo to make 
sure that both the Tortoise/JavaScript engine and the NetLogo/JVM engine 
are generating the same view state updates. So if you follow the uses of 
`Mirroring` there, you'll see how to use it to generate and serialize 
view state updates.


Or is maybe adapting/magpie'ing from the Teletortoise codebase maybe a 
better option?


I don't recommend that, but it's /doable/.  That code was never 
particularly pleasant, it doesn't handle widgets at all, and it's now 
several years out of date (if you care about using NetLogo 6.x).  If you 
really want a web renderer, I think that using the NetLogo Web one is 
probably your best bet.  Note that the NLW renderer isn't the main 
performance bottleneck of NLW; it's the JavaScript-based simulation engine.


So... if you want a web renderer, I recently put something together that 
ran a version of Wolf-Sheep Predation without a simulation engine; it 
was just JavaScript calls that would generate view updates.  Since I 
know that it worked for that purpose, I've just torn out the Wolf-Sheep 
code, and marked where you should insert your code with "".  You can find it here 
<https://gist.githubusercontent.com/TheBizzle/01152d2d6e12bf58e9a79b6d8a01017d/raw/c1d11fbd6225a7081e1bb62c7edaf4a168e6676d/NLWHusk.html>. 
Copy the text at the linked location and save it into an HTML file.


To put this all together:

 * Set up your headless NetLogo to run the mirroring diffs every so often
 * Serialize them, and send them over a socket
 * React to messages on the socket in the "INSERT RENDERING STUFF" area
 * Use that diff data to update the variable `update` that I declared
   in the file; what's in this file is a mock of the original `Updater`
   file
   
<https://github.com/NetLogo/Tortoise/blob/c14974f94916b181fb312b09e1046a01fb93d67e/engine/src/main/coffee/engine/updater.coffee>
   (which the NLW UI looks for to find updates), and I've set things up
   here in such a way that you only need to worry about mutating that
   `update` object in order to change the visualization
 * When all of your updates have been applied into `update`, set
   `Updater._hasUpdates = true`, and the NLW renderer will then apply
   your updates to the visualization

In the 'NLWHusk.html' file that I linked, I've included a couple of 
"demo" things to help show how to modify it.  See the "" section to see how `update` is being 
manipulated to initialize the patches and world dimensions.  See the 
"" section to see where the widgets are defined.  
I got that widget JSON representation from opening up Wolf-Sheep 
Predation in NLW and doing 
`JSON.serialize(session.widgetController.widgets())`, and then doing a 
bit of manipulation of the output.  Though, obviously, the widgets don't 
work in this file, since I tore all of the WSP stuff out.


If you need the widgets to work (with variables being bound between the 
engine and the interface), that will be more work.  You'll have to do 
some messing around with things in the JavaScript.  You can get a hold 
of the widgets by running `session.widgetController.widgets()`.  The way 
to hijack the buttons is to override their widget object's `run` 
function (e.g. to send a message over the socket).


Surely, that doesn't cover all that you'll need to know, but ask more 
questions (when you run into problems), and I can provide more answers.


On 11/29/2017 12:51 PM, Robert Bates wrote:
Jason, thanks for the quick reply!  Remote desktop is not really an 
option.  I noticed in the /HeadlessWorkspace/ docs there is a 
reference to a /RenderInterface/ object in the constructor, is there 
any way to hook into that mechanism to generate draw events for a 
WebSocket connection?  Or just an event callback that is notified when 
things change in the simulation world?  Or is maybe 
adapting/magpie'ing from the Teletortoise codebase maybe a better option?


Thanks!

-Rob

On Wednesday, November 29, 2017 at 1:05:32 PM UTC-5, Jason Bertsche 
wrote:


Teletortoise is the best thing that exists for that use case, but
   

Re: [netlogo-devel] Status of Teletortoise...?

2017-11-29 Thread Jason Bertsche
Teletortoise is the best thing that exists for that use case, but the 
project was abandoned some years ago in favor of Tortoise/NetLogo Web.


Depending on exactly what you're looking for, you might be better served 
by some sort of remote login service, and use that to log into some 
machine that's running desktop NetLogo.


On 11/29/2017 12:00 PM, Robert Bates wrote:
Hi there!  First off, thanks for providing such a well-documented set 
of tools!  We're currently building a solution that requires the 
simulations to be run on the server, but want a nice web client UI for 
the simulation run as well as controls (star, stop, variable sliders, 
etc).  Our current web app is being built with Spring Boot.  I ran 
across Teletortoise, which appears to be a Play app that appears to 
have seen no activity for a while.  Could someone speak to the state 
of Teletortoise, and if there is a newer solution I should be looking 
at for server-side execution and browser-side viewer?


And yes, we've evaluated NetLogo Web, but we really need the full 
NetLogo instruction set and extensions available on the full 
Java-based implementation as well as the performance for very complex 
models.


Thanks in advance for your help!

-Rob
--
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 
.


--
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.


[netlogo-devel] Re: Controlling NetLogo from JavaScript

2017-03-24 Thread Jason Bertsche
You can use `world.observer.setGlobal` to set the variable that is linked 
to the input box.  `setGlobal` takes two arguments: (1) the variable name 
(a string), (2) the value that you want to set the global variable to. 
 After calling that, the UI will be automatically updated to show the new 
value.

On Friday, March 24, 2017 at 9:44:54 AM UTC-5, cremmler wrote:
>
> Hi!
>
> I want to use Javascript to programmatically control a NetLogo Web app. 
>
> I can use Javascript to click NetLogo buttons, to run static NetLogo code.
>
> I can use Javascript to populate NetLogo input boxes, but NetLogo does not 
> recognize the value in an input box unless I manually click the input box.
>
> I can use Javascript to populate a NetLogo input box with NetLogo code. If 
> I can get NetLogo to recognize the updated variable from the input box, 
> then I can click a button to tell NetLogo to run the code assigned to that 
> variable.
>
> Any ideas?
>
> Thanks!
>
> On Tuesday, March 25, 2014 at 11:27:46 AM UTC-5, Seth Tisue wrote:
>>
>>
>> A. Sundararajan from the Nashorn team has made this repo 
>> showing how to use NetLogo's Controlling API from JavaScript 
>> running on the JVM (specifically, using Nashorn on Java 8): 
>>
>> https://github.com/sundararajana/NetLogoNashornExample 
>>
>> It's mostly straightforward but there's a tricky bit involving 
>> classloaders that he got right so you don't have to. 
>>
>> -- 
>> Seth Tisue | Northwestern University | http://tisue.net 
>> developer, NetLogo: http://ccl.northwestern.edu/netlogo/ 
>>
>

-- 
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.


Re: [netlogo-devel] NetLogo code and running models inside Wordpress

2016-09-16 Thread Jason Bertsche
if there's a simple way to switch off the view in NLW from the code, 
we'd love to know.


Unfortunately, no, there's no simple way to do that in NLW yet.

Also, if you can think of a more standard way of doing stacked bar 
charts in NetLogo Desktop (ideally compatible with NLW), we'd love to 
hear about it. I cannot think of a simpler way to implement them.


Ah, maybe I should have been clearer.  I didn't mean to suggest that you 
had implemented the "stacked columns" thing incorrectly.  To my 
knowledge, your implementation is the best that can be done in desktop 
NetLogo.  Rather, the idea was that desktop NetLogo makes you jump 
through hoops in order to accomplish some things when plotting, and I've 
chosen a plotting solution for NetLogo Web that should eventually allow 
us to easily provide a more diverse range of plots, with far less 
hoop-jumping, but at the cost of not reproducing all of NetLogo's 
hoop-jumping abilities.


We keep on seeing silly-looking inputs in the current netlogoweb.org, 
though (for instance, in the same model that was causing the issues 
with the wrapping color arguments).


Thanks for bringing this to my attention.  The display problem was 
properly fixed, but there was an issue where not everyone was receiving 
the latest version of the page.  That latter issue has now been 
resolved, and you should no longer see tall Input widgets looking 
ridiculous.


On 09/12/2016 02:41 PM, Luis R. Izquierdo wrote:


Dear Jason,

Thank you so much for your answers and work. We really appreciate it. 
I comment on each of your points below:


With #1 (`read-from-string` support), it's not hugely far off from
being implemented, but it's also not hugely close. It's definitely
something that's on my radar and that I have made a lot of
progress on, but I would guess that it's *at least* one month
away, probably a bit more than that.


That's great, we can certainly wait.

Regarding #2 (`no-display`), yeah, that one's a long ways off.
`display` and its ilk are a huge pain to implement correctly in
the browser.  We want to implement them, but it's going to be a
bit.  With primitives like `display`, I find that the they can
usually be worked around with the stuff in NLW that currently
functions, but I'd need to see the model in order to say for sure,
one way or another.


We actually use no-display only to make the model run faster without 
having to tell the user to turn off the switch in view control (we 
don't use the view at all in many of our models). It's not big deal, 
but if there's a simple way to switch off the view in NLW from the 
code, we'd love to know.


With #3 (the stacked bar charts), I don't plan to make your
current code for that compatible with the plotting functionality
in NetLogo Web.  While having stacked bar charts is an undeniably
useful thing, your version of them in NetLogo is achieved by doing
some very non-standard stuff in desktop NetLogo, which the
plotting library we're using in NLW doesn't understand.  However,
that library /does/ know how to handle /proper/ stacked bar charts

,
so we could talk at some point about how we modify your web-based
models to tap into the proper functionality instead.


That would be awesome (or if you want to point us to an example -so we 
don't waste your time-, that's also perfect). Also, if you can think 
of a more standard way of doing stacked bar charts in NetLogo Desktop 
(ideally compatible with NLW), we'd love to hear about it. I cannot 
think of a simpler way to implement them.


Regarding the bug reported in #5, that was because `extract-rgb`,
`extract-hsb`, `scale-color`, and `shade-of?` weren't wrapping
their color arguments to keep them within [0, 140), so it broke
when it got color number that was `145`.


Thank you so much!!

That and #4 (the silly-looking Inputs) are both now fixed on
netlogoweb.org


.


We keep on seeing silly-looking inputs in the current netlogoweb.org, 
though (for instance, in the same model that was causing the issues 
with the wrapping color arguments).


Thank you for bringing both of those issues to my attention.


Thank YOU for your awesome work and the great help!
Luis


On 09/08/2016 09:41 AM, Luis R. Izquierdo wrote:

Dear Jason,

This post is about running the models inside wordpress,


2. Regarding running 

Re: [netlogo-devel] NetLogo code and running models inside Wordpress

2016-09-09 Thread Jason Bertsche

Given this, I guess the best way to proceed is:
1. To post these issues in https://github.com/NetLogo/Galapagos/issues
2. To wait a little bit for these to be solved.

Is that what we should do?


No need to worry about opening the tickets yourself.  I can handle 
that.  As for waiting, yes, I think a little bit of that is in order.  
Let's go through the items you listed.


With #1 (`read-from-string` support), it's not hugely far off from being 
implemented, but it's also not hugely close.  It's definitely something 
that's on my radar and that I have made a lot of progress on, but I 
would guess that it's *at least* one month away, probably a bit more 
than that.


An alternative—not a good one, but an alternative, nonetheless—would be 
to forego using Input widgets and `read-from-string`, and instead just 
have a global variable that users set through the Command Center.  The 
only advantage that I can think of that that solution is that it's one 
that actually works right now in NLW, despite the fact that is offers a 
clearly inferior user experience.


Regarding #2 (`no-display`), yeah, that one's a long ways off. `display` 
and its ilk are a huge pain to implement correctly in the browser.  We 
want to implement them, but it's going to be a bit. With primitives like 
`display`, I find that the they can usually be worked around with the 
stuff in NLW that currently functions, but I'd need to see the model in 
order to say for sure, one way or another.


With #3 (the stacked bar charts), I don't plan to make your current code 
for that compatible with the plotting functionality in NetLogo Web.  
While having stacked bar charts is an undeniably useful thing, your 
version of them in NetLogo is achieved by doing some very non-standard 
stuff in desktop NetLogo, which the plotting library we're using in NLW 
doesn't understand.  However, that library /does/ know how to handle 
/proper/ stacked bar charts 
, so we could 
talk at some point about how we modify your web-based models to tap into 
the proper functionality instead.


Regarding the bug reported in #5, that was because `extract-rgb`, 
`extract-hsb`, `scale-color`, and `shade-of?` weren't wrapping their 
color arguments to keep them within [0, 140), so it broke when it got 
color number that was `145`.  That and #4 (the silly-looking Inputs) are 
both now fixed on netlogoweb.org .  Thank you for bringing both of those 
issues to my attention.


On 09/08/2016 09:41 AM, Luis R. Izquierdo wrote:

Dear Jason,

This post is about running the models inside wordpress,


2. Regarding running NetLogo models: To have a NetLogo engine
inside the book, so everything works even if NetLogo changes too
much for our code. (And potentially be able to change the css of
NetLogoWeb slightly, to make running models fit better with the
rest of the e-book, e.g. fig.1 at
http://ccl.northwestern.edu/2016/WeintropEtAlConstructionism2016-1.pdf
)

Okay, got it.  Do you already know all of the models you want to
use?  I primarily ask because I want to know if NetLogo Web can
already do everything you want to be able to do in your book, or
if it makes sense to hold off on this plugin until some feature or
another is implemented.


We have tried to run all the models we have implemented so far, and 
these are the issues we have encountered so far:


1. read-from-string is not supported in NetLogo Web so far.
We need a way to allow the user to input lists (or, more generally, a 
list of lists). Currently we do this with an input box and 
“read-from-string”, but this reporter is not implemented in NetLogo 
Web yet.


2. no-display is not supported in NetLogo Web so far. (not big deal)

3. The display of (temporary) pens in bar mode which overlap each 
other is not dealt adequately in NetLogo Web yet (see pictures 1-*.png 
attached).


4. The appearance of input boxes is not dealt adequately in NetLogo 
Web yet (see "payoffs" input box in pictures 2-*.png attached).


5. We have one particular model (attached) which runs fine in Netlogo 
Desktop, but throws the following error in NetLogo web:


"A type error has occurred in the simulation engine. More information 
about these sorts of errors can be found here 
.
Advanced users might find the generated error helpful, which is as 
follows:

*ref is undefined*"

Given this, I guess the best way to proceed is:
1. To post these issues in https://github.com/NetLogo/Galapagos/issues
2. To wait a little bit for these to be solved.

Is that what we should do?
Thank you so much for all your help!


Re: [netlogo-devel] Calculation Continues Even after Model Stopped Running (Floating-Point Problem?)

2016-09-09 Thread Jason Bertsche
If you are tracking this value in a Monitor widget, the Monitor will 
continually recalculate its value, to make sure that it's up-to-date 
(since, for example, it's entirely possible that something was typed 
into the Command Center that would render the Monitor's value outdated).


On 09/09/2016 11:51 AM, Phang wrote:

Hi Jason,

Thanks so much for your explanation. It is very helpful for me as I 
can better understand what's going and heave a sign of relief that it 
is not a coding problem on my part, which I was wondering. (rookie 
modeler here...).


May I ask one question, which might also be a bit simple.

Given that the simulation has stopped (even when tick is at zero after 
initialization), why is it that we see resulting value of the 
floating-point operation still constantly changing. Is it because even 
after the model has stopped, the model is actually still running, and 
hence the iteration continues?



Great appreciation,

Phang









On Friday, September 9, 2016 at 11:09:03 PM UTC+8, Jason Bertsche wrote:

While perhaps surprising at first glance—I know it caught me
off-guard the first time I saw it—this is working as expected. 
I'll explain why.


When you query a patchset (or any agentset), those queries are run
on the patchset in a random iteration order.  So `[self] of
(patch-set (patch 0 0) (patch 0 1))` will sometimes result in
`[(patch 0 0) (patch 0 1)]`, and, other times, will result in
`[(patch 0 1) (patch 0 0)]`.  That is the first component of the
problem.

Now, on to the second component: IEEE floating point math. The
IEEE standard is followed for representing floating point numbers
in essentially every significant programming language.  However,
one of the nuances of the IEEE representation is that the order in
which operations are applied matters.  Usually, you don't start to
see this until you have a very precise number (i.e. with a lot of
digits after the decimal point).  For example, here's a brief
session I just did in the Haskell REPL:


ghci> let x = 0.01
ghci> let y = 0.094
ghci> let z = 0.03
ghci> x * y * z
2.82e-53
ghci> y * z * x
2.8194e-53


Humbug.  Let's ask Scala:


scala> val x = 0.01
x: Double = 1.0E-18

scala> val y = 0.094
y: Double = 9.4E-18

scala> val z = 0.03
z: Double = 3.0E-18

scala> x * y * z
res0: Double = 2.82E-53

scala> y * z * x
res1: Double = 2.8194E-53


Okay, enough with the weird languages.  Let's ask a mainstream
language; let's ask JavaScript:


jjs> var x = 0.01
jjs> var y = 0.094
jjs> var z = 0.03
jjs> x * y * z
2.82e-53
jjs> y * z * x
2.8194e-53


Welp... at least they're all consistently wrong.

As it turns out, this otherwise unexpected (and, frankly,
mathematical law breaking) behavior is, for example, why many
people urge avoiding floating point numbers

<https://urldefense.proofpoint.com/v2/url?u=http-3A__stackoverflow.com_a_3730040_5288538=CwMFaQ=yHlS04HhBraes5BQ9ueu5zKhE7rtNXt_d012z2PA6ws=sxGjFFyk2A6rYHwAdDtnqeTKj3cEcXDGDo_G9va2ruI=UJIbYwNnMHzzX0An8VO5WIX1w6dpTngCNi-bkb9HB5U=FMSrUhE3i_5gwaHpkvaDbN-DGx955ey8djeBwHCx-h0=>
for representing amounts of money in software; sometimes, little
bits of money here or there just disappear.

So what we have is that patchsets are iterated over randomly, and
the order in which math operations are applied matters. 
Therefore, it is predictable, then, that asking the same agentset

to perform the same mathematical operations multiple times will
sometimes lead to very, very slightly different results.

As for solutions to this problem, indeed, using `precision` is a
way to deal with it.  Another option would be to sort the values
before averaging them, since that would lead to a consistent
ordering of the numbers, and, therefore, a consistent order of
mathematical operations.

On 09/08/2016 10:26 PM, Phang wrote:


Dear All,

I have a persistent problem that some of you might have
encountered and I am hoping if there could be some that could
help me.

I am developing a relatively simple Cellular Automata. Model runs
fine except when I ask patches to calculate mean (or even sum) of
more than 8 neighbors. The problem appears that the decimal
points usually 10th decimal place onwards keeps changing (EVEN)
after simulation has stopped running! As a matter of fact, when I
calculate mean just after initialization (therefore only SETUP,
but before GO) at tick = 0, I would get constantly-changing
values for the calculation output. This is quite weird to me and
I have tri

Re: [netlogo-devel] NetLogo code and running models inside Wordpress

2016-09-06 Thread Jason Bertsche
The main issue is that -ideally- we would like the e-book to be as 
self-contained as possible


Ah.  That point about self-containment hadn't occurred to me for some 
reason, but that makes a lot of sense.


1. Regarding the colouring of code: The javascript library, or to have 
a method that, in the end, produces "a string of raw HTML" 
(potentially with a CSS, if that is easier for you), so the colouring 
of code does not depend on external websites.


Okay, I've now made such a thing.  You can download it here 
<https://github.com/NetLogo/highlight-nl/releases/download/v0.1.0/highlight-nl.zip>, 
and you can find its nature and usage explained here 
<https://github.com/NetLogo/highlight-nl#highlight-nl>. Essentially, 
include the CSS file and the JS file on your page, and then, from 
JavaScript, just call the function returned by `require('highlight-nl')` 
to convert your string of NetLogo code into a string of 
syntax-highlighted HTML.


That said, I just made this thing and haven't given it a huge amount of 
love yet.  It did fine with a basic test, but you'll be the first (and 
maybe only) person using it, so it's possible that there might be bugs 
with it.  If you run into any problems with it, feel free to let me know 
here or on the issue tracker attached to the GitHub repository linked above.


2. Regarding running NetLogo models: To have a NetLogo engine inside 
the book, so everything works even if NetLogo changes too much for our 
code. (And potentially be able to change the css of NetLogoWeb 
slightly, to make running models fit better with the rest of the 
e-book, e.g. fig.1 at 
http://ccl.northwestern.edu/2016/WeintropEtAlConstructionism2016-1.pdf) 


Okay, got it.  Do you already know all of the models you want to use?  I 
primarily ask because I want to know if NetLogo Web can already do 
everything you want to be able to do in your book, or if it makes sense 
to hold off on this plugin until some feature or another is implemented.


On 09/01/2016 12:13 PM, Luis R. Izquierdo wrote:

Dear Jason,

Thank you so much for your extremely helpful reply. The main issue is 
that -ideally- we would like the e-book to be as self-contained as 
possible, i.e. we would like the models in the book (and the colouring 
of the code) to work even if future versions of Netlogo make changes 
that imply the old code would not work (e.g. the use of + to 
concatenate strings before NetLogo 4.0).


Because of that, our preference would be:
1. Regarding the colouring of code: The javascript library, or to have 
a method that, in the end, produces "a string of raw HTML" 
(potentially with a CSS, if that is easier for you), so the colouring 
of code does not depend on external websites.
2. Regarding running NetLogo models: To have a NetLogo engine inside 
the book, so everything works even if NetLogo changes too much for our 
code. (And potentially be able to change the css of NetLogoWeb 
slightly, to make running models fit better with the rest of the 
e-book, e.g. fig.1 at 
http://ccl.northwestern.edu/2016/WeintropEtAlConstructionism2016-1.pdf)


Another option would be to have iframes for everything, making sure 
that the links work as expected. This approach is great for webpages, 
but maybe not so great for an ebook, which at the end of the day is a 
book, and should have a stable, permanent edition at some point.


To be honest, we can see pros and cons in both approaches (especially 
regarding running models), so we would love to hear your comments (and 
most likely to adopt your advice).


Thank you so much for your help,
Luis

On Thursday, 1 September 2016 11:25:27 UTC-5, Jason Bertsche wrote:

Hello,

Thanks for your interest in a NetLogo Web-powered e-book.  I think
that sounds awesome!

(Also, sorry for my delay in responding.)


Is writing two wordpress plugins the best approach to achieve
what we need?, or can you think of a better way of doing these
two tasks?


Well, the syntax highlighter is something that I'm not sure could
even reasonably be done without us supplying that for you. 
However, I'm supportive of seeing these things implemented, so I'm

fine with helping out with that.


1. One that would take NetLogo code as text and would format it
exactly as it looks in NetLogo, including colours (like in the
"NetLogo Code" tab of NetLogoWeb)


How do you want this to work, though?  Do you want to hit a URL on
our site in order to make the highlighting happen, or do you want
a JavaScript library that you can drop into your page?  Do you
want a string of raw HTML back that you drop into your page?  Do
you just want to query our server for a syntax-highlighted page
that you embed through an `iframe`?  Something else?

Honestly, the `iframe` option is what is seeming the most feasible
to me at the moment.  I feel like I could put that together pretty
quickly, but l

[netlogo-devel] Re: add guidance in new code tab

2016-07-18 Thread Jason Bertsche
Hi Alan,

Due to a recent change in our mailing list procedures, we're trying to 
restrict netlogo-devel to only topics about how to accomplish certain 
development tasks with NetLogo (e.g. modifying the NetLogo source code, or 
implementing a NetLogo extension).  We would prefer that discussions about 
suggestions and desired features be sent to 
ccl-feedb...@ccl.northwestern.edu instead.  As such, I'm going to lock this 
thread and forward your suggestion to the ccl-feedback list (with you 
CCed), where this idea will be considered and discussed.

Thanks,
Jason

On Sunday, July 17, 2016 at 6:18:55 PM UTC-5, Alan Isaac wrote:
>
> I am wondering if it might be useful to add two comments to a new code 
> tab: Declarations Section, and Procedures Section.
> These would be separated by a few blank lines.
>
> It seems a harmless way to remind students that declarations must come 
> before procedures.
>
> fwiw,
> Alan
>
>

-- 
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.


[netlogo-devel] Re: How can I porting my Netlogo model to the phone (Android, iOS)?

2016-03-19 Thread Jason Bertsche
Have you tried your model on netlogoweb.org ?

On Saturday, March 19, 2016 at 4:38:36 AM UTC-5, Jing Han wrote:
>
>
> Hi,
>
> I have written my Netlogo model for an ABM and it requires the user to use 
> mouse to control one of the agent in the model. It runs well on my computer.
>
> Now I want to build an APP for phone, so that users can use their finger 
> to control the agent of this model. 
>
> But I don't know how to do? Is there a simple way to build a phone app 
> from my netlogo model? Or I have to re-write the model using other 
> languages? If so, which language is the best? Python or Java? I know C and 
> Visual Basic.Would you give me some advices? 
>
> Thank you very much!
>
> HJ
>

-- 
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.


[netlogo-devel] Google Summer of Code 2016 Applicants

2016-03-01 Thread Jason Bertsche

Hi everyone,

It is, indeed, true that we were accepted into the Google Summer of Code 
(GSoC) program for this year.  We're grateful for this and really 
looking forward to it.  Also, it's exciting to see all the interest that 
people have expressed about applying to projects of ours.  However, I'd 
like to avoid filling the netlogo-devel mailing list with statements of 
interest, so I'm requesting that people avoid posting GSoC application 
stuff to the list.  Instead, if you have questions about GSoC projects, 
my preferred place to discuss them is in the public channel that I've 
now set up for this on Gitter, which is the NetLogo/GSoC channel 
<https://gitter.im/NetLogo/GSoC>.  There, I'll be happy to field any 
questions that you might have about the various projects.


Other than that, student applications open up in a couple of weeks, and 
that will be everyone's opportunity to formally declare their interest 
in working on NetLogo, and what projects they would like to contribute 
to.  Guidelines for what we would like to see in proposals are covered 
on our organization page 
<https://summerofcode.withgoogle.com/organizations/6083632867311616/>.


Regards,
Jason Bertsche

--
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.


[netlogo-devel] Re: NetLogo Web Use Logging

2016-01-13 Thread Jason Bertsche
No official support for anything like that currently exists, but this ends 
up not being too tough to do in a simplistic way, with just a little custom 
JavaScript. For example, I ran this to make my widgets print the X and Y 
coordinates to the console whenever they're clicked:

```
[].forEach.call( // Can't call `forEach` directly on the fake array that 
comes out of `document.getElementsByClassName`
  document.getElementsByClassName("netlogo-widget"), // All widgets have 
this CSS class
  function(widget) {
var logIt = function() { console.log(window.event.clientX, 
window.event.clientY); };
widget.onclick = logIt;
  })
```

Similarly, when I set `logIt` to `function() { 
console.log($(widget).text()); }`, it printed out the text/label of the 
widget that was clicked.

Obviously, none of these behaviors is precisely what you're looking for, 
but hopefully this helps in showing how you can get the logging information 
you want out of your models.

On Wednesday, January 13, 2016 at 4:37:26 PM UTC-6, David Quigley wrote:
>
> Hey all, I'm looking to try and track use of my NetLogo Web simulation. Is 
> there currently an action logging aspect built into NLW, or an easy way to 
> report out activity? I can always just augment my own hosting to record 
> clicks (right now I host my simulations remotely), but my current best plan 
> is to log X/Y positions and do post-hoc mapping to activities, which sounds 
> like a headache. If I can listen for some sort of action flags or even just 
> automatically create a mapping between X/Y position and action there, that 
> would be very helpful.
>
> Thanks!
>

-- 
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.


Re: [netlogo-devel] starting NetLogo from Clojure

2015-12-17 Thread Jason Bertsche
To do that, you want to call the static method `org.nlogo.app.App.main` 
.


On 12/17/2015 02:21 AM, s wrote:


I am trying to startup a NetLogo model from Clojure. I can achieve 
this using "headless workspace" based on the example provided at 
https://github.com/NetLogo/NetLogo/wiki/Controlling-API but I want to 
open a model with its UI.


Can anyone please?

S.

--
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.


--
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.


[netlogo-devel] Re: Pass NetLogo table to my own extension?

2015-12-08 Thread Jason Bertsche

>
> Can I pass one of the other type constants in Syntax.scala to 
> Syntax.reporterSyntax() in my definition of getSyntax() ?
>

Yes.  `table:get` returns an object of `WildcardType` [source 
],
 
so you should be able to take a table as an argument by specifying the 
argument to be of `WildcardType`.

The second problem is that Argument doesn't have a getter for 
> tables (again, of course), but it looks like I can just use Argument.get(), 
> so that's not a problem.
>

Right, you can just do `Argument.get` and then cast it to the type you're 
expecting.

On Tuesday, December 8, 2015 at 1:35:12 PM UTC-6, Marshall wrote:
>
> I'd like to pass a hashtable made with the table extension to a reporter 
> defined in my own extension.
>
> For the standard simple way of creating extension, the first problem is 
> that Syntax doesn't have a type constant for tables.  (Of course; why would 
> it?)  Can I pass one of the other type constants in Syntax.scala to 
> Syntax.reporterSyntax() in my definition of getSyntax() ?  (I don't fully 
> understand the code defining the various versions of getSyntax() in 
> Syntax.scala.)
>
> The second problem is that Argument doesn't have a getter for tables 
> (again, of course), but it looks like I can just use Argument.get(), so 
> that's not a problem.
>
> If there's an easy answer, great.  If it's pretty complicated (e.g. I have 
> to add a file to the NetLogo source and recompile it), it might not be 
> worth the trouble (and you don't have to explain!).  I can just pass a list 
> of lists to my extension function; it's not essential that I use a 
> hashtable, but I'd prefer that.  There are only 172 entries.
>
> Thanks!
>

-- 
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.


[netlogo-devel] Re: How to create LogoList from Java Collection

2015-12-03 Thread Jason Bertsche
The relevant methods for this can be seen here 
.
 
 Essentially, think of these as static methods on the `LogoList` class. 
 The one you want is probably `LogoList.fromJava`, which takes a Java 
`Iterable` as an argument.

On Friday, December 4, 2015 at 12:15:05 AM UTC-6, Marshall wrote:
>
> I'm writing a small extension, in Java, that include a function that 
> passes a NetLogo list of numbers to a Clojure function, returning a NetLogo 
> list of numbers.  
>
> I'm able to pass the NetLogo list (an org.nlogo.api.LogoList, right?) 
> into Clojure.  Clojure code then treats the LogoList as a normal Clojure 
> sequence of  Doubles (because LogoList implements the Java Collection 
> interface, I assume, and Clojure sequence operations work on Collections).
>
> However, I haven't figured out how to make a LogoList from a Collection, 
> or from a Java array (easy to make in Clojure), or from something else that 
> I know how to make.
>
> I looked at the scaladoc and the source for LogoList and LogoListBuilder, 
> but I don't know Scala, and attempting to create a LogoList based on my 
> guesses and experiments hasn't been successful.
>
> Thanks very much for any tips.
>
> Marshall
>

-- 
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.


Re: [netlogo-devel] add a `sequence` primitive?

2015-08-11 Thread Jason Bertsche
I've had a realization that maybe point #2 isn't entirely a 
showstopper.  The reasoning being that the argument/first-class value 
impedance mismatch in NetLogo is actually already a limitation of tasks 
(e.g. `(run (task [crt ?1 ?2]) 1 [ pen-down ])` does not compile), so 
adding an `apply` that works with the existing first-class values—while 
not consistent with the language as a whole—/would be/ consistent with 
the current power of tasks.


On 08/11/2015 12:28 AM, Jason Bertsche wrote:

Is there any sympathy for this?


There is; I agree that this is a desirable thing to have in the 
language.  However, I fear that the addition would be far from 
trivial, unfortunately.  Here some big issues that I see with 
implementing this primitive:


*1) Primitives are not first-class values in NetLogo*

I don't know what the opposition is to the proposal in the ticket that 
Seth linked, but if it involves not wanting to use tasks, this first 
item should demonstrate why this problem essentially /has to//be/ 
solved with tasks.


First, we should decide what our hypothetical syntax for this 
primitive should be.  Maybe something like this:


`apply first [apples] ; should give us a`

This would be problematic in the current version of NetLogo, because 
this would be interpreted as `apply (first [apples])` which is 
presumably an error, or maybe results in `apples`—either way, 
something undesirable. NetLogo's parsing rules mean that we would need 
new syntax for converting a primitive into a first-class primitive of 
some sort.  Maybe something like this:


`apply (first) [apples]`

This syntax has the benefit of seeming consistent in a way with stuff 
like `first (word apples oranges) bananas`, where the 
parentheses tell the primitive (`word`) to stop gobbling up terms and 
treating them as arguments.  However, this would create parsing 
problems in the case of something like `apply (no-turtles) []`, since 
`(no-turtles)` is already a perfectly valid NetLogo expression.


We could try this:

`apply [first] [apples]`

Might NetLogo get confused, trying to treat `[first]` as a list 
literal?  Maybe.  Should the argument be forced to be a command 
block/reporter block instead?  If so, then we probably need an `apply` 
*and* an `apply-report`, for command blocks and reporter blocks, 
respectively.  But that's still a problem, because command 
blocks/reporter blocks can't take arguments, so they seem like the 
wrong fit for this problem.  Should we change them to take arguments?  
Or do we add yet another meaning for the square brackets, specifically 
for `apply`?


Maybe we could invent some totally new syntax for this (and somehow 
not break old models, by using characters for this syntax that already 
aren't acceptable characters to have in a NetLogo identifier—few as 
they are), but, even if a good syntax were devised that wouldn't break 
old models, the NetLogo code currently doesn't really have an internal 
notion for a first-class primitive.  Adding such a notion to NetLogo 
would take a pretty large amount of work, and it's probably a bad 
change to make, overall, given how many first-class code types 
already exist internal to NetLogo.  Instead, I think it makes a lot 
more sense for `apply` to work solely on tasks.  This brings us to the 
other big problem I see.


*2) Not all primitive arguments are actually first class values
*
That might seem like a paradoxical statement, but I can assure you 
that there's truth in what I've said!


A demonstration:

`apply (task [crt]) [1]`

So far, so good.  `1` is totally a first-class value.

Ah, but `crt` can take a second argument.  Let's try that out:

`apply (task [crt]) [1 [ pen-down ]]`

Okay, now we're in trouble.  `crt`'s second argument is a command 
block.  Command blocks aren't first-class; they can only be passed to 
certain primitives, and they can't be stored in `let`s or put into 
lists.  The same goes for reporter blocks and reference types (like 
what `uphill`/`downhill` take as arguments), as well as boolean 
blocks (like the second argument to `all?`), and number blocks 
(like the second argument to `max-one-of`).


This situation is looking very daunting to me.  One solution would be 
to make those things first-class values, but it sounds terrifying to 
me to change so many of these old, edge-casey, crufty types all into 
first-class values, and there has definitely been a push in recent 
years to /move away from/ that scary conglomeration of different block 
types, rather than do anything to embrace it.


The correct solution to this, I think, is probably to tear all of the 
reference type and x block stuff out of NetLogo altogether, and 
replace all instances of those with tasks. Tragically, though, this 
leaves us with a proposal that appears to make sense—though other 
holes could probably be poked in it—but that would require quite a bit 
of time to implement.


So... I'd be interested to see `apply` make it into the language at 
some

Re: [netlogo-devel] add a `sequence` primitive?

2015-08-10 Thread Jason Bertsche

Is there any sympathy for this?


There is; I agree that this is a desirable thing to have in the 
language.  However, I fear that the addition would be far from trivial, 
unfortunately.  Here some big issues that I see with implementing this 
primitive:


*1) Primitives are not first-class values in NetLogo*

I don't know what the opposition is to the proposal in the ticket that 
Seth linked, but if it involves not wanting to use tasks, this first 
item should demonstrate why this problem essentially /has to//be/ solved 
with tasks.


First, we should decide what our hypothetical syntax for this primitive 
should be.  Maybe something like this:


`apply first [apples] ; should give us a`

This would be problematic in the current version of NetLogo, because 
this would be interpreted as `apply (first [apples])` which is 
presumably an error, or maybe results in `apples`—either way, 
something undesirable. NetLogo's parsing rules mean that we would need 
new syntax for converting a primitive into a first-class primitive of 
some sort.  Maybe something like this:


`apply (first) [apples]`

This syntax has the benefit of seeming consistent in a way with stuff 
like `first (word apples oranges) bananas`, where the parentheses 
tell the primitive (`word`) to stop gobbling up terms and treating them 
as arguments.  However, this would create parsing problems in the case 
of something like `apply (no-turtles) []`, since `(no-turtles)` is 
already a perfectly valid NetLogo expression.


We could try this:

`apply [first] [apples]`

Might NetLogo get confused, trying to treat `[first]` as a list 
literal?  Maybe.  Should the argument be forced to be a command 
block/reporter block instead?  If so, then we probably need an `apply` 
*and* an `apply-report`, for command blocks and reporter blocks, 
respectively.  But that's still a problem, because command 
blocks/reporter blocks can't take arguments, so they seem like the wrong 
fit for this problem.  Should we change them to take arguments?  Or do 
we add yet another meaning for the square brackets, specifically for 
`apply`?


Maybe we could invent some totally new syntax for this (and somehow not 
break old models, by using characters for this syntax that already 
aren't acceptable characters to have in a NetLogo identifier—few as they 
are), but, even if a good syntax were devised that wouldn't break old 
models, the NetLogo code currently doesn't really have an internal 
notion for a first-class primitive.  Adding such a notion to NetLogo 
would take a pretty large amount of work, and it's probably a bad change 
to make, overall, given how many first-class code types already exist 
internal to NetLogo. Instead, I think it makes a lot more sense for 
`apply` to work solely on tasks.  This brings us to the other big 
problem I see.


*2) Not all primitive arguments are actually first class values
*
That might seem like a paradoxical statement, but I can assure you that 
there's truth in what I've said!


A demonstration:

`apply (task [crt]) [1]`

So far, so good.  `1` is totally a first-class value.

Ah, but `crt` can take a second argument.  Let's try that out:

`apply (task [crt]) [1 [ pen-down ]]`

Okay, now we're in trouble.  `crt`'s second argument is a command 
block.  Command blocks aren't first-class; they can only be passed to 
certain primitives, and they can't be stored in `let`s or put into 
lists.  The same goes for reporter blocks and reference types (like 
what `uphill`/`downhill` take as arguments), as well as boolean blocks 
(like the second argument to `all?`), and number blocks (like the 
second argument to `max-one-of`).


This situation is looking very daunting to me.  One solution would be to 
make those things first-class values, but it sounds terrifying to me to 
change so many of these old, edge-casey, crufty types all into 
first-class values, and there has definitely been a push in recent years 
to /move away from/ that scary conglomeration of different block types, 
rather than do anything to embrace it.


The correct solution to this, I think, is probably to tear all of the 
reference type and x block stuff out of NetLogo altogether, and 
replace all instances of those with tasks. Tragically, though, this 
leaves us with a proposal that appears to make sense—though other holes 
could probably be poked in it—but that would require quite a bit of time 
to implement.


So... I'd be interested to see `apply` make it into the language at some 
point, but my main concern here is the resource cost. Furthermore, would 
all the effort that would go into implementing this really be worth it 
for how much the userbase benefited from it?—I think that's another good 
question to have answered before tackling the addition of `apply`.


On 08/10/2015 09:42 PM, Alan Isaac wrote:

On Monday, August 10, 2015 at 6:59:01 PM UTC-4, Seth Tisue wrote:

see also https://github.com/NetLogo/NetLogo/issues/539

Re: [netlogo-devel] What are the plans for 3D NetLogo and the web?

2015-07-29 Thread Jason Bertsche
While it's something that we're interested in, we have no actual plans 
for it at the moment.


On 07/29/2015 09:56 AM, Ken Kahn wrote:

If there are plans how long will it take?

Best,

-ken
--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] Netlogo Web Standalone Model Speed

2015-07-17 Thread Jason Bertsche

Some things that can lead to poor NLW performance:

 * Having lots of agents
 * Having lots of plots
 * Having lots of… anything
 o Someone once said, “Less is more.”  Another person once said,
   “More is more.”  I think both sides make some pretty good
   points.  I don’t really know what “less is more” /means/, but if
   it makes your model better, I highly encourage you to follow
   that policy.
 * Making a lot of tiny movements when a single one would suffice (e.g.
   |ask turtle 0 [ repeat 100 [ jump 1 ] ]| vs. |ask turtle 0 [ jump
   100 ]|)
 o The reason for this being that NLW generates update objects for
   each drawable change in model state.  Serializing lots of
   updates and then reading and applying them to draw the new world
   state… turns out to be somewhat costly in terms of performance
   (though great in many other regards).
 * Checking equality a lot (e.g. |=|, |=|, |=|, |!=|)
 o The NLW equality procedure is a total CPU hog, and I hate it,
   and I think I can fix it to not be so awful, but I’ll need some
   time on that
 * Making a lot of RNG draws (e.g. calling |ask| or |n-of| a bunch)
 * Standard CS optimization stuff (e.g. O(n^2) algorithms, using the
   wrong data structure for the task at hand, or iterating over the
   same collection for the same information many, many times, etc.)

The model isn't openly available in this mailing list thread, but David 
sent me a copy, and I noticed a few things.  Namely, it initially sets 
|pcolor|s on a bunch of patches, and then almost never changes the 
|pcolor|s, but, several times per tick, calls things like |count 
(patches with [pcolor = yellow or pcolor = dark-green])|.  This behavior 
is computationally costly, and it turned out to be unnecessary to 
recompute those patchsets so often, so I just cached the yellow patches 
and green patches in variables, and it resulted in a pretty noticeable 
speedup.


It looked to me like the number of patches was artificially reduced so 
as to keep performance under control, and that was a step in the right 
direction, but I think the important thing to keep in mind is that 
repeatedly recomputing those patchsets is going to be costly no matter 
how many patches you have (assuming that number is greater than 0).


Ultimately, though, in the original model, equality-checking and patch 
variable lookups were the blaring klaxons that made themselves known in 
the profiler results (eating up close to 40% of the CPU with just those 
two things).  Caching the patchsets helped to eliminate a lot of those 
lookups and equality checks, but I suspected that an even greater 
performance boost could be gotten by, instead of doing branching logic 
by asking patches things like |if pcolor = yellow or pcolor = green [ 
... ]|, skipping the equality-checking on |pcolor| and using patch-level 
booleans for |green?|, |brown?| and |yellow?|.  This isn’t /elegant/, 
per se, but I suspected that it would be faster than looking up |pcolor| 
repeatedly and running equality checks on it.


Having implemented that change in the model, indeed, equality-checking 
went from eating up 33% of CPU in the original model, to 19% in the 
version with the “cached patchsets” version, and 0.5% in final version. 
Average-case results for running the model for 100 ticks:


 * Original: 28s
 * Just caching patchsets: 10.6s
 * Both optimizations: 6.6s

The moral of the story: Death to equality-checking.

On 07/15/2015 01:21 PM, David Quigley wrote:

I need some help with improving speed for Netlogo Web models. Any 
suggestions? Details below.


We're working on a project to build simulations for HS Biology 
lessons. Students are using these simulations in the classroom in a 
manner similar to a typical experimental process. The Wolf Sheep 
Predation sample model is very similar to one of our models, though 
many of the others are more complex (though of a similar structure).


For these lessons, we need to strike a balance between robustness, 
realism, and speed. Unfortunately, in tests with students in the 
classroom, we found that the speed is a hindrance to completing the 
task, especially for a complex model.


I'm using the Create Standalone tool to export my original Netlogo 
simulations to the JS implementation and simply saving those files. 
For my personal speed tests, I'm just running them locally.


The students are running the simulations on the Samsung Chromebook 
(XE303C12-A01US) from the native Chrome web browser. The simulations 
are hosted on our website so the students have access.


For ease of discussion, we'll simply talk about the Wolf/Sheep 
Predation model for speed improvement tips.


What I've done:
 - Ensured I only loop through each turtle once (previously I was 
doing multiple iterations for each tick, and that was SLOW)

 - Simplified the turtle behaviors as much as possible
- I have tried removing different behaviors one at a time to see 
if any are 

Re: [netlogo-devel] install bug?

2015-06-09 Thread Jason Bertsche

Similar to the poster of this bug, my student's user account is in a different 
language (Japanese).


I can confirm that we've seen this bug reported for the NetLogo Windows 
installer a few times before, and, every time, it seems to come from a 
machine where the system language uses a non-ASCII character set (e.g. 
Chinese, Russian, Japanese).  While annoying, changing the system 
language seems like a likely workaround.


On 6/9/2015 8:44 AM, Frank Duncan wrote:

My guess is that this is the same (good find) but since we just use the
default install4j package, alternatives are hard to come by.

Other than installing netlogo from source, or grabbing the linux
installation and putting together your own script, there's not a lot of
options.  Someone else on list may know of one that I don't, though.

Frank

On Tue, Jun 09, 2015 at 06:11:32AM -0700, Alan Isaac wrote:

I am teaching a summer course in a couple weeks, and I am very concerned
that a student preparing for this course ran into an installation problem.
  It seems to match the following bug report, in that it produces the same
install4j report of inadequate disk space when there is plenty.
http://stackoverflow.com/questions/24807204/install4j-insufficient-disk-space-error
Similar to the poster of this bug, my student's user account is in a
different language (Japanese).

Is this a known problem for NetLogo installation?
If so, what is the status of this problem, and what alternatives can I
offer incoming students?
For the moment I have instructed the student to create another account in
English and retry the install.

Thanks,
Alan Isaac

--
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.


--
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.


Re: [netlogo-devel] Re: Tortoise: where are the models compiled to JS

2015-04-26 Thread Jason Bertsche
Well, it’s not necessarily true that a given NetLogo model will even 
have |setup| and |go|. Even so, the code for compiling NetLogo 
procedures into JavaScript code lives in the *Tortoise repository* (here 
https://github.com/NetLogo/Tortoise/blob/4ec73a487c3f8dc6f3583c0e588491511f81e0aa/src/main/scala/Compiler.scala#L54-L62). 
Neither |go| nor |setup| is given any special treatment there. You can 
make changes to the Tortoise compiler at the place that I linked, but 
it’s not straightforward to get your new Tortoise |.jar| file into 
Galapagos. However, I would be able to help you with that if that’s what 
you want to do.


Maybe it you’d just prefer an easier solution, though. It isn’t elegant, 
but maybe you could add something like this to the end of the JavaScript 
for the standalone pages:


|__go = go;
go = function() {
  __go();
  sendMyWebSocketStuff();
};

__setup = setup;
setup = function() {
  __setup();
  setupWebSocket();
};
|

This way, you can essentially enhance the |setup| and |go| calls without 
having to really mess with the compiler and building new Tortoise artifacts.


On 4/26/2015 1:28 AM, Oscar Martinez wrote:


Hi Jason,

I saw that piece of code, but what I'm looking for the piece of code 
where Galapagos compiles the netlogo model (.nlogo file), because I 
would like to add some web socket instructions to function as Go 
ot Setup.


Thanks,

On Saturday, April 25, 2015 at 11:12:32 PM UTC-6, Oscar Martinez wrote:

Hi,

I have been investigating about Galapagos/Tortoise, because my
idea it's to connect two different session of Tortoise through Web
Sockets. By the moment, I have gotten take a pre-compiled model
and modify it to have two different sessions using NodeJS. I also
have a local intance of Galapagos, running and generating savable
JS tortoise models.

The new step in my project is to modified the JS code generated by
Galapagos to add my custom code, automatically. But, I haven't
found where the .nlogo code is compiled. I have checked the scala
files, and I pretty sure it's near of
models.ModelCollectionCompiler in line 36
CompiledModel.fromNlogoContents(contents).map(ModelSaver(_)),
but I haven't understand exactly what's next.

Kind regards,

--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] Re: Tortoise: where are the models compiled to JS

2015-04-26 Thread Jason Bertsche

   The workaround of “_go” could be a good idea, but the problem is
   that I couldn’t have the list of all the mapped functions from
   netlogo to javascript (right?).

I'm not seeing the problem.  I guess it would help me to know what you 
wish to do with this list of mappings.


If you went here 
https://github.com/NetLogo/Galapagos/blob/master/app/models/ModelSaver.scala#L25-L30 
and added a line that said |val nlToJSIdentMap = 
compiledModel.procedures.map { case (name, _) = name - 
org.nlogo.tortoise.JSIdentProvider(name) }|, that would create you a map 
of (capitalized) NetLogo procedure names to the names that the 
procedures will be given in the output JavaScript. Does that help with 
the problem?


   At the begining I tried to refresh every “view action” to try to
   have the instances of model synchronized. I didn’t get it, because I
   didn’t know exactly what to change to make it work.

The periodic updates of the GUI occur here 
https://github.com/NetLogo/Galapagos/blob/master/app/assets/javascripts/TortoiseJS/control/session-lite.coffee#L41-L58.


On 4/26/2015 11:52 AM, Oscar Martinez wrote:

Oh, I see. Now I understand it. My idea was to add websockects code to 
the pre-compiled functions of netlogo files, but based on what you say 
is not 100% good idea (it's not easy to get it).


The workaround of _go could be a good idea, but the problem is that 
I couldn't have the list of all the mapped functions from netlogo to 
javascript (right?).


May be the best option it's to change where to put the websockets 
code. At the begining I tried to refresh every view action to try to 
have the instances of model synchronized. I didn't get it, because I 
didn't know exactly what to change to make it work.


Thanks,

On Saturday, April 25, 2015 at 11:12:32 PM UTC-6, Oscar Martinez wrote:

Hi,

I have been investigating about Galapagos/Tortoise, because my
idea it's to connect two different session of Tortoise through Web
Sockets. By the moment, I have gotten take a pre-compiled model
and modify it to have two different sessions using NodeJS. I also
have a local intance of Galapagos, running and generating savable
JS tortoise models.

The new step in my project is to modified the JS code generated by
Galapagos to add my custom code, automatically. But, I haven't
found where the .nlogo code is compiled. I have checked the scala
files, and I pretty sure it's near of
models.ModelCollectionCompiler in line 36
CompiledModel.fromNlogoContents(contents).map(ModelSaver(_)),
but I haven't understand exactly what's next.

Kind regards,

--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] Tortoise: where are the models compiled to JS

2015-04-25 Thread Jason Bertsche
I think the easiest way to accomplish what you’re trying to do is to 
modify this block of code 
https://github.com/NetLogo/Galapagos/blob/master/app/controllers/CompilerService.scala#L159-L192. 
For example, if you create a JavaScript file in your local repository at 
|/public/javascripts/apples.js| (or create a CoffeeScript file at 
|/app/assets/javascripts/apples.coffee|), and then add a line in this 
file between lines 185 and 186 that says |javascripts/apples.js|, the 
generated standalone pages will include the code from your |apples.js| file.


On 4/26/2015 12:12 AM, Oscar Martinez wrote:


Hi,

I have been investigating about Galapagos/Tortoise, because my idea 
it's to connect two different session of Tortoise through Web Sockets. 
By the moment, I have gotten take a pre-compiled model and modify it 
to have two different sessions using NodeJS. I also have a local 
intance of Galapagos, running and generating savable JS tortoise models.


The new step in my project is to modified the JS code generated by 
Galapagos to add my custom code, automatically. But, I haven't found 
where the .nlogo code is compiled. I have checked the scala files, and 
I pretty sure it's near of models.ModelCollectionCompiler in line 36 
CompiledModel.fromNlogoContents(contents).map(ModelSaver(_)), but I 
haven't understand exactly what's next.


Kind regards,
--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] Re: NetLogo/HubNet Web Application

2015-03-04 Thread Jason Bertsche
Teletortoise http://li425-91.members.linode.com:9000/remote works; 
it’s maybe just not immediately apparent how to use it. After you select 
the model to run, press your “tab” key to leave the “Chatter” context 
and move into the “Observer” context. Then, you can type standard 
NetLogo commands (e.g. |setup|, |go|) to affect the model.


As for some additional commentary on whether to base your work on 
Teletortoise or on Tortoise… to me, your task sounds substantially 
easier to achieve in Teletortoise than in Tortoise, but I could see why 
a Tortoise-based approach might seem more enjoyable or interesting. 
There are tradeoffs.


Teletortoise is basically already the refined NetLogo desktop 
application, and the “allowing multiple people to all talk to the same 
model” problem has mostly already been addressed in Teletortoise. 
However, it lacks a proper UI, and changing the code requires some 
knowledge of Scala and the Play Framework. It’s also worth pointing out 
that Teletortoise has not really been touched much by us since the 
initial version of it was created about 2 years ago.


If you use Tortoise, you can probably recycle most/all of the interface, 
and you can use JavaScript and Node (which I would expect you to be more 
comfortable with), but you’ll also need to write all of the HubNet 
communication functionality yourself (which strikes me as a pretty 
substantial task). Furthermore, Tortoise lacks a fair number of the 
NetLogo language primitives (for example, it has support for exactly 0 
of the |hubnet-*| primitives), and Tortoise has not yet reached the 
phase in its development where it is concerned with making it easy for 
other people to extend the functionality.


Hopefully that the information provided here (and earlier in the thread) 
can help you to best choose the option that most appeals to you for your 
project.


On 3/4/2015 10:01 PM, Oscar Martinez wrote:

The problem is that I haven't seen the existing Teletoirse working. 
What I can see in demo page it's a black screen for any model that I 
select and the text intructions in right side. Is it fine?


Does the existing Teletortoise supports users interaction? (sorry, I 
do the question because I haven't see it working)


Thanks,

As I suggested earlier, I think it would be easier to base your 
solution off of the existing Teletortoise stuff


On Wednesday, January 28, 2015 at 11:36:25 PM UTC-6, Oscar Martinez 
wrote:


Hi,

For an university project, I want to create a NetLogo/HubNet
client based on Web technology. I'm not talking about a web client
(I know that it exists), I'm talking about a web applications,
where the user can access to the simulations of NetLogo/HubNet
using only a web browser, with no downloads or configurations. It
make sense? Any idea where I can start?

Thanks,

--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] current-directory (enhancement request)

2015-03-03 Thread Jason Bertsche

Is there a reason for the absence of a `current-directory` primitive?


I guess I would turn the question around here and ask if there's a 
compelling reason for the presence of such a primitive.  It's not 
obvious to me what good it would really do to know where a model was 
launched from and why the model's behavior should change based on that.



If not, can it be added?


My initial inclination is that this sort of thing is fringe enough that, 
if you wanted it, it would be best provided by an extension. I could be 
convinced that I'm wrong.


Is there an practical use case that you have in mind for this primitive?

On 03/02/2015 03:54 PM, Alan Isaac wrote:
Is there a reason for the absence of a `current-directory` primitive?  
If not, can it be added?


Today I was walking students through some basic file manipulation at 
the command line, and one asked me how to determine his current 
directory.  The best suggestion I could come up with was to set it 
explicitly with `set-current-directory`.  (I did not want to discuss 
the `shell` extension.)


Thanks,
Alan Isaac
--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] documentation bug? file-open

2015-03-03 Thread Jason Bertsche
That looks to me like a bug on our part, but... I think this is 
particular to the Windows version that you're running.  The meaning of 
/ in Windows has changed over time, and, judging by the styling of 
that window, it looks like you're running an older version of Windows.  
Is that Windows 95, or 98?


It would help to see the information listed in your Help = About 
NetLogo = System.


On 03/03/2015 11:41 AM, Alan G Isaac wrote:

On 3/3/2015 12:28 PM, Jason Bertsche wrote:
Hmm... that's not the behavior that I experience on my machine.  The 
leading slash goes to the root of the current drive for me, which is 
the standard

Java behavior for files on Windows.




I'm attaching a screen shot.
Alan



--
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.


Re: [netlogo-devel] Java Extension in-depth Tutorial/API. Extracting value from breeds' variable

2015-02-27 Thread Jason Bertsche
There generally isn’t better documentation for writing extensions than 
just the Extensions API wiki page you linked or the source code itself. 
In this case, you’re trying to do the very thing that an existing 
NetLogo primitive does, so you can get the answer from the primitive’s 
source code. The code for getting a breed variable can be found here 
https://github.com/NetLogo/NetLogo/blob/5.x/src/main/org/nlogo/prim/_breedvariableof.java#L45.


On 2/27/2015 10:34 AM, matt...@udel.edu wrote:


Hello,

I have been searching and cannot find a tutorial that explains basic extension 
API.

I have seen: https://github.com/NetLogo/NetLogo/wiki/Extensions-API and 
http://ccl.northwestern.edu/netlogo/docs/scaladoc/ (though this is scale...I 
would think that there would be explanations of the functions).

Is there better resources?

I would like to know how to extract the value of a specific agent's variable. 
The getVariable function requires a number(the index of the variable in the 
variables array). I need to know how to obtain the index of the variable:

AgentSet agents = ...
Agent agent = ...
int someIntValue  = 
Integer.valueOf(agent.getVariables(agent.world().breedsOwnIndex(agents, 
some-variable)));

This seems too complicated for such a simple task.

Thank you
-Matt


​

--
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.


Re: [netlogo-devel] Jump to definition and Depend

2015-02-24 Thread Jason Bertsche

Makes sense to me.

On 02/20/2015 10:38 PM, Frank Duncan wrote:

This is an interesting conundrum.

For reference, see the code at
https://github.com/NetLogo/NetLogo/blob/modelruns/src/main/org/nlogo/editor/Actions.scala#L46-L51

This code works as you'd like, regardless of whether you're in the main
editor window or some other editor such as the command center.  The
mechanism by which it does this by firing off an event saying
hey, jump to this arbitrary definition.

The problem is that the editor and its associated menus are banned from
using Events by the depend.ddf by virtue of the fact that the editor
should remain in isolation of the rest of the UI at compile time.
Because the command line is an editor, when you attempt to jump to
definition without raising a global event, it attempts to jump to the
definition within the command line itself.  Because there is no
definition within the line you just made, we run into a problem.  This
holds true for other editors for which we would want to include the
ability to jump to the definition, and switch tabs to do it.

So what to do?

My inclination is to take ui events and make them a top level concept.
That means any action anywhere in the UI could potentially raise any
event and cause some kind of global action to be taken.

That's my inclination because I can't really think of another way to
have the command center force a tab switch while having it's editor and
associated menu completely self contained at compile time.

Frank



--
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.


Re: [netlogo-devel] interface bug: __includes

2015-02-20 Thread Jason Bertsche
Yeah, it wouldn't be a terribly difficult change to make.  I've updated 
the ticket to suggest that as a minimal change.


On 02/20/2015 01:44 PM, Alan Isaac wrote:
Wouldn't it be trivial to activate the Includes button in the 
presence of `__includes []` instead of requiring `__includes 
[arbitrary string]`?  This change alone would be worth something.


Just asking ...

Thanks for taking this seriously.


--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] Netlogo HPC CPU Load Increment

2015-02-20 Thread Jason Bertsche

I'm not really familiar with computing clusters, HPC, or qstat, but...

You're using the format argument -g c.  If you search this manual page 
http://gridscheduler.sourceforge.net/htmlman/htmlman1/qstat.html for 
the line Cluster Queue Format (with -g c), you'll end up in the 
section that describes what each of these columns means.  Here is the 
entry for 'CQLOAD':


an average of the normalized load average of all queue hosts.  In 
order to reflect each hosts different significance the number of 
configured slots is used as a weighting factor when  determining 
cluster queue load. Please note that only hosts with a np_load_value 
are  considered for this value. When queue selection is applied only 
data about selected queues is considered in this formula.  If the  
load value is not available at any of the hosts '-NA-' is printed 
instead of the value from the complex attribute definition.


So I think it's basically the average CPU load on each machine in the 
cluster.  I'm guessing that the number is in the interval [0, 1], rather 
than [0, 100].  If this assumption of mine is correct, your 'CQLOAD' 
value already seems appropriately large to me.



I wish to know can I increase the CQLOAD for my simulations


This seems like an odd thing to ask for.  You want NetLogo to use up 
more of the machine's CPU?  It's not apparent to me how you could do 
that in a way that would accomplish anything.  What exactly is it that 
you want us to help you achieve?


On 02/20/2015 06:07 AM, Abhishek Bhatia wrote:

|
#!/bin/bash
#$ -N r20p
#$ -q all.q
#$ -pe mpi 24
/home/abhishekb/netlogo/netlogo-5.1.0/netlogo-headless.sh \
--model /home/abhishekb/models/corrected-rk4-20presults.nlogo \
--experiment test \
--table /home/abhishekb/csvresults/corrected-rk4-20presults.csv
|
I submit jobs using headless NetLogo to a HPC server by the following 
**code**:


#$ -N r20p
#$ -q all.q
#$ -pe mpi 24
/home/abhishekb/netlogo/netlogo-5.1.0/netlogo-headless.sh \
--model /home/abhishekb/models/corrected-rk4-20presults.nlogo \
--experiment test \


Below is the **snapshot** of a cluster queue using:

|
qstat -g c
|

http://i.stack.imgur.com/WUYhn.png



I wish to know can I increase the CQLOAD for my simulations and what 
does it signify too. I couldn't find an elucidate explanation online.


I don't know if it is apt question 
http://stackoverflow.com/questions/28628527/netlogo-hpc-cpu-load-increment 
for dlevel. Please correct if me otherwise.

--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] interface bug: __includes

2015-02-20 Thread Jason Bertsche
Well, if it makes us seem like less-bad people, I could point out that 
the manual explicitly states 
http://ccl.northwestern.edu/netlogo/5.0/docs/interface.html#includes, 
 *Caution:*The includes facility is new and experimental... despite 
the fact that the feature was introduced nearly 7.5 years ago.  But 
surely it's not /us/ who are at fault, right?  The manual has our back 
on this one!


Joking aside, we can agree that the user experience for this feature is 
positively obnoxious.  I can see why it's frustrating, and /I/ 
definitely wouldn't want to be someone who had to tell people they 
could/should make use of this functionality.  It doesn't look like the 
functionality ever really evolved past the demo stage, despite being a 
relevant thing that solves a real problem for NetLogo users.  I've 
opened a ticket here https://github.com/NetLogo/NetLogo/issues/710 in 
our issue tracker and provided some comments on the matter.


For the sake of setting expectations clearly, I'd like to point out that 
us getting a fix for this into 5.2, is almost certain *not* to happen, 
since 5.2 is already slated for a release in the not-too-distant future.


On 02/19/2015 02:50 PM, Alan Isaac wrote:
I can almost understand the decision not to include the Includes 
button in the default Code tab interface.


But i. it was a mistake and ii. the current interface (5.1) is almost 
unusable.


First, to fix the mistake: put the button there, but disable it until 
the `__includes` keyword is added to the Code tab.


Second, consider the recommended approach to first creating a `.nls` 
file for a model, which as far as I can tell

has not changed since 2010:
http://netlogo-users.18673.x6.nabble.com/Using-includes-td4869749.html

I'm currently teaching with NetLogo, and it is just appalling to have 
to explain this situation to students.
So even if the developers disagree with me about it being a mistake to 
remove (rather than disable) the
`Includes` button from the default interface, please fix for 5.2 the 
interface for creating a new `.nls` file.


Most important: `__includes []` should activate the button.  (It 
currently does not.)


Almost as important: when a .nls tab is open, File  SaveAs should 
prompts for saving that file,
*NOT* the model file (as it currently does).  This is really confusing 
to students.


I'm reporting this now because we went over .nls files today in class, 
and students we really

puzzled by the interface.

Thanks,
Alan Isaac

--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] agentsets with repeats?

2015-02-06 Thread Jason Bertsche

I agree.

On 02/06/2015 01:55 PM, Bryan Head wrote:

I think that's a great idea for an extension.

On Fri Feb 06 2015 at 1:53:52 PM Marshall marsh...@logical.net 
mailto:marsh...@logical.net wrote:


On Friday, February 6, 2015 at 12:39:59 PM UTC-6, Jason Bertsche
wrote:


Does it complicate the NetLogo language, though, if agentset
primitives knew how to deal with agentbags.  Maybe there's
something I'm not seeing.


Bags and sets are two things that you can use very similarly,
but they can lead to very different behavior in a model.  If
someone is writing code that deals with bags and sets, there
will be cognitive overhead to keeping track of which variables
hold which of the structures (i.e. agentsets or agentbags),
and knowing the difference between the two structures, and
knowing when to use which structure.  Not saying that it's the
end of the world, but I think added cognitive overhead is
something that's important to take into
consideration—especially in a language like NetLogo that aims
to have a low barrier to entry.

Regarding debugging, if you're in a situation where you think
you have an agentset but truly have an agentbag (or vice
versa), figuring out why your model is misbehaving might not
be so easy.  In fact, you might never realize at all!  I think
the reason that this isn't currently a problem in NetLogo is
because all of the NetLogo collections—all two of them, plus
those provided by extensions—use a very noticeably different
set of primitives.  There's some overlap in the vocabularies
of lists and agentsets, but not a whole lot.


Yeah, I see what you're saying.  Those are really good points.

So I suppose that NetLogo is trying to satisfy two poles of a
continuum: the entry level people, and experienced modelers.  And
one of the beautiful things about it is that it does both well for
a broad range of kinds of models, thus allowing for an easy
learning path from one end to the other.  For its target modeling
domains, nothing does better at this tradeoff.  Maybe the high
end is pushing on NetLogo to develop more flexibility, recently. 
  (I'm not really at the high end--more like the middle.)  If

NetLogo became difficult to learn, then someone would have to
invent a new modeling tool that was easier.

Putting aside all questions about ease of implementation,
complexity of code, etc., hypothetically, maybe a good strategy
would be to introduce agentbags only through an extension, with
replacements for agentset commands, such as bag:ask, which don't
work with agentsets  That way no one will use bags except when
they really want them, and the bag: prefix will make the
difference obvious.  If you want to apply these commands to an
agentset, you would have to convert it to a bag with a command
like bag:turtle-bag. It would be nice if turtle-set would convert
turtlebags
to turtlesets.  And if there were an equality predicate that could
tell you that an agentset and an agentbag had exactly the same
members.  Not saying this is easy

--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] agentsets with repeats?

2015-02-06 Thread Jason Bertsche
We've definitely discussed the idea of bag/multiset support in NetLogo 
before, but, as was already noted in this thread, it would be a 
substantial thing to introduce.  In this particular situation, it seems 
like the use case for multisets is not terribly difficult to work 
around, but I'd be interested to hear about other cases in which people 
might find multisets useful.  If there's enough need for it, multiset 
support could /possibly/ be added, but my intuition is that the need 
didn't seem to arise in the first 15 years of NetLogo's history, so what 
would cause it to arise now?  I suspect it might also be opposed on 
grounds of complicating the language.  Either way, I think it's an 
interesting idea worth discussing.


On 02/06/2015 11:18 AM, Bryan Head wrote:
Glad you think that will work for you. I should note that if you want 
to reproduce the random ordering behavior of `ask` and `with`, just 
put `shuffle` before `agent-list`. For instance `foreach shuffle 
agent-list [ ... ]` and `map [...] shuffle agent-list`. You'll take a 
performance hit, but then they will behave more like the agentset 
primitives, and you won't see artifacts cropping up from using the 
same order every time.


On Fri Feb 06 2015 at 11:11:13 AM Marshall marsh...@logical.net 
mailto:marsh...@logical.net wrote:


Thanks Bryan--That's a good solution.  Hadn't thought of it. 
(Seems obvious, now!)  I'll probably do that.  And I appreciate

knowing that uniqueness is deeply embedded in the nature of agentsets.

Roman, you're right--I should have called that what I was
proposing an agentmultiset.


On Friday, February 6, 2015 at 10:30:05 AM UTC-6, Bryan Head wrote:

Hi Marshall,

Writing you're own ask-procedure that operates on lists could
be a pretty easy workaround. For instance:

to ask-list [ agent-list commands ]
  foreach agent-list [ ask ? [ run commands ] ]
end

which you then call like:

ask-list agents-with-repeats task [ do-stuff ]

Where `agents-with-repeats` is your list of agents. Note the
`task` primitive is unfortunately required. Besides that, this
should pretty much be a drop-in replacement for `ask` after
you switch to using a list. `of` could be similarly transformed:

to-report of-list [ agent-list reporter ]
  report map [ [ runresult reporter ] of ? ] agent-list
end

Called like: of-list agents-with-repeats task [ turtle-variable ]

 Now `with`:

to-report with-list [ agent-list predicate ]
  report filter [ [ runresult reporter ] of ? ] agent-list
end

Called like: with-list agents-with-repeats task [
turtle-variable = 5 ]

Besides reordering arguments and requiring `task`, these
should pretty much be drop-in replacements for their agentset
counterparts. As you said, the uniqueness of agents in
agentsets is quite baked in.

Hope that helps!
Bryan

On Fri Feb 06 2015 at 10:00:48 AM Marshall
mars...@logical.net wrote:

A model I'm working on includes a series of functions that
implement a random choice of turtles that will send
messages to another turtle.  Recently, I decided it might
be better to allow the selection of senders to be random
with repeats.  Nicolas Payette's rnd extension
https://github.com/NetLogo/Rnd-Extension provides a
convenient function that provides this functionality,
returning a list that may contain
repeats:|||weighted-n-of-with-repeats|. (Thanks Nicolas!)

However, converting a list of turtles with repeats into a
turtleset loses the repeats; agentsets contain only unique
elements.  So if I want to allow repeats in the turtles
that send messages, I have to rewrite a small but
significant bit of code in different functions, replacing
ask's with loops, etc.

Question: Might it be useful to allow a new kind of
agentset that allows repeats?  It would be useful to me in
this situation, but I know that the idea violates
longstanding assumptions about agentsets, and I suspect
that it would also require a lot of changes to the NetLogo
source to implement.

I thought I'd raise it as a question, anyway, to see what
others think.
-- 
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.


For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google


Re: [netlogo-devel] Actor model of concurrency (Akka) in multi agent simulation software (NetLogo)

2015-02-04 Thread Jason Bertsche
I've actually thought about concurrency in NetLogo a fair amount. As for 
the pitfalls...—they're complicated.  I'll  ramble and explain a bit.


First of all, this would be a pretty fundamental change to the language, 
so one of the pitfalls is that, in order to even have a chance of 
getting a good speed-up out of this change, I think we would need to 
spend a lot of time on overhauling the existing NetLogo code to operate 
in this way.  On top of that, this added level of complication—that is, 
model state changes passing through an actor system—I would expect to 
greatly complicate the core NetLogo code, further increasing the 
already-substantial maintenance burden for future core NetLogo 
development work.




The complications do not stop there, though; there are much more 
practical problems at hand.  I'm not going to provide any proof of these 
claims here, but here are some assumptions of mine:


1. The cases where one most desires to parallelize NetLogo are those
   involving large agentsets
2. The vast majority of `ask` operations in NetLogo change world
   (global) state (e.g. agent positions/variables)
3. In a substantial percentage of the cases where `ask` is used, the
   outcome depends on the global state (e.g. positions/variables of
   other agents)

On top of those three premises, agents in `ask` blocks can change the 
global state in a way that affects all of the other agents in the 
agentset that is being `ask`ed (e.g. modifying a global variable, moving 
towards/away from another agent).  This makes parallelization 
difficult.  The typical actor-based solution to this problem might be to 
hide the world state within an actor (or, in the style of C or plain 
Java, you might use resource locks on world state), but, since pretty 
much every agent is going to have to spend time waiting on the world 
state to be available for reading or writing, I would expect that you 
wouldn't get a very substantial speed up—possibly even a /slowdown/ in 
many cases, because of the concurrency overhead!—from this approach.  
The results depend on that contents of the `ask` block, but I have 
severe doubts that typical models would see much speedup from this sort 
of concurrency, and the functionality would come at the cost of hundreds 
of hours of lost development time over the years, I would expect, 
because of the way in which it would have to tangle itself up in the 
guts of the core NetLogo code.  So that particular approach doesn't seem 
very good to me, especially because it hasn't really solved the problem 
of all the agents trying to change the global state simultaneously.




Let's not give up hope, though; this isn't the only way to approach 
concurrency in NetLogo.  Software transactional memory (STM) is a style 
of concurrency that takes a cue from the database world, treating 
concurrent actions as transactions upon the global state that can be 
rolled back if some conflict arises in the global state.  One could 
imagine this being applied to `ask` operations.  A student at Utrecht 
University created a NetLogo-like program (HLogo) that performed 
concurrency through STM and wrote his Master's thesis 
http://dspace.library.uu.nl/handle/1874/284708 on this very topic.  I 
actually wouldn't be surprised if the author of the paper reads this 
board and might have something to say on the matter.  Regardless, on 
this topic, he concluded this:


Execution results show that HLogo is faster than NetLogo for most 
cases, particularly where the number of agents stay low. When the 
agent population grows as to produce significant number of STM 
conflicts, the performance of HLogo considerably drops.


If you look at the results in Section 4.4 of his thesis, you'll see that 
the performance really does drop off quite noticeably as the number of 
agents increases—dropping off to the point of being a substantial speed 
/regression/ in comparison to standard NetLogo.  Unfortunately, though, 
the case where we lots of agents is *the very case* we want concurrency 
to help us out with!  My view on the matter is that STM is inherently 
incapable of being able to solve this problem; using STM for thousands 
of concurrent operations that are each almost certain to conflict and 
cause a rollback is merely going to lead to what is essentially just a 
sequential processing of the agentset (but with a ton of concurrency 
overhead).


On top of that, the STM approach also jettisons another thing that 
NetLogo holds dear: reproducible results.  That is, in NetLogo, you can 
use the `random-seed` to set the model's random seed, and running the 
same simulation with the same seed will consistently yield the same 
results.  However, with STM, the completion order of the transactions is 
non-deterministic, so STM also fails to meet NetLogo's reproducibility 
goals, as well.  With that, it looks like we'll need yet another approach.




After thinking about it a bit, we might conclude that the global state 
is the 

Re: [netlogo-devel] Re: NetLogo/HubNet Web Application

2015-02-02 Thread Jason Bertsche

Oscar,

I interpreted your original message as being about creating something 
like Teletortoise, which is, as Seth described, where the model runs on 
the server but displays [in the browser].  Creating a Teletortoise-like 
thing by yourself is much more feasible than creating something like 
Tortoise by yourself, because creating something where the simulation 
runs entirely in the browser requires reimplementing the entire 
simulation engine and the backend of the compiler, whereas Teletortoise 
mostly just involves writing a thin client and a bit of server code.  We 
haven't done a whole lot of work on Teletortoise ourselves, but here 
http://li425-91.members.linode.com:9000/client?username=Guest it is in 
action.


You can find the webapp code for both Tortoise and Teletortoise here 
https://github.com/NetLogo/Galapagos/tree/master/app in Galapagos 
(though I think we really need to separate them out into two entirely 
different repos at some point).  Folders named remote refer to code 
that is only for use in Teletortoise, local for Tortoise-only stuff, 
and core for things that are used by both of them.  (The naming scheme 
is both poor /and/ my own doing.)



Any idea where I can start?


I would start by creating some web application project in a JVM language 
(e.g. Java, Scala, Clojure) that depends upon this artifact 
https://bintray.com/netlogo/NetLogoHeadlessMaven/netlogoheadless/5.2.0-bb89cae/view, 
which is a version of NetLogo that runs without any GUI.  The artifact 
is accessible through the URL given and through BinTray's JCenter 
repository.  If you're using Maven, this page 
https://gradle.org/docs/current/userguide/dependency_management.html#sub:maven_jcenter 
explains how you can configure Maven to add JCenter as a place from 
which to pull down dependencies.


Once your project's infrastructure is set up, I recommend looking at the 
files in this package 
https://github.com/NetLogo/Galapagos/tree/master/app/models/remote/workspace 
and this package 
https://github.com/NetLogo/Galapagos/tree/master/app/models/core.  
Probably the best starting points for your code are this 
https://github.com/NetLogo/Galapagos/blob/master/app/models/remote/NetLogoController.scala#L129-L138 
(which sets up the workspace) and this 
https://github.com/NetLogo/Galapagos/blob/master/app/models/remote/workspace/StateTracker.scala#L36-L40 
(which gets the model state updates from the workspace so you can send 
them to the client for display).  If you're working on your project and 
want to do something with your running NetLogo workspace and you don't 
know what it's really capable of, I suggest looking at the code that is 
used for the artifact. Here 
https://github.com/NetLogo/NetLogo-Headless/tree/bb89caec2ee73a1db394c9055d00380f88c500f6 
is a link to all of the code in that artifact, and here 
https://github.com/NetLogo/NetLogo-Headless/blob/bb89caec2ee73a1db394c9055d00380f88c500f6/src/main/workspace/AbstractWorkspace.scala 
is a link to `AbstractWorkspace` in particular, which has all sorts of 
juicy information for you to chew over.


Hopefully you find this information helpful in getting started with your 
project.


On 1/29/2015 11:22 AM, Seth Tisue wrote:

On Thu, Jan 29, 2015 at 12:36 AM, Oscar Martinez
oscar.martinez.m...@gmail.com mailto:oscar.martinez.m...@gmail.com 
wrote:

 For an university project, I want to create a NetLogo/HubNet client based on
 Web technology. I'm not talking about a web client (I know that it exists),
 I'm talking about a web applications, where the user can access to the
 simulations of NetLogo/HubNet using only a web browser, with no downloads or
 configurations. It make sense? Any idea where I can start?

NetLogo Web (aka Tortoise) is already in pretty good shape:
https://github.com/NetLogo/NetLogo/wiki/Tortoise 
https://github.com/NetLogo/NetLogo/wiki/Tortoise
Lots of models in the NetLogo Models Library work already; you can try 
them out at
http://li425-91.members.linode.com:9000/create-standalone 
http://li425-91.members.linode.com:9000/create-standalone

In Tortoise, the simulation runs entirely on the client.

See also Teletortoise, where the model runs on the server but displays 
on the client. (As for the HubNet aspect, the intent is that 
Teletortoise will serve as the basis for a future of HubNet. so a lot 
of the groundwork has already been laid. but actual development work 
on a new HubNet hasn't started.)


Seth
--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 

Re: [netlogo-devel] Tortoise In-browser authoring

2015-02-02 Thread Jason Bertsche
I saw In-browser authoring [...] and was wondering if you could 
expand on it a bit or point me to where I can learn more.  Is the goal 
for the web-based authoring tool to eventually be like the java client 
authoring with the interface and code tabs?


Basically, yeah.  In terms of authoring, we currently have the Interface 
and Code tab content displaying (off in the hidden crevices of 
Galapagos), plus editable code in the Code tab.  Our near-term goals are 
to add good support for the Command Center and for saving models.  
Sometime down the line, we'll also add support for things like 
adding/editing/removing widgets and probably the Shapes Editor and other 
miscellaneous tools from desktop NetLogo.



When can we start using it?


It's still very much a work in progress.  We have a strong preference 
towards people outside the CCL essentially only using the Create 
Standalone tool 
http://li425-91.members.linode.com:9000/create-standalone for the time 
being.  The other stuff on Galapagos is not really officially 
supported at the moment.


To answer the actual question, though, the web-based authoring 
environment will be released for public consumption when Tortoise has 
it's first official release (sometime in the coming months). Until then, 
we suggest (to the extent possible) authoring your models in the desktop 
version of NetLogo and then converting them into Tortoise models through 
the Create Standalone tool.


On 02/02/2015 12:27 PM, Hiroki wrote:

Hi NetLogo Developers,

I saw In-browser authoring on this page 
https://github.com/NetLogo/NetLogo/wiki/Tortoise-year-3 and was 
wondering if you could expand on it a bit or point me to where I can 
learn more.


Is the goal for the web-based authoring tool to eventually be like the 
java client authoring with the interface and code tabs? When can 
we start using it? We have several people interested in authoring 
Tortoise models and will help with testing the tool.


Thanks,
Hiroki
--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] Accessing Netlogo (2D) from Eclipse

2015-01-27 Thread Jason Bertsche
I'm not sure that I understand the request, or maybe I lack the 
sufficient amount of vision to see where this is going, but this doesn't 
strike as something that's very feasible.  First off, writing a model in 
Java and then using NetLogo simply to visualize the model seems 
impractical to me.  The problem here is that NetLogo's engine internals 
are intertwined with the display code. That is, the structures that are 
used in the engine for calculating new model states are the same ones 
that the NetLogo View uses to figure out what to display; to my 
knowledge, you cannot cause a display update in NetLogo without 
modifying the engine's data structures.  (This is a problem that we 
fixed in the browser-based version of NetLogo that's in the works, but 
this statement is not helpful here.)


Consequently, in order for you to use NetLogo to visualize your model, 
you basically either need to find a way to map each of your Java 
modeling commands to the equivalent NetLogo API call, or you need to 
write your model entirely in NetLogo API calls.  But... Java is clearly 
not a good language for writing agent-based simulations models; this is 
/why/ we provide the NetLogo programming language, which is designed to 
make it easier for people to create models.  If you're writing an 
agent-based model and you're willing to use NetLogo to visualize the 
model, why not just write the model entirely in NetLogo?


Along those lines, why do you need to use Java at all?  Is it really 
offering you something that NetLogo isn't?  If the answer really, truly 
is an emphatic YES!, then maybe consider writing an extension 
https://github.com/NetLogo/NetLogo/wiki/Extensions-API.  With NetLogo 
extensions, you can define your own NetLogo primitives that call out to 
Java/Scala code (even code in third-party libraries).  I would expect 
that there wouldn't be a whole lot of code for your simulation that's 
better expressed in Java than in NetLogo, and you shouldn't be surprised 
to learn that maybe someone has already written a NetLogo extension that 
runs that extra Java code you were planning on writing, so you don't 
actually need to write any Java, yourself.  Maybe.


Does all this make sense?  Am I misunderstanding your goal in some way?

On 01/26/2015 05:29 AM, kinsuk sinha wrote:


Hi,

I am using Eclipse Luna (4.4.1) to write an agent based model. And, I 
would like to visualize this model in Netlogo (2D). Coding in Java is 
relatively new for me and hence I dont know all the specific details I 
need to address to achieve the objective. Could you guys please let me 
know how to proceed forward?

Many Thanks..!!!

Regards
Kinsuk
--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] Hi I want to know the ways to be able to use Hangul in Netlogo code window.

2014-10-09 Thread Jason Bertsche
I can't say this is really a recommended thing to do, but... there are a 
couple of ways to do it, and both involve changing essentially the same 
file.  If you download the source code of NetLogo and look at 
'resources/system/tokens.txt', or open the 'NetLogo.jar' of your 
existing NetLogo installation and find the file 'system/tokens.txt' 
(making sure to reinsert this file into 'NetLogo.jar' after you've 
changed it), you will see many rows of text in the following format:


```
'C' or 'R' NetLogo code equivalent primitive class under the hood
```

For example:

```
C create-turtles _createturtles
```

The 'C' is because it's a command—'R' is for reporters. `create-turtles` 
is the NetLogo code that we type to run this primitive in the NetLogo 
application.  `_createturtles` is the primitive class that the NetLogo 
internals will use to represent the instruction.


We can, of course, edit this file to use whatever names we want for 
those primitives by swapping out the middle term for one of our 
choosing.  So I added this line to the file:


```
C schaffen-sie-schildkröten _createturtles
```

and now, after recompiling the code and launching NetLogo anew, I can 
create 5 turtles by running `schaffen-sie-schildkröten 5`.


Note that this won't change any existing models to display their 
`create-turtles` calls as `schaffen-sie-schildkröten` calls. There's not 
really an easy way to do that, short of writing some sort of script that 
goes into '.nlogo' files and translates the code.


On 10/08/2014 10:27 PM, 신대용 wrote:

I think, maybe this problem is surprisingly simple.
am i wrong??

please teach me about it...

--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] Gettting the GUI Matrix

2014-10-07 Thread Jason Bertsche
You might look at the HubNet Web Extension 
https://github.com/NetLogo/HubNet-Web-Extension for some inspiration.


On 10/06/2014 11:54 PM, oscar.martinez.m...@gmail.com wrote:

Hi,

For an university project, we want to create an API over HTTP to connect 
different kind of clients with the NetLogo/HubNet server. In the first phase, 
we want to have only-view clients. The first step is to know if is it possible 
to extract ta GUI Matrix (the screen with objects and colors) to send that 
information to other clients using HTTP.

In my first-fast research, I can see some example in the guide Controlling 
API that makes me think that is possible, but I would like to know what do you 
think about it. By the moment, I will continue researching.

Thank you,



--
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.


Re: [netlogo-devel] scope bug for `run`?

2014-10-07 Thread Jason Bertsche

From the documentation on `run`:

Tasks may freely read and/or set local variables and procedure inputs. 
Trying to do the same with strings [via `run`] may or may not work and 
should not be relied on.


On 10/07/2014 02:48 PM, Alan Isaac wrote:

|
to go
  let test 0
foreach[0][
settest 0;works fine
run set test 0;raises error
]
end
|

Is this behavior desirable (and if so, documented)?

Alan Isaac
--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] Command Conflicts between Netlogo and R-extension

2014-09-18 Thread Jason Bertsche
Have you tried escaping the quotes around `max`?  That is, have you 
tried using this as the code for (2): `r:eval lp (\max\, f.obj, 
f.con, f.dir, f.rhs)$solution`?


On 09/18/2014 07:02 PM, bij...@gmail.com wrote:

Hello All,
I am trying to have agents in the model use linear programming techniques to 
determine land use. I have used the R-extension to link NetLogo and R. I called 
the lpSolve package in R and it loaded but it seems that I can't get the 
optimization to run because of a confilcting command in NetLogo and the lpSolve 
function.

Specifically,
the command in lpSolve to have the model run in R is:
lp (max, f.obj, f.con, f.dir, f.rhs)$solution ...(1)

therfore to code it in Netlogo it would be:
r:eval lp (max, f.obj, f.con, f.dir, f.rhs)$solution...(2)

but max is read as a function in NetLogo and the model fails to compile

When I remove the quotations around max, the model compiles but and error 
emerges in optimization:

Extension exception: Error in R-Extension: Error in Eval:
org.nlogo.api.ExtensionException: Error in direction == min :
   comparison (1) is possible only for atomic and list types   ...(3)

Is there a way to have Netlogo observe max in (2) as text?
Alternatively is there a way to have R read max as max?

Any help on this would be greatly appreciated
Bijon



--
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.


Re: [netlogo-devel] Netlogo Extensions

2014-09-05 Thread Jason Bertsche
- can i easily use the gogo board extensions to collect informations 
from sensors  ?


If you have a GoGo Board, yeah, you totally can.  If not—if you want to 
use a Panda 2—I doubt it.  Each different type of board is likely to 
have a different communication protocol.  The GoGo extension is looking 
for very specific signals from the device that it's talking to, and I 
wouldn't expect another board to be sending the exact signals that the 
extension is expecting.


- did you know if a fez Panda 2 netlogo extensions can exist ( i found 
just an arduino and gogo board ) ?


I don't see why someone couldn't.  It should simply be a matter of using 
a serial communication library to talk to the Panda 2, and then writing 
some code for handling the board's communication protocol, whatever that 
might be.


Some links that you might find useful for doing this:

 * The Arduino extension code
   https://github.com/cbradyatinquire/arduino-extension
 * The GoGo extension code https://github.com/NetLogo/GoGo-Extension
 * The JSSC serial library
   https://code.google.com/p/java-simple-serial-connector/
 * The GoGo-Lite extension code
   https://github.com/NetLogo/GoGo-Lite-Extension (which uses JSSC)


On 09/04/2014 07:54 PM, Lansari Achraf wrote:
Hello Everybody, i want to thank you for all the netlogo extensions 
and i have a question :


- did you know if a fez Panda 2 netlogo extensions can exist ( i found 
just an arduino and gogo board ) ?
- if no , can i easily use the gogo board extensions to collect 
informations from sensors  ?


thanks for the help
--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] file format: human readability

2014-07-31 Thread Jason Bertsche

Has the use of named sections been considered for the NetLogo file format?


Indeed, it has been.  With the recent work on Tortoise (the 
browser-based version of NetLogo), there has been murmuring about us 
switching to a nicer file format.  The old format essentially must 
always be supported in some way, but we're hopeful that, in the future, 
NetLogo model files can be JSON or some other standard serialization 
format.  JSON isn't exactly the pinnacle of human-readability, but it's 
better than what we currently have, and it's natively supported by browsers.


Separately, for human readability it would be nice if widgets were 
specified as collections of key value pairs.


Totally agreed.

On 07/31/2014 01:04 PM, Alan Isaac wrote:

Has the use of named sections been considered for the NetLogo file format?
This would be easier for humans to read (and would not require the 
presence of empty sections).
E.g., the section divider markers could remain unchanged but allow a 
name to follow on the same line,
with the being those given at 
https://github.com/NetLogo/NetLogo/wiki/Model-file-format
(Side note: currently that page calls the second section both Widgets 
and Interface).


Separately, for human readability it would be nice if widgets were 
specified as collections of key value pairs.

Until then, thanks for the documentation at
https://github.com/NetLogo/NetLogo/wiki/Widget-Format

fwiw,
Alan Isaac
--
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 
mailto:netlogo-devel+unsubscr...@googlegroups.com.

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 netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [netlogo-devel] Modifying Java-Options on Windows

2014-03-27 Thread Jason Bertsche
The Windows installation of NetLogo doesn't appear to be designed to 
allow you to change the classpath like that.  It really shouldn't be 
necessary for you to change it, though.  If extension X is used in a 
model, all files in './extensions/X/*.jar' get loaded onto the 
classpath dynamically.


Jason Bertsche
Senior Software Developer - NetLogo

On 3/27/2014 5:08 AM, Martin Dobiasch wrote:

Hi,

i need to put a jar file on the classpath in order to make my 
extension work.

On Linux this is no problem (just modifying the netlogo.sh)
on Windows however I cant get it to work by modifying the NetLogo 
5.0.5.vmoptions file

BUT i can run it using the command line.
The problem is that my jar seems not to get loaded when using the 
.vmoptions.


Does anyone know the correct way?

my .vmoptions file:
-Djava.ext.dirs=
-Xfuture
-XX:MaxPermSize=128m
-Xmx512m
-Dfile.encoding=UTF-8
-classpath D:\NetLogo 
5.0.5\extensions\mapreduce\mapreduce.jar;D:\NetLogo 5.0.5\NetLogo.jar


The command I'm using (works):
D:\NetLogo 5.0.5jre\bin\java.exe -classpath D:\NetLogo 
5.0.5\extensions\mapreduce\mapreduce.jar;D:\N etLogo 
5.0.5\NetLogo.jar org.nlogo.app.App H:\MR\Pi.nlogo


Thanks,
  Martin




--
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.


Re: [netlogo-devel] Netlogo on Ubuntu - issue with extensions

2014-02-27 Thread Jason Bertsche
Yes, the extensions work fine for me. Are you running 'netlogo.sh' 
through a shortcut?


Jason Bertsche
Senior Software Developer - NetLogo

On 2/27/2014 9:07 PM, Era V wrote:
Do built-in extensions work for you? (I run on ubuntu 12.04, if that 
makes any difference.)


I'm just trying to understand why built-in extensions are not working 
for me. :/


On Thursday, February 27, 2014 9:49:45 PM UTC-5, Jason Bertsche wrote:

Yeah, I run it on Linux all the time.

Jason Bertsche
Senior Software Developer - NetLogo

On 2/27/2014 8:05 PM, Era V wrote:

So, I've been running it since I changed the path, and it seems
just fine. If I don't add the path to the extensions folder, I
can't use any of the built-in extensions, like array, table, etc.
Has anyone else tried this on your team on Linux?

On Tuesday, February 25, 2014 3:09:27 PM UTC-5, Seth Tisue wrote:

 Era == Era V fenn...@gmail.com writes:

 Era Does anyone know what $0 is? Is that just the starting
path?

It's the full path to the launch script.

The reason the script includes the `cd` line is that NetLogo
requires
that when it is launched, the JVM's current working directory
must be
the NetLogo directory itself -- the directory containing
`lib` and
`models` and `extensions` and `NetLogo.jar` and everything else.

This requirement is arguably unfortunate, but that's the way
it is.
Further reading at
https://github.com/NetLogo/NetLogo/issues/415
https://github.com/NetLogo/NetLogo/issues/415 .

 Era Will this break something else in the future (so far it
seems to
 Era work fine)?

I'm at a loss to explain why your change wouldn't make
NetLogo fail to
launch entirely.  Are you sure you're working with an
unmodified NetLogo
install where you haven't renamed anything or moved anything
around?

We don't have any other reports of netlogo.sh failing to
work, and the
directory handling in it hasn't changed in donkey's years, so
afaics you
must be doing something unusual.

-- 
Seth Tisue | Northwestern University | http://tisue.net

developer, NetLogo: http://ccl.northwestern.edu/netlogo/
http://ccl.northwestern.edu/netlogo/

-- 
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/groups/opt_out
https://groups.google.com/groups/opt_out.


--
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/groups/opt_out.


--
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/groups/opt_out.


Re: [netlogo-devel] Update to the matrix extension

2014-02-18 Thread Jason Bertsche
For whoever ends up taking this on---probably the release manager of 
5.0.6?---there's now an issue 
https://github.com/NetLogo/NetLogo/issues/547 open for this in the 
main NetLogo repo.


Jason Bertsche
Senior Software Developer - NetLogo

On 2/17/2014 5:34 PM, Forrest Stonedahl wrote:

Hi Charles,

I defer to Seth (in all things devel!), but I'm guessing the next 
logical step is to do a pull request, so someone can merge your 
changes back into the main Matrix-Extensions github repo?


Alternatively since you've already made some good contributions to the 
Matrix extension over the years, it might make sense for you to be a 
direct contributor to that repo, with push privileges, and you can 
update it as you like.


I'm guessing that the newer versions of the extensions will 
automatically get built  bundled in future NetLogo releases...


(Some unit tests for the new matrix primitive should also probably be 
added to the tests.txt file, if you haven't done that already.)


Okay, now Seth can correct all of the inaccuracies I've written above, 
and clarify the true devel process.  :-)


Cheers,

~Forrest



On Mon, Feb 17, 2014 at 4:24 PM, Charles cstae...@smith.edu 
mailto:cstae...@smith.edu wrote:


Seth's comment in Stack Overflow about the usefulness of a map
primitive in the matrix extension led me to add one, matrix:map
task matrix.  In the process, I did some updating to use
jama-1.0.3 rather than 1.0.2 and made some minor non-substantive
changes to the code to make my compiler happy.  I forked the
original code off of the github NetLogo site to my own github
account, but now that I've made the changes, I'm not sure what to
do next.  As a bundled extension I can't put it out there myself,
and I assume that even if the changes were useful for a large
enough audience, there would be a good bit of checking that you
all would want to do.  Indeed, I'm not really clear on how I would
push this back to you if it were useful.  So, I'm looking for
advice on next steps, although if that is to just use it myself,
that's fine too.

Charles
-- 
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
mailto:netlogo-devel%2bunsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


--
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/groups/opt_out.


--
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/groups/opt_out.