Ok ! I get an error of recursion with this :
org.openmole.core.console.ScalaREPL$CompilationError: (line 43) recursive value savePopulation needs type
evaluation = Latin -< model hook savePopulation,
^
Error in imports header:
(line -19) recursive value evolution needs type
val savePopulation = SavePopulationHook(evolution, workDirectory / “evolution /”)
^
Compiling code:
class _7dab739c4f43074f307d7e0f7d47871893206fb0Class {
lazy val _imports = new {
}
import imports.
private lazy val workDirectory = File(new java.net.URI(“file:/home/leonard/.openmole/Fozzy/webui/projects/LHStest/”).getPath)
//LHS inputs
val a = Val[Double]
val b = Val[Double]
//model inputs
val x = Val[Double]
val y = Val[Double]
//model outputs
val o1 = Val[Double]
val o2 = Val[Double]
val model =
ScalaTask(“val o1 = x + a; val o2 = y + b”) set (
inputs += (x, y, a, b),
outputs += (o1, o2, a, b),
x := 5.0,
y := 8.9,
a := 2.0,
b := 5.0
)
val nsga = NSGA2(
mu = 100,
genome = Seq(x in (0.0, 10.0), y in (0.0, 10.0)),
objectives = Seq(o1, o2)
)
val Latin =
ExplorationTask (
LHS(
10, // Number of points of the LHS
a in Range(0.0, 10.0),
b in Range(0.0, 5.0)
)
)
val savePopulation = SavePopulationHook(evolution, workDirectory / “evolution /”)
val evolution =
SteadyStateEvolution(
algorithm = nsga,
evaluation = Latin -< model hook savePopulation,
parallelism = 10,
termination = 100
)
evolution on LocalEnvironment(4)
}
lazy val _7dab739c4f43074f307d7e0f7d47871893206fb0 = new _7dab739c4f43074f307d7e0f7d47871893206fb0Class
def runOMSScript(): org.openmole.core.workflow.puzzle.Puzzle = {
import _7dab739c4f43074f307d7e0f7d47871893206fb0.imports.
//LHS inputs
val a = Val[Double]
val b = Val[Double]
//model inputs
val x = Val[Double]
val y = Val[Double]
//model outputs
val o1 = Val[Double]
val o2 = Val[Double]
val model =
ScalaTask(“val o1 = x + a; val o2 = y + b”) set (
inputs += (x, y, a, b),
outputs += (o1, o2, a, b),
x := 5.0,
y := 8.9,
a := 2.0,
b := 5.0
)
val nsga = NSGA2(
mu = 100,
genome = Seq(x in (0.0, 10.0), y in (0.0, 10.0)),
objectives = Seq(o1, o2)
)
val Latin =
ExplorationTask (
LHS(
10, // Number of points of the LHS
a in Range(0.0, 10.0),
b in Range(0.0, 5.0)
)
)
val savePopulation = SavePopulationHook(evolution, workDirectory / “evolution /”)
val evolution =
SteadyStateEvolution(
algorithm = nsga,
evaluation = Latin -< model hook savePopulation,
parallelism = 10,
termination = 100
)
evolution on LocalEnvironment(4)
}
runOMSScript()
at org.openmole.core.console.ScalaREPL$CompilationError.copy(ScalaREPL.scala:54)
at org.openmole.core.console.ScalaREPL$CompilationError$$anon$3$$anonfun$modifyF$1.apply(ScalaREPL.scala:54)
at org.openmole.core.console.ScalaREPL$CompilationError$$anon$3$$anonfun$modifyF$1.apply(ScalaREPL.scala:54)
at scalaz.Monad$$anonfun$map$1$$anonfun$apply$2.apply(Monad.scala:14)
at scalaz.IdInstances$$anon$1.point(Id.scala:20)
at scalaz.Monad$$anonfun$map$1.apply(Monad.scala:14)
at scalaz.IdInstances$$anon$1.bind(Id.scala:22)
at scalaz.Monad$class.map(Monad.scala:14)
at scalaz.IdInstances$$anon$1.map(Id.scala:19)
at org.openmole.core.console.ScalaREPL$CompilationError$$anon$3.modifyF(ScalaREPL.scala:54)
at org.openmole.core.console.ScalaREPL$CompilationError$$anon$3.modifyF(ScalaREPL.scala:54)
at monocle.PLens$$anon$5.modifyF(Lens.scala:190)
at monocle.PTraversal$$anon$2.modifyF(Traversal.scala:113)
at monocle.PTraversal$$anon$2.modifyF(Traversal.scala:113)
at monocle.PTraversal$$anon$2.modifyF(Traversal.scala:113)
at monocle.PTraversal$$anon$2.modifyF(Traversal.scala:113)
at monocle.PTraversal.monocle$PTraversal$$$anonfun$8(Traversal.scala:69)
at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:52)
at org.openmole.core.project.Project.compile$1(Project.scala:155)
at org.openmole.core.project.Project.compile(Project.scala:161)
at org.openmole.gui.server.core.ApiImpl.runScript(ApiImpl.scala:316)
at org.openmole.gui.server.core.GUIServlet$$anonfun$2$$anonfun$applyOrElse$24.apply$mcV$sp(GUIServlet.scala:333)
at org.openmole.gui.server.core.GUIServlet$$anonfun$2$$anonfun$applyOrElse$24.apply(GUIServlet.scala:333)
at org.openmole.gui.server.core.GUIServlet$$anonfun$2$$anonfun$applyOrElse$24.apply(GUIServlet.scala:333)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: javax.script.ScriptException: compile-time error
at scala.tools.nsc.interpreter.IMain.compiled(IMain.scala:602)
at scala.tools.nsc.interpreter.IMain.eval(IMain.scala:1074)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
at scala.tools.nsc.interpreter.IMain.compile(IMain.scala:1068)
at org.openmole.core.console.ScalaREPL.compile(ScalaREPL.scala:194)
at org.openmole.core.project.Project.compile$1(Project.scala:132)
… 12 more
which make sense because savePopulation is defined with evolution :
val savePopulation = SavePopulationHook(evolution, workDirectory / “evolution /”)
However I’m not certain that it is the problem