A simple exploration defintion


(Etienne Delay) #1

Hi,
Last week I have tried to define a simple exploration task I want to send vectors of parameters. Something like :

val exploration = 
  DirectSampling(
    evaluation = Replication(task hook csvHook, seed, 10),
    sampling = density in (100, 506, 992, 4970)
  )

Where density parameters are defined directly. I can’t find the “good” way to do that without this error :

org.openmole.core.console.ScalaREPL$CompilationError: (line 92) type mismatch;
 found   : org.openmole.core.workflow.sampling.Factor[(Int, Int),Int]
 required: org.openmole.core.workflow.sampling.Sampling
           sampling = density in (100, 506)
                              ^
Error in imports header:
(line -25) type mismatch;
 found   : org.openmole.core.workflow.sampling.Factor[(Int, Int),Int]
 required: org.openmole.core.workflow.sampling.Sampling
           sampling = density in (100, 506)
                              ^
Compiling code:

class _92ed33474adfd177f7b9c58e15b52d79747f0dd4Class {
lazy val _imports = new {

}

Someone can give me a hand ?

E.

Note the entire code is here.

//Input variable for 
val seed = Val[Int]
val regularOrganisation = Val[Boolean]
val density = Val[Int]
val grid = Val[Boolean]
val grpercCrit = Val[Double]
val MeanPnetw = Val[Double]
val SDPnetw = Val[Double]
val Cooperation = Val[Boolean]
val Recruitment = Val[Boolean]
val rSpatialDistribution = Val[String]
val competition = Val[Boolean]
val networking = Val[Boolean]
val MortNoCompet = Val[Double]
val benefit = Val[Double]
val rVariation = Val[String]
val benefitSurv = Val[Boolean]

// outpput variables
val nbTurtles = Val[Int]
val minimumGrowth = Val[Double]
val maximumGrowth = Val[Double]
val nbIndWithLinks = Val[Double]
val pctIndWithLinks = Val[Double]
val meanNbOfNeighbors = Val[Double]
val minIndividualBiomassAlive = Val[Int]
val maxIndividualBiomassAlive = Val[Int]
val meanPtnew = Val[Double]
val sdB = Val[Double]
val meanB = Val[Double]
val meanGrperc = Val[Double]

val launch = List("setup","random-seed ${seed}","go-300")
               
val task = NetLogo6Task(workDirectory / "AZOI.nlogo", launch, embedWorkspace = false) set(
  inputs += (seed),
  // Defined and map inptut send by openMole to Netlogo
  netLogoInputs += (regularOrganisation, "regular-organisation"),
  netLogoInputs += (density, "density"),
  netLogoInputs += (grid, "grid"),
  netLogoInputs += (grpercCrit, "grperc-crit"),
  netLogoInputs += (MeanPnetw, "Mean-Pnetw"),
  netLogoInputs += (SDPnetw, "SD-Pnetw"),
  netLogoInputs += (Cooperation, "Cooperation"),
  netLogoInputs += (Recruitment, "Recruitment"),
  netLogoInputs += (rSpatialDistribution, "r-spatial-distribution"),
  netLogoInputs += (competition, "competition"),
  netLogoInputs += (networking, "networking"),
  netLogoInputs += (MortNoCompet, "Mort-noCompet"),
  netLogoInputs += (benefit, "benefit"),
  netLogoInputs += (rVariation, "r-variation"),
  netLogoInputs += (benefitSurv, "benefit-surv"),
  // Defined and map output from Netlogo to openMole
  netLogoOutputs += ("nbTurtles", nbTurtles),
  netLogoOutputs += ("minimumGrowth", minimumGrowth),
  netLogoOutputs += ("maximumGrowth", maximumGrowth),
  netLogoOutputs += ("nbIndWithLinks", nbIndWithLinks),
  netLogoOutputs += ("pctIndWithLinks", pctIndWithLinks),
  netLogoOutputs += ("meanNbOfNeighbors", meanNbOfNeighbors),
  netLogoOutputs += ("minIndividualBiomassAlive", minIndividualBiomassAlive),
  netLogoOutputs += ("maxIndividualBiomassAlive", maxIndividualBiomassAlive),
  netLogoOutputs += ("meanPtnew", meanPtnew),
  netLogoOutputs += ("sdB", sdB),
  netLogoOutputs += ("meanB", meanB),
  netLogoOutputs += ("meanGrperc", meanGrperc),
  
  //Default values. Can be removed if OpenMOLE Vals are set by values coming from the workflow
  regularOrganisation := true,
  grid := true,
  grpercCrit := 0.01,
  MeanPnetw := 0.01,
  SDPnetw := 0.002,
  Cooperation := true,
  Recruitment := false,
  rSpatialDistribution := "random-high",
  competition := false,
  networking := false,
  MortNoCompet := 0.001,
  benefit := 0.25,
  rVariation := "no-temporal",
  benefitSurv := true
  )

val csvHook = CSVHook(workDirectory / "result.csv", seed, nbTurtles, minimumGrowth, 
                                                    maximumGrowth, nbIndWithLinks, pctIndWithLinks,
                                                    meanNbOfNeighbors, minIndividualBiomassAlive, 

                                                    maxIndividualBiomassAlive, meanPtnew, sdB, meanB,meanGrperc)
val exploration = 
  DirectSampling(
    evaluation = Replication(task hook csvHook, seed, 10),
    sampling = density in (100, 506)
  )

exploration








//// end

(Juste Raimbault) #2

Hi Etienne,
i think

sampling = density in Seq(100, 506, 666, 432)

should work.
(but I dont know if it’s the clean/beautiful way to do it)


(Etienne Delay) #3

Nice ! Where can I find all those “primitives” ?


#4

There are many examples on this page:
https://next.openmole.org/Direct+Sampling.html#Explorationofseveralinputs

Feel free to propose improvements, there is an link for that at the bottom of the page.


(Etienne Delay) #5

:+1::ok_hand: