Debugging a first try with OpenMole


(Timothée Brochier) #1

Hello,
Here in Dakar, Cheikhou and I are trying to plug open mole on a simple netlogo model we have. We adapted the “calibration.oms” from the “ants” project.
Now we have an error message that we can’t figure out how to deal with, maybe someone could help us :

org.openmole.core.console.ScalaREPL$CompilationError: (line 54) not enough arguments for method SteadyStateEvolution: (algorithm: T, evaluation: org.openmole.core.workflow.puzzle.Puzzle, termination: org.openmole.plugin.method.evolution.OMTermination, parallelism: Int)(implicit wfi: org.openmole.plugin.method.evolution.WorkflowIntegration[T])shapeless.::[org.openmole.core.workflow.puzzle.OutputEnvironmentPuzzleContainer{def generation: org.openmole.core.context.Val[Long]; def population: org.openmole.core.context.Val[scala.collection.immutable.Vector[t.integration.I]]; def state: org.openmole.core.context.Val[t.integration.S]},shapeless.::[T,shapeless.HNil]] forSome { val t: org.openmole.plugin.method.evolution.EvolutionWorkflow }.
Unspecified value parameter evaluation.
         SteadyStateEvolution(
                             ^
Error in imports header:
(line -31) not enough arguments for method SteadyStateEvolution: (algorithm: T, evaluation: org.openmole.core.workflow.puzzle.Puzzle, termination: org.openmole.plugin.method.evolution.OMTermination, parallelism: Int)(implicit wfi: org.openmole.plugin.method.evolution.WorkflowIntegration[T])shapeless.::[org.openmole.core.workflow.puzzle.OutputEnvironmentPuzzleContainer{def generation: org.openmole.core.context.Val[Long]; def population: org.openmole.core.context.Val[scala.collection.immutable.Vector[t.integration.I]]; def state: org.openmole.core.context.Val[t.integration.S]},shapeless.::[T,shapeless.HNil]] forSome { val t: org.openmole.plugin.method.evolution.EvolutionWorkflow }.
Unspecified value parameter evaluation.
         SteadyStateEvolution(

below is the .oms :

val seed = Val[Int]
val Nb_init_fish = Val[Double]
val recifOuvert = Val[Boolean]
val food_sable = Val[Double]
val food_Recif = Val[Double]
val diferentiel_de_mouvement = Val[Double]
val K_recif_sur_K_sable = Val[Double]

val nb_pecheur = Val[Double]
val nb_poissons = Val[Double]

val obj = Val[Double]


// Define the NetlogoTask
val cmds = Seq("run-to-grid")

val task = NetLogo5Task(workDirectory / "model_tim.nlogo", cmds, embedWorkspace = false) set(
  inputs += (seed),
  netLogoInputs += (Nb_init_fish, "Nb_init_fish"),
  netLogoInputs += (recifOuvert, "recif-ouvert"),
  netLogoInputs += (food_sable, "food_sable"),
  netLogoInputs += (food_Recif, "food_Recif"),
  netLogoInputs += (diferentiel_de_mouvement, "diferentiel_de_mouvement"),
  netLogoInputs += (K_recif_sur_K_sable, "K_recif_sur_K_sable"),
  

  netLogoOutputs += ("nb_pecheur", nb_pecheur),
  netLogoOutputs += ("nb_poissons", nb_poissons),

  
  //Default values. Can be removed if OpenMOLE Vals are set by values coming from the workflow
  seed := 0,
  Nb_init_fish := 50,
  recifOuvert := false,
  food_sable := 2,
  food_Recif := 5,
  diferentiel_de_mouvement := 0.5,
  K_recif_sur_K_sable :=1
  )


val aggregate = 
  ScalaTask("val obj = math.abs(250 - nb_pecheur)") set (
    inputs += (nb_pecheur),
    outputs += obj
  )


val modelCapsule = Capsule(task)


val evolution =
  SteadyStateEvolution(
    algorithm =   
      NSGA2(
        mu = 10,
        genome = Seq(diferentiel_de_mouvement in (0.1, 3.0), food_Recif in (0.0, 100.0)),
        objectives = Seq(obj),
        stochastic = Stochastic(seed = seed)
      )
    evaluation = modelCapsule -- aggregate,
    parallelism = 10,
    termination = 100
  )
  

// Define a hook to save the Pareto frontier
val savePopulationHook = SavePopulationHook(evolution, workDirectory / "calibration_TEST_tim")

val env = LocalEnvironment(5)


// Plug everything together to create the workflow
(evolution hook savePopulationHook on env)

//task hook ToStringHook()

Best regards,
Timothée


#2

Hi Timothée,

it looks likes there is a missing coma after the algorithm, it should look like:

 val evolution =
  SteadyStateEvolution(
    algorithm =   
      NSGA2(
        mu = 10,
        genome = Seq(diferentiel_de_mouvement in (0.1, 3.0), food_Recif in (0.0, 100.0)),
        objectives = Seq(obj),
        stochastic = Stochastic(seed = seed)
      ),
    evaluation = modelCapsule -- aggregate,
    parallelism = 10,
    termination = 100
  )

Romain


(Timothée Brochier) #4

It worked! But… sorry, another stupid question : I can’t find the file calibration output directory on my computer… the only way I see is to download each .csv separetely!?


#5

You could download the folder and you’ll get a tgz archive, alternatively you could provide any path you want to the hook to save it at a specific location on you computer.


(Timothée Brochier) #6

ok thank you Mathieu!