Commit e314f1c4 authored by Hélène Arduin's avatar Hélène Arduin
Browse files

Merge branch 'dev' of ssh://gitlab.openmole.org:10000/openmole/openmole into dev

parents ca62139e 13139b5f
Pipeline #1187 failed with stages
in 24 minutes and 41 seconds
......@@ -18,6 +18,7 @@
package org.openmole.modules
import org.openmole.core.module._
import org.openmole.plugin.task.spatial.SpatialSampling
import org.openmole.tool.file._
import org.openmole.tool.hash._
......@@ -52,7 +53,7 @@ object module {
ModuleEntry("CSVSampling", "Generate sampling using CSV files", components(org.openmole.plugin.sampling.csv.CSVSampling), sampling),
ModuleEntry("LHS", "Generate Latin Hypercube Sampling", components(org.openmole.plugin.sampling.lhs.LHS), sampling),
ModuleEntry("QuasiRandom", "Generate sampling using low-discrepency sequences", components(org.openmole.plugin.sampling.quasirandom.SobolSampling), sampling),
ModuleEntry("QuasiRandom", "Generate spatial samplings", components(org.openmole.plugin.sampling.spatial.SpatialSampling), sampling),
ModuleEntry("QuasiRandom", "Generate spatial samplings", components(SpatialSampling), sampling),
ModuleEntry("Evolution", "Explore/calibrate models using evolutionary algorithms", components(org.openmole.plugin.method.evolution.NSGA2), method),
ModuleEntry("ABC", "Calibrate models using bayesian algorithms", components(org.openmole.plugin.method.abc.ABC), method),
ModuleEntry("Sensitivity", "Statistical sensitivity analisys", components(org.openmole.plugin.method.sensitivity.SensitivityMorris), method)
......
......@@ -177,15 +177,7 @@ object DocumentationPages {
def allPages = docPages.flatMap { _.sons } ++ tutoPages.sons ++ communityPages.sons ++ downloadPages.sons ++ headPages
def headPages: Seq[PageTree] = docPages ++ Seq(plugPages, explorePages, scalePages, languagePages, developersPages, tutoPages, communityPages, downloadPages)
val mainDocPages = plugPages.sons.map {
_.page
} ++ explorePages.sons.map {
_.page
} ++ scalePages.sons.map {
_.page
} ++ Seq(scale, explore, plug)
def headPages: Seq[PageTree] = docPages ++ Seq(plugPages, explorePages, scalePages, utilityTaskPages, languagePages, developersPages, tutoPages, communityPages, downloadPages)
// Documentation
lazy val documentation = DocumentationPage.fromScalatex(name = "Documentation", content = scalatex.documentation.Documentation)
......@@ -195,6 +187,7 @@ object DocumentationPages {
explorePages,
samplingPages,
scalePages,
utilityTaskPages,
languagePages,
advancedConceptsPages,
developersPages,
......@@ -208,7 +201,7 @@ object DocumentationPages {
val faq = DocumentationPage.fromScalatex(name = "FAQ", content = scalatex.FAQ, title = Some("Frequently Asked Questions"))
// Plug
def plugPages = pageNode(plug, Vector(scala, java, container, python, r, netLogo, gama, scilab, tool))
def plugPages = pageNode(plug, Vector(scala, java, container, python, r, netLogo, gama, scilab))
lazy val plug = DocumentationPage.fromScalatex(name = "Plug", content = scalatex.documentation.plug.Plug, title = Some("Plug Your Model"))
lazy val scala = DocumentationPage.fromScalatex(name = "Scala", content = scalatex.documentation.plug.Scala)
......@@ -219,14 +212,13 @@ object DocumentationPages {
lazy val scilab = DocumentationPage.fromScalatex(name = "Scilab", content = scalatex.documentation.plug.Scilab)
lazy val gama = DocumentationPage.fromScalatex(name = "GAMA", content = scalatex.documentation.plug.GAMA)
lazy val container = DocumentationPage.fromScalatex(name = "Executable", content = scalatex.documentation.plug.Container)
lazy val tool = DocumentationPage.fromScalatex(name = "Tool", content = scalatex.documentation.plug.Tool)
// Explore
def explorePages = pageNode(explore, Vector(samplings, calibration, sensitivity, profile, pse, ose, abc))
lazy val explore = DocumentationPage.fromScalatex(name = "Explore", content = scalatex.documentation.explore.Explore, title = Some("Explore Your Model"))
def samplingPages = pageNode(samplings, Vector(elementarySamplings, highDimensionSamplings, uniformSampling, fileSampling, spatialSampling, customSampling, advancedSampling, aggregationSampling))
def samplingPages = pageNode(samplings, Vector(elementarySamplings, highDimensionSamplings, uniformSampling, fileSampling, customSampling, advancedSampling, aggregationSampling))
lazy val samplings = DocumentationPage.fromScalatex(name = "Samplings", content = scalatex.documentation.explore.sampling.Samplings)
lazy val elementarySamplings = DocumentationPage.fromScalatex(name = "Elementary Samplings", content = scalatex.documentation.explore.sampling.ElementarySamplings)
......@@ -238,7 +230,6 @@ object DocumentationPages {
// lazy val sobolSampling = DocumentationPage.fromScalatex(name = "Sobol Sampling", content = scalatex.documentation.explore.sampling.SobolSampling)
lazy val customSampling = DocumentationPage.fromScalatex(name = "Custom Sampling", content = scalatex.documentation.explore.sampling.CustomSampling)
lazy val fileSampling = DocumentationPage.fromScalatex(name = "Sampling Over Files", content = scalatex.documentation.explore.sampling.FileSampling)
lazy val spatialSampling = DocumentationPage.fromScalatex(name = "Spatial Sampling", content = scalatex.documentation.explore.sampling.SpatialSampling)
lazy val advancedSampling = DocumentationPage.fromScalatex(name = "Operations on Samplings", content = scalatex.documentation.explore.sampling.AdvancedSampling, title = Some("Advanced Operations on Samplings"))
lazy val aggregationSampling = DocumentationPage.fromScalatex(name = "Aggregate Sampling Results", content = scalatex.documentation.explore.sampling.Aggregation)
......@@ -260,7 +251,7 @@ object DocumentationPages {
lazy val dispatch = DocumentationPage.fromScalatex(name = "Dispatch", content = scalatex.documentation.scale.Dispatch, title = Some("Dispatch Jobs on Multiple Environments"))
// Language
def languagePages = pageNode(language, Vector(fileManagement, scalaFunction, hook, transition, source, capsule, moleTask))
def languagePages = pageNode(language, Vector(fileManagement, scalaFunction, hook, transition, source, capsule))
lazy val language = DocumentationPage.fromScalatex(name = "Language", content = scalatex.documentation.language.Language, title = Some("The OpenMOLE Language"))
lazy val fileManagement = DocumentationPage.fromScalatex(name = "File Management", content = scalatex.documentation.language.FileManagement)
......@@ -270,7 +261,13 @@ object DocumentationPages {
lazy val transition = DocumentationPage.fromScalatex(name = "Transitions", content = scalatex.documentation.language.advanced.Transition)
lazy val source = DocumentationPage.fromScalatex(name = "Source", content = scalatex.documentation.language.advanced.Source)
lazy val capsule = DocumentationPage.fromScalatex(name = "Capsule", content = scalatex.documentation.language.advanced.Capsule)
lazy val moleTask = DocumentationPage.fromScalatex(name = "Mole Task", content = scalatex.documentation.language.advanced.MoleTask)
def utilityTaskPages = pageNode(utilityTask, Vector(templateTask, moleTask, spatialTask))
lazy val utilityTask = DocumentationPage.fromScalatex(name = "Utility Tasks", content = scalatex.documentation.utilityTask.Task)
lazy val templateTask = DocumentationPage.fromScalatex(name = "Template Task", content = scalatex.documentation.utilityTask.TemplateTask)
lazy val moleTask = DocumentationPage.fromScalatex(name = "Mole Task", content = scalatex.documentation.utilityTask.MoleTask)
lazy val spatialTask = DocumentationPage.fromScalatex(name = "Spatial Task", content = scalatex.documentation.utilityTask.SpatialTask)
// Advanced Concepts
def advancedConceptsPages = pageNode(advancedConcepts, Vector(geneticAlgorithm, island, stochasticityManagement))
......
......@@ -20,9 +20,14 @@
@sitemap.siteMapSection(explorePages.diff(Seq(samplings)))
@li
@h3
@a(scale.title, href := scale.file)
@a(scale.title, href := scale.file)
@ol
@sitemap.siteMapSection(scalePages)
@li
@h3
@a(utilityTask.title, href := utilityTask.file)
@ol
@sitemap.siteMapSection(utilityTaskPages)
@li
@h3
@a(language.title, href := language.file)
......
......@@ -15,9 +15,9 @@ More generally, the @aa("spatial data library", href:= "https://github.com/openm
@br
Some of the corresponding spatial generators are included in OpenMOLE as @i{Spatial Samplings}.
Some of the corresponding spatial generators are included in OpenMOLE as @i{Task}.
In the current development version, only some grid generators are included, for a reason of types for output prototypes (synthetic networks are difficult to represent as simple types and to feed as inputs to models).
All generators output the generated grids in a provided prototype, along with the generation parameters for the generators taking factors as arguments.
All generators output the generated grids in a provided @code{Val[Array[Array[Double]}, along with the generation parameters for the generators taken as arguments.
......@@ -25,19 +25,24 @@ All generators output the generated grids in a provided prototype, along with th
A raster with random values:
@br@br
@hl.openmole("""val myGrid = Val[Array[Array[Double]]]
val myDensity = Val[Double]
val myGenerator =
RandomSpatialSamplingTask(
grid = myGrid,
gridSize = 10,
density = myDensity
)
val myModel =
ScalaTask("println(myGrid.size)") set (
(inputs, outputs) += myGrid
)
DirectSampling(
sampling = (myDensity in (0.0 to 1.0 by 0.1)) x (myGrid is RandomSpatialSampling(gridSize = 10, density = myDensity)),
evaluation = myModel
sampling = myDensity in (0.0 to 1.0 by 0.1),
evaluation = myGenerator -- myModel
)""", name= "random grid sampling")
@br
......@@ -52,14 +57,22 @@ where
A binary grid with random blocks (random size and position). With the same arguments as before, except the factors for the generator parameters: @code{blocksNumber} is the number of blocks positioned, @code{blocksMinSize}/@code{blocksMaxSize} minimal/maximal (exchanged if needed) width/height of blocks, each being uniformly drawn for each block.
@br@br
@hl.openmole("""
val myGrid = Val[Array[Array[Double]]]
val myBlocksNumber = Val[Int]
val myBlocksMinSize = Val[Int]
val myBlocksMaxSize = Val[Int]
val myGenerator =
RandomSpatialSamplingTask(
grid = myGrid,
gridSize = 10,
number = myBlocksNumber,
minSize = myBlocksMinSize,
maxSize = myBlocksMaxSize
)
val myModel =
ScalaTask("println(myGrid.size)") set (
(inputs, outputs) += myGrid
......@@ -69,17 +82,14 @@ DirectSampling(
sampling =
(myBlocksNumber in (10 to 15)) x
(myBlocksMinSize in (1 to 3)) x
(myBlocksMaxSize in RangeDomain[Int]("myBlocksMinSize + 3", "myBlocksMinSize + 5")) x
(myGrid is BlocksGridSpatialSampling(gridSize = 10, number = myBlocksNumber, minSize = myBlocksMinSize, maxSize = myBlocksMaxSize)),
evaluation = myModel
(myBlocksMaxSize in RangeDomain[Int]("myBlocksMinSize + 3", "myBlocksMinSize + 5")),
evaluation = myGenerator -- myModel
)""", name="block grid sampling")
@h2{Thresholded exponential mixture sampling}
A binary grid created with an exponential mixture, with kernels of the form @code{exp(-r/r0)}. A threshold parameter is applied to produce the binary grid.
@br@br
@hl.openmole("""
val myGrid = Val[Array[Array[Double]]]
......@@ -87,6 +97,15 @@ val myCenter = Val[Int]
val myRadius = Val[Double]
val myThreshold = Val[Double]
val myGenerator =
ExpMixtureThresholdSpatialSamplingTask(
grid = myGrid,
gridSize = 10,
center = myCenter,
radius = myRadius,
threshold = myThreshold
)
val myModel =
ScalaTask("println(myGrid.size)") set (
(inputs, outputs) += myGrid
......@@ -96,9 +115,8 @@ DirectSampling(
sampling =
(myCenter in (1 to 20)) x
(myRadius in (1.0 to 20.0)) x
(myThreshold in (2.0 to 30.0)) x
(myGrid is ExpMixtureThresholdSpatialSampling(gridSize = 10, center = myCenter, radius = myRadius, threshold = myThreshold)),
evaluation = myModel
(myThreshold in (2.0 to 30.0)),
evaluation = myGenerator -- myModel
)""", name="block grid sampling")
@br
......@@ -120,14 +138,20 @@ A binary grid resembling a labyrinthine building organisation, obtained by perco
It percolates a grid network until a fixed number of points on the boundaries of the world are linked through the giant cluster.
The resulting network is transposed to a building configuration by assimilating each link to a street with a given width as a parameter.
@br@br
@hl.openmole("""
val myGrid = Val[Array[Array[Double]]]
val myPercolation = Val[Double]
val myBordPoint = Val[Int]
val myLinkWidth = Val[Double]
val myGenerator =
PercolationGridSpatialSamplingTask(
grid = myGrid,
gridSize = 10,
percolation = myPercolation,
bordPoint = myBordPoint,
linkWidth = myLinkWidth)
val myModel =
ScalaTask("println(myGrid.size)") set (
(inputs, outputs) += myGrid
......@@ -137,9 +161,8 @@ DirectSampling(
sampling =
(myPercolation in (0.1 to 1.0 by 0.1)) x
(myBordPoint in (1 to 30)) x
(myLinkWidth in (1.0 to 5.0)) x
(myGrid is PercolationGridSpatialSampling(gridSize = 10, percolation = myPercolation, bordPoint = myBordPoint, linkWidth = myLinkWidth)),
evaluation = myModel
(myLinkWidth in (1.0 to 5.0)),
evaluation = myGenerator -- myModel
)""", name="percolation grid sampling")
@br
......@@ -159,12 +182,20 @@ Urban morphogenesis model for population density introduced by @aa("(Raimbault,
@b{USE WITH CAUTION - SOME PARAMETER VALUES YIELD VERY LONG GENERATION RUNTIME}
@br@br
@hl.openmole("""
val myGrid = Val[Array[Array[Double]]]
val myGrowthRate = Val[Double]
val myGenerator =
ReactionDiffusionSpatialTask(
grid = myGrid,
gridSize = 10,
alpha = 10.0,
beta = 10.0,
nBeta = 10,
growthRate = myGrowthRate,
totalPopulation = 10)
val myModel =
ScalaTask("println(myGrid.size)") set (
(inputs, outputs) += myGrid
......@@ -172,9 +203,8 @@ val myModel =
DirectSampling(
sampling =
(myGrowthRate in (1.0 to 10.0)) x
(myGrid is ReactionDiffusionSpatialSampling(gridSize = 10, alpha = 10.0, beta = 10.0, nBeta = 10, growthRate = myGrowthRate, totalPopulation = 10)),
evaluation = myModel
(myGrowthRate in (1.0 to 10.0)),
evaluation = myGenerator -- myModel
)""", name="reaction diffusion grid sampling")
@br
......
@import org.openmole.site._
@import org.openmole.site.tools._
@import DocumentationPages._
This part exposes utility task, that might be useful as pre or post processing task when you design your experiments.
......@@ -490,7 +490,7 @@ lazy val sensitivity = OsgiProject(pluginDir, "org.openmole.plugin.method.sensit
/* Sampling */
def allSampling = Seq(combineSampling, csvSampling, oneFactorSampling, lhsSampling, quasirandomSampling, spatialSampling)
def allSampling = Seq(combineSampling, csvSampling, oneFactorSampling, lhsSampling, quasirandomSampling)
lazy val combineSampling = OsgiProject(pluginDir, "org.openmole.plugin.sampling.combine", imports = Seq("*")) dependsOn(exception, modifierDomain, collectionDomain, workflow) settings (pluginSettings: _*)
......@@ -507,11 +507,6 @@ lazy val quasirandomSampling = OsgiProject(pluginDir, "org.openmole.plugin.sampl
) settings (pluginSettings: _*)
lazy val spatialSampling = OsgiProject(pluginDir, "org.openmole.plugin.sampling.spatial", imports = Seq("*")) dependsOn(exception, workflow, workspace) settings(
libraryDependencies += Libraries.math,
libraryDependencies += Libraries.spatialsampling
) settings (pluginSettings: _*)
/* Source */
def allSource = Seq(fileSource)
......@@ -521,7 +516,7 @@ lazy val fileSource = OsgiProject(pluginDir, "org.openmole.plugin.source.file",
/* Task */
def allTask = Seq(toolsTask, external, netLogo, netLogo5, netLogo6, jvm, scala, template, systemexec, container, r, scilab, python, gama, cormas, timing)
def allTask = Seq(toolsTask, external, netLogo, netLogo5, netLogo6, jvm, scala, template, systemexec, container, r, scilab, python, gama, cormas, spatial, timing)
lazy val toolsTask = OsgiProject(pluginDir, "org.openmole.plugin.task.tools", imports = Seq("*")) dependsOn (openmoleDSL) settings (pluginSettings: _*)
......@@ -559,6 +554,10 @@ lazy val cormas = OsgiProject(pluginDir, "org.openmole.plugin.task.cormas", impo
lazy val timing = OsgiProject(pluginDir, "org.openmole.plugin.task.timing", imports = Seq("*")) dependsOn (openmoleDSL) settings (pluginSettings: _*)
lazy val spatial = OsgiProject(pluginDir, "org.openmole.plugin.task.spatial", imports = Seq("*")) dependsOn(openmoleDSL) settings(
libraryDependencies += Libraries.math,
libraryDependencies += Libraries.spatialsampling
) settings (pluginSettings: _*)
/* ---------------- REST ------------------- */
......
......@@ -24,6 +24,7 @@ import org.openmole.core.preference.Preference
import org.openmole.core.serializer.SerializerService
import org.openmole.core.threadprovider.ThreadProvider
import org.openmole.core.workflow.builder.{ InfoConfig, InputOutputConfig }
import org.openmole.core.workflow.mole.Ticket
import org.openmole.core.workflow.tools._
import org.openmole.core.workspace.{ TmpDirectory, Workspace }
import org.openmole.tool.cache.KeyValueCache
......@@ -33,6 +34,7 @@ import org.openmole.tool.random.RandomProvider
case class HookExecutionContext(
cache: KeyValueCache,
ticket: Ticket,
implicit val preference: Preference,
implicit val threadProvider: ThreadProvider,
implicit val fileService: FileService,
......
......@@ -259,6 +259,7 @@ object MoleExecution extends JavaLogger {
val services = executionContext.services
HookExecutionContext(
cache = cache,
ticket = ticket,
preference = services.preference,
threadProvider = services.threadProvider,
fileService = services.fileService,
......@@ -681,7 +682,7 @@ class MoleExecution(
def endTime(implicit s: MoleExecution.SynchronisationContext) = sync(_endTime)
private[mole] var ticketNumber = 1L
private[mole] val rootTicket = Ticket(id, 0)
private[mole] val rootTicket = Ticket.root(0L)
private[mole] var moleId = 0L
......
......@@ -18,19 +18,26 @@
package org.openmole.core.workflow.mole
object Ticket {
def apply(category: String, content: Long) = new Ticket(content, null)
def root(content: Long) = new Ticket(content, null)
def apply(parent: Ticket, content: Long) = new Ticket(content, parent)
implicit def ordering = Ordering.by[Ticket, Long](_.content)
def toString(t: Ticket): String = t.content.toString
}
class Ticket(val content: Long, _parent: Ticket) {
def parent = Some(_parent)
sealed class Ticket(val content: Long, _parent: Ticket) {
def parent = Option(_parent)
def parentOrException = parent.getOrElse(throw new InternalError("This is a root ticket, it has no parent."))
def isRoot: Boolean = _parent == null
override def equals(obj: Any): Boolean = content == obj
override def toString = Ticket.toString(this)
override def equals(obj: Any): Boolean = obj match {
case t: Ticket t.content == content
case t: Long t == content
case _ false
}
override def hashCode = content.hashCode
}
package org.openmole.plugin.sampling
import org.openmole.spatialsampling
package object spatial {
type RasterLayerData[N] = spatialsampling.RasterLayerData[N]
type RasterData[N] = spatialsampling.RasterData[N]
type RasterDim = spatialsampling.RasterDim
type Point = spatialsampling.Point
}
package org.openmole.plugin.sampling.spatial
package org.openmole.plugin.task.spatial
import org.openmole.core.pluginregistry.PluginRegistry
import org.osgi.framework.{ BundleActivator, BundleContext }
......@@ -14,12 +14,12 @@ class Activator extends BundleActivator {
val keyWords: Vector[HighLight] =
Vector(
SamplingHighLight(objectName(RandomSpatialSampling)),
SamplingHighLight(objectName(RandomSpatialSamplingTask)),
SamplingHighLight(objectName(ExponentialMixtureSpatialSampling)),
SamplingHighLight(objectName(ReactionDiffusionSpatialSampling)),
SamplingHighLight(objectName(BlocksGridSpatialSampling)),
SamplingHighLight(objectName(PercolationGridSpatialSampling)),
SamplingHighLight(objectName(ExpMixtureThresholdSpatialSampling))
SamplingHighLight(objectName(ReactionDiffusionSpatialTask)),
SamplingHighLight(objectName(BlocksGridSpatialSamplingTask)),
SamplingHighLight(objectName(PercolationGridSpatialSamplingTask)),
SamplingHighLight(objectName(ExpMixtureThresholdSpatialSamplingTask))
)
PluginRegistry.register(this, Vector(this.getClass.getPackage), highLight = keyWords)
......
package org.openmole.plugin.sampling.spatial
import com.google.common.collect.DiscreteDomain
import org.openmole.core.context.{ Val, Variable }
import org.openmole.core.expansion._
import org.openmole.core.workflow.domain.{ DiscreteFromContextDomain }
import org.openmole.core.workflow.sampling._
import org.openmole.core.workflow.tools.{ OptionalArgument, ScalarOrSequenceOfDouble }
package org.openmole.plugin.task.spatial
import org.openmole.core.dsl._
import org.openmole.core.dsl.extension._
import org.openmole.spatialsampling._
object SpatialSampling {
......@@ -50,7 +46,7 @@ object SpatialSampling {
}
object ExpMixtureThresholdSpatialSampling {
object ExpMixtureThresholdSpatialSamplingTask {
/**
* Sampling of binary density grids with a thresholded exponential mixture. Parameters are randomly sampled.
......@@ -61,10 +57,11 @@ object ExpMixtureThresholdSpatialSampling {
* @param threshold threshold for the binary grid (max of kernels is at 1)
*/
def apply(
grid: Val[Array[Array[Double]]],
gridSize: FromContext[Int],
center: FromContext[Int],
radius: FromContext[Double],
threshold: FromContext[Double]) = FromContext { p
threshold: FromContext[Double])(implicit scope: DefinitionScope) = Task("ExpMixtureThresholdSpatialSamplingTask") { p
import p._
val size = gridSize.from(context)
......@@ -73,12 +70,17 @@ object ExpMixtureThresholdSpatialSampling {
val r = radius.from(context)
val t = threshold.from(context)
Generation.expMixtureGrid(Left(size), nc, 1.0, r)(random()).map { _.map { d if (d > t) 1.0 else 0.0 } }
}
Context(
grid -> Generation.expMixtureGrid(Left(size), nc, 1.0, r)(random()).map { _.map { d if (d > t) 1.0 else 0.0 } }
)
} set (
inputs ++= gridSize.inputs ++ center.inputs ++ radius.inputs ++ threshold.inputs,
outputs += grid
) withValidate (gridSize.validate ++ center.validate ++ radius.validate ++ threshold.validate)
}
object PercolationGridSpatialSampling {
object PercolationGridSpatialSamplingTask {
/**
* Binary density grids through network percolation
......@@ -89,12 +91,13 @@ object PercolationGridSpatialSampling {
* @param linkWidth size of links
*/
def apply(
grid: Val[Array[Array[Double]]],
gridSize: FromContext[Int],
percolation: FromContext[Double],
bordPoint: FromContext[Int],
linkWidth: FromContext[Double],
maxIteration: Int = 10000
) = FromContext { p
maxIteration: Int = 10000
)(implicit scope: DefinitionScope) = Task("PercolationGridSpatialSamplingTask") { p
import p._
val size = gridSize.from(context)
......@@ -103,11 +106,16 @@ object PercolationGridSpatialSampling {
val b = bordPoint.from(context)
val w = linkWidth.from(context)
Generation.percolationGrid(size, pp, b, w, maxIteration)(random()).map { _.map { d if (d > 0.0) 1.0 else 0.0 } }
}
Context(
grid -> Generation.percolationGrid(size, pp, b, w, maxIteration)(random()).map { _.map { d if (d > 0.0) 1.0 else 0.0 } }
)
} set (
inputs ++= gridSize.inputs ++ percolation.inputs ++ bordPoint.inputs ++ linkWidth.inputs,
outputs += grid
) withValidate (gridSize.validate ++ percolation.validate ++ bordPoint.validate ++ linkWidth.validate)
}
object BlocksGridSpatialSampling {
object BlocksGridSpatialSamplingTask {
/**
* Binary density grid filled with blocks
......@@ -118,11 +126,12 @@ object BlocksGridSpatialSampling {
* @param gridSize size
*/
def apply(
grid: Val[Array[Array[Double]]],
gridSize: FromContext[Int],
number: FromContext[Int],
minSize: FromContext[Int],