无法通过命令行找到NetLogo模型

时间:2017-10-09 11:24:40

标签: command-line netlogo

我正试图在Windows 10机器上掌握NetLogo的命令行操作。我想运行提供的Fire.nlogo模型。

我使用cd C:\Program Files\NetLogo 6.0.2

设置目录

然后我尝试运行一个名为experiment1的简单实验,我之前已在BehaviourSpace中编写了

netlogo-headless --model Fire.nlogo --experiment experiment1

这给了我以下错误:

Exception in thread "main" java.io.FileNotFoundException: C:\Program Files\NetLogo 6.0.2\Fire.nlogo (The system cannot find the file specified)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at scala.io.Source$.fromFile(Source.scala:91)
        at scala.io.Source$.fromFile(Source.scala:76)
        at scala.io.Source$.fromURI(Source.scala:121)
        at org.nlogo.fileformat.AbstractNLogoFormat.$anonfun$sections$1(NLogoFormat.scala:37)
        at scala.util.Try$.apply(Try.scala:209)
        at org.nlogo.fileformat.AbstractNLogoFormat.sections(NLogoFormat.scala:36)
        at org.nlogo.fileformat.AbstractNLogoFormat.sections$(NLogoFormat.scala:34)
        at org.nlogo.fileformat.NLogoFormat.sections(NLogoFormat.scala:16)
        at org.nlogo.api.ModelFormat.load(ModelFormat.scala:53)
        at org.nlogo.api.ModelFormat.load$(ModelFormat.scala:51)
        at org.nlogo.fileformat.NLogoFormat.load(NLogoFormat.scala:16)
        at org.nlogo.api.FormatterPair.load(ModelLoader.scala:26)
        at org.nlogo.api.ModelLoader.readModel(ModelLoader.scala:60)
        at org.nlogo.api.ModelLoader.readModel$(ModelLoader.scala:57)
        at org.nlogo.api.ConfigurableModelLoader.readModel(ModelLoader.scala:90)
        at org.nlogo.headless.HeadlessWorkspace.open(HeadlessWorkspace.scala:491)
        at org.nlogo.headless.Main$.newWorkspace$1(Main.scala:18)
        at org.nlogo.headless.Main$.runExperiment(Main.scala:21)
        at org.nlogo.headless.Main$.$anonfun$main$1(Main.scala:12)
        at org.nlogo.headless.Main$.$anonfun$main$1$adapted(Main.scala:12)
        at scala.Option.foreach(Option.scala:257)
        at org.nlogo.headless.Main$.main(Main.scala:12)
        at org.nlogo.headless.Main.main(Main.scala)

我注意到输出的路径为C:\Program Files\NetLogo 6.0.2\Fire.nlogo,但模型实际上位于C:\Program Files\NetLogo 6.0.2\app\models\Sample Models\Earth Science\Fire.nlogo

虽然我似乎正在按照这里编写的教程https://ccl.northwestern.edu/netlogo/docs/behaviorspace.html

我在这里出错的任何想法?谢谢。

1 个答案:

答案 0 :(得分:1)

快速查看表明您需要提供--model参数的完整文件路径。所以命令看起来像:

netlogo-headless --model "C:\Program Files\NetLogo 6.0.2\app\models\Sample Models\Earth Science\Fire.nlogo" --experiment experiment1

由于您已设置cd C:\Program Files\NetLogo 6.0.2,因此可以使用

netlogo-headless --model "app\models\Sample Models\Earth Science\Fire.nlogo" --experiment experiment1

或者,您可以转到包含要运行的模型的目录,而是提供.bat文件的路径(再次使用引号)

"c:\Program Files\NetLogo 6.0.2\netlogo-headless.bat" --model Fire.nlogo --experiment experiment1