Error in Netlogo for context values


(Aymericvie) #1

Hello,

I am starting a PSE on OpenMole. The scripts runs for a second then encounters an internal processing error showing “error in Netlogo for context values” and then describes a set of parameter values.

I don’t understand where it comes, as the code looks correct. The code runs fine in Netlogo including in the parameter values set Openmole does not succeed in implementing.

Thanks a lot in advance.
Aymeric

val seed = Val[Int]
val productivity = Val[Double]
val failure_probability = Val[Double]
val production_scaling = Val[Double]
val pop = Val[Double]
val alpha = Val[Double]
val average_prod = Val[Double]
val collapse_probability = Val[Double]
val objective = Val[Double]
val collapse_count = Val[Double]
val reference = Val[Double]
val launch = List("setup","random-seed ${seed}","while [ticks <= 999] [go];;You should set your stopping criteria here instead")
            
val netlogo = NetLogo6Task(workDirectory / "Centrality_working_3.nlogo", launch, embedWorkspace = false, seed=seed) set(
  inputs += (seed),
  inputs += productivity mapped "productivity",
  inputs += failure_probability mapped "failure_probability",
  inputs += production_scaling mapped "production_scaling",
  inputs += pop mapped "pop",
  inputs += alpha mapped "alpha",
  outputs += average_prod mapped "average_prod",
  outputs += collapse_probability mapped "collapse_probability",
  outputs += objective mapped "objective",
  outputs += collapse_count mapped "collapse_count",
  outputs += reference mapped "reference",
  //Default values. Can be removed if OpenMOLE Vals are set by values coming from the workflow
  seed := 0,
  productivity := 1.0,
  failure_probability := 0.54,
  production_scaling := 2.0,
  pop := 100.0,
  alpha := 2.0)
  // assuming population of 100 agents

val pse =
  PSEEvolution(
    evaluation = netlogo,
    parallelism = 2000,
    termination = 20000,
    genome = Seq(
        failure_probability in (0.0 to 1.0 by 0.01),
        alpha in (0.0 to 2.0 by 0.01)
        ),
    objectives =  Seq(
        //average_prod in (0.00 to 2000.00 by 0.5)         // remember avg_prod = objective / (1 - proba_collapse) in R
        collapse_probability in (0.0 to 1.0 by 0.01),
        objective in (0.0 to 500 by 1.0)),
    stochastic = Stochastic(seed = seed)

  )
  
val env = EGIEnvironment("vo.complex-systems.eu") 
  
// Define a hook to save the Pareto frontier
pse hook SavePopulationHook(pse, workDirectory / "results/PSE", frequency = 100) //on env
```

#3

Hi Aymeric, could you post the complete error ?


(Aymericvie) #4

Hello,
Please find it below.

Thank you.

Best,

Aymeric

org.openmole.core.exception.InternalProcessingError: Error in netlogo@-1970907795 for context values {alpha=0.7800000000000005, failure_probability=0.9100000000000006, openmole$seed=2075277340116959273, pop=100.0, production_scaling=2.0, productivity=1.0, seed=851712826}

at org.openmole.core.workflow.tools.InputOutputCheck$.$anonfun$perform$1(InputOutputCheck.scala:91)

at org.openmole.core.expansion.FromContext$$anon$9.from(FromContext.scala:163)

at org.openmole.core.workflow.task.Task.perform(Task.scala:68)

at org.openmole.core.workflow.task.Task.perform$(Task.scala:66)

at org.openmole.plugin.task.netlogo6.NetLogo6Task.perform(NetLogo6Task.scala:110)

at org.openmole.core.workflow.job.MoleJob.perform(MoleJob.scala:102)

at org.openmole.core.workflow.execution.local.LocalExecutor.$anonfun$run$2(LocalExecutor.scala:63)

at org.openmole.core.workflow.execution.local.LocalExecutor.$anonfun$run$2$adapted(LocalExecutor.scala:61)

at scala.collection.Iterator.foreach(Iterator.scala:937)

at scala.collection.Iterator.foreach$(Iterator.scala:937)

at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)

at scala.collection.IterableLike.foreach(IterableLike.scala:70)

at scala.collection.IterableLike.foreach$(IterableLike.scala:69)

at scala.collection.AbstractIterable.foreach(Iterable.scala:54)

at org.openmole.core.workflow.execution.local.LocalExecutor.$anonfun$run$1(LocalExecutor.scala:61)

at org.openmole.core.outputmanager.OutputManager$.withStreamOutputs(OutputManager.scala:123)

at org.openmole.core.workflow.execution.local.LocalExecutor.withRedirectedOutput(LocalExecutor.scala:116)

at org.openmole.core.workflow.execution.local.LocalExecutor.run(LocalExecutor.scala:58)

at java.base/java.lang.Thread.run(Thread.java:834)

Caused by: org.openmole.core.exception.UserBadDataError: Error while opening the file /var/openmole/.openmole/openmole/.tmp/aaf6bd21-ff59-4d58-af3d-6feeb2bf9804/execution0207c05d-8d71-4bda-aa8e-457f6beec267/netlogoworkpsace2afcf393-e44c-4c73-b653-548bcf78fd4d/Alpha Centralization Model/Centrality_working_3.nlogo:

There is already a turtle variable called DEGREE at position 376 in

at org.nlogo.core.Fail$.exception(Fail.scala:27)

at org.nlogo.core.Fail$.exception(Fail.scala:25)

at org.nlogo.core.Fail$.exception(Fail.scala:23)

at org.nlogo.parse.LetScope$.$anonfun$apply$1(LetScoper.scala:102)

at scala.Option.foreach(Option.scala:257)

at org.nlogo.parse.LetScope$.apply(LetScoper.scala:101)

at org.nlogo.parse.ExpressionParser$.parseStatement(ExpressionParser.scala:65)

at org.nlogo.parse.ExpressionParser$.$anonfun$apply$1(ExpressionParser.scala:30)

at org.nlogo.parse.ExpressionParser$.parseStatements(ExpressionParser.scala:42)

at org.nlogo.parse.ExpressionParser$.apply(ExpressionParser.scala:30)

at org.nlogo.parse.NetLogoParser.parseProcedure(NetLogoParser.scala:45)

at org.nlogo.parse.NetLogoParser.parseProcedure$(NetLogoParser.scala:29)

at org.nlogo.parse.FrontEnd$.parseProcedure(FrontEnd.scala:10)

at org.nlogo.parse.NetLogoParser.$anonfun$basicParse$1(NetLogoParser.scala:25)

at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)

at scala.collection.Iterator.foreach(Iterator.scala:929)

at scala.collection.Iterator.foreach$(Iterator.scala:929)

at scala.collection.AbstractIterator.foreach(Iterator.scala:1417)

at scala.collection.MapLike$DefaultValuesIterable.foreach(MapLike.scala:210)

at scala.collection.TraversableLike.map(TraversableLike.scala:234)

at scala.collection.TraversableLike.map$(TraversableLike.scala:227)

at scala.collection.AbstractTraversable.map(Traversable.scala:104)

at org.nlogo.parse.NetLogoParser.basicParse(NetLogoParser.scala:25)

at org.nlogo.parse.NetLogoParser.basicParse$(NetLogoParser.scala:15)

at org.nlogo.parse.FrontEnd$.basicParse(FrontEnd.scala:10)

at org.nlogo.parse.FrontEndMain.frontEnd(FrontEnd.scala:26)

at org.nlogo.parse.FrontEndMain.frontEnd$(FrontEnd.scala:25)

at org.nlogo.parse.FrontEnd$.frontEnd(FrontEnd.scala:10)

at org.nlogo.compile.CompilerMain$.compile(CompilerMain.scala:42)

at org.nlogo.compile.Compiler.compileMoreCode(Compiler.scala:78)

at org.nlogo.compile.Compiler.compileMoreCode(Compiler.scala:91)

at org.nlogo.workspace.Evaluator.invokeCompiler(Evaluator.scala:158)

at org.nlogo.workspace.Evaluator.makeCommandThunk(Evaluator.scala:110)

at org.nlogo.workspace.Evaluating.makeCommandThunk(Evaluating.scala:25)

at org.nlogo.workspace.Evaluating.makeCommandThunk$(Evaluating.scala:23)

at org.nlogo.workspace.AbstractWorkspaceScala.makeCommandThunk(AbstractWorkspaceScala.scala:24)

at org.nlogo.plot.PlotManager.compile$1(PlotManager.scala:86)

at org.nlogo.plot.PlotManager.$anonfun$compilePlot$4(PlotManager.scala:102)

at scala.collection.TraversableLike$WithFilter.$anonfun$map$2(TraversableLike.scala:739)

at scala.collection.immutable.List.foreach(List.scala:389)

at scala.collection.TraversableLike$WithFilter.map(TraversableLike.scala:738)

at org.nlogo.plot.PlotManager.compilePlot(PlotManager.scala:100)

at org.nlogo.plot.PlotManager.$anonfun$compileAllPlots$1(PlotManager.scala:81)

at scala.collection.immutable.List.flatMap(List.scala:335)

at org.nlogo.plot.PlotManager.compileAllPlots(PlotManager.scala:81)

at org.nlogo.headless.HeadlessModelOpener.finish(HeadlessModelOpener.scala:89)

at org.nlogo.headless.HeadlessModelOpener.openFromModel(HeadlessModelOpener.scala:73)

at org.nlogo.headless.HeadlessWorkspace.openModel(HeadlessWorkspace.scala:535)

at org.nlogo.headless.HeadlessWorkspace.open(HeadlessWorkspace.scala:502)

at org.openmole.plugin.tool.netlogo6.NetLogo6.open(NetLogo6.java:50)

at org.openmole.plugin.task.netlogo.NetLogoTask$.$anonfun$openNetLogoWorkspace$3(NetLogoTask.scala:79)

at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)

at org.openmole.plugin.task.netlogo.NetLogoTask$.wrapError(NetLogoTask.scala:49)

at org.openmole.plugin.task.netlogo.NetLogoTask$.$anonfun$openNetLogoWorkspace$2(NetLogoTask.scala:79)

at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)

at org.openmole.tool.thread.package$.withThreadClassLoader(package.scala:53)

at org.openmole.core.code.CodePackage.withThreadClassLoader(CodePackage.scala:49)

at org.openmole.core.code.CodePackage.withThreadClassLoader$(CodePackage.scala:48)

at org.openmole.core.workflow.dsl$.withThreadClassLoader(package.scala:46)

at org.openmole.plugin.task.netlogo.NetLogoTask$.openNetLogoWorkspace(NetLogoTask.scala:78)

at org.openmole.plugin.task.netlogo.NetLogoTask$.createInstance$1(NetLogoTask.scala:117)

at org.openmole.plugin.task.netlogo.NetLogoTask$.$anonfun$createPool$1(NetLogoTask.scala:126)

at org.openmole.tool.cache.WithNewInstance.apply(Pool.scala:43)

at org.openmole.plugin.task.netlogo.NetLogoTask.$anonfun$process$1(NetLogoTask.scala:286)

at org.openmole.core.expansion.FromContext$$anon$8.from(FromContext.scala:157)

at org.openmole.core.workflow.tools.InputOutputCheck$.$anonfun$perform$1(InputOutputCheck.scala:88)

at org.openmole.core.expansion.FromContext$$anon$9.from(FromContext.scala:163)

at org.openmole.core.workflow.task.Task.perform(Task.scala:68)

at org.openmole.core.workflow.task.Task.perform$(Task.scala:66)

at org.openmole.plugin.task.netlogo6.NetLogo6Task.perform(NetLogo6Task.scala:110)

at org.openmole.core.workflow.job.MoleJob.perform(MoleJob.scala:102)

at org.openmole.core.workflow.execution.local.LocalExecutor.$anonfun$run$2(LocalExecutor.scala:63)

at org.openmole.core.workflow.execution.local.LocalExecutor.$anonfun$run$2$adapted(LocalExecutor.scala:61)

at scala.collection.Iterator.foreach(Iterator.scala:937)

at scala.collection.Iterator.foreach$(Iterator.scala:937)

at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)

at scala.collection.IterableLike.foreach(IterableLike.scala:70)

at scala.collection.IterableLike.foreach$(IterableLike.scala:69)

at scala.collection.AbstractIterable.foreach(Iterable.scala:54)

at org.openmole.core.workflow.execution.local.LocalExecutor.$anonfun$run$1(LocalExecutor.scala:61)

at org.openmole.core.outputmanager.OutputManager$.withStreamOutputs(OutputManager.scala:123)

at org.openmole.core.workflow.execution.local.LocalExecutor.withRedirectedOutput(LocalExecutor.scala:116)

at org.openmole.core.workflow.execution.local.LocalExecutor.run(LocalExecutor.scala:58)

at java.base/java.lang.Thread.run(Thread.java:834)

at org.openmole.plugin.task.netlogo.NetLogoTask$.wrapError(NetLogoTask.scala:53)

at org.openmole.plugin.task.netlogo.NetLogoTask$.$anonfun$openNetLogoWorkspace$2(NetLogoTask.scala:79)

at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)

at org.openmole.tool.thread.package$.withThreadClassLoader(package.scala:53)

at org.openmole.core.code.CodePackage.withThreadClassLoader(CodePackage.scala:49)

at org.openmole.core.code.CodePackage.withThreadClassLoader$(CodePackage.scala:48)

at org.openmole.core.workflow.dsl$.withThreadClassLoader(package.scala:46)

at org.openmole.plugin.task.netlogo.NetLogoTask$.openNetLogoWorkspace(NetLogoTask.scala:78)

at org.openmole.plugin.task.netlogo.NetLogoTask$.createInstance$1(NetLogoTask.scala:117)

at org.openmole.plugin.task.netlogo.NetLogoTask$.$anonfun$createPool$1(NetLogoTask.scala:126)

at org.openmole.tool.cache.WithNewInstance.apply(Pool.scala:43)

at org.openmole.plugin.task.netlogo.NetLogoTask.$anonfun$process$1(NetLogoTask.scala:286)

at org.openmole.core.expansion.FromContext$$anon$8.from(FromContext.scala:157)

at org.openmole.core.workflow.tools.InputOutputCheck$.$anonfun$perform$1(InputOutputCheck.scala:88)

... 18 more

Le mar. 8 janv. 2019 à 11:54, reuillon noreply@iscpif.fr a écrit :


#5

This is caused by an error in the netlogo code:

You should get the same error in netlogo.


(Aymericvie) #6

Surprisingly I actually don’t get the error in Netlogo. The code runs totally fine on it and on Behavior Space. So I was able to run the code thousands time without encountering any issue.

Le mar. 8 janv. 2019 à 19:07, reuillon noreply@iscpif.fr a écrit :


#7

May you double check that it is exactly the same code?


(Aymericvie) #8

Thank you so much. It was that.
Sorry for the silly mistake, it has so far been running all fine for 9 minutes.

Thanks a lot!

Aymeric

Le mar. 8 janv. 2019 à 19:31, reuillon noreply@iscpif.fr a écrit :