Error trying to run headless BehaviorSpace

此生再无相见时 提交于 2019-12-07 23:15:49

问题


I feel I must apologize for such a basic question, but I am getting an error simply trying to run BehaviorSpace experiments in headless mode. I tried running my own model experiments from the command line, but got an error. So I then tried following the exact instructions on the BehaviorSpace documentation. To do this, I created a BehaviorSpace experiment in the Fire.nlogo model called "experiment1" (see screen shot) and then tried to execute commands to run experiment1 from the command line. The screen shot of the terminal shows that I first set the directory where I have NetLogo 5.3 installed, and then tried to run the commands from the BehaviorSpace documentation. The screen shot of the terminal also shows the Java error I am getting. I have never used the terminal before and am not sure what I am doing wrong, but I am sure I am missing something simple.

I am using Mac OS X and NetLogo 5.3. Thank you for your time.


回答1:


Seems you're not working in the correct directory.

You need to cd into the netlogo directory: For me:

netlogo_directory = "/Applications/NetLogo 5.2"

so

cd /Applications/NetLogo\ 5.2

Then you can execute your command:

java -Xmx2048m -Dfile.encoding=UTF-8 -cp ./Netlogo.jar org.nlogo.headless.Main --model /path/to/your/file/name/filename.nlogo --experiment experimentname  --table /path/to/log/with/filename.csv --spreadsheet /path/tp/spreadsheet/with/filename.csv



回答2:


The problem is that the Java file that comes with NetLogo is where the .jar file and lib file are located. Hence, a simple addition of Java/ in the below code allows all files to be found.

java -Xmx1024m -Dfile.encoding=UTF-8 -cp Java/NetLogo.jar \
  org.nlogo.headless.Main \
  --model Fire.nlogo \
  --experiment experiment1 \
  --table mytable.csv


来源:https://stackoverflow.com/questions/36578264/error-trying-to-run-headless-behaviorspace

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!