Last active
December 19, 2015 13:59
-
-
Save roland-ewald/5966558 to your computer and use it in GitHub Desktop.
Optimization with SESSL: a simple example (see http://sessl.org for details)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sessl._ | |
import sessl.optimization._ | |
//Bindings: we use JAMES II for simulation and opt4J for optimization | |
import sessl.james._ | |
import sessl.opt4j._ | |
maximize { (params, objective) => | |
execute{ | |
new Experiment with Observation with ParallelExecution { | |
model = "java://examples.sr.LinearChainSystem" | |
set("propensity" <~ params("p")) //Set model parameters as defined by optimizer | |
set("numOfInitialParticles" <~ params("n")) | |
stopTime = 1.0 | |
replications = 10 | |
observe("S0", "S1") | |
observeAt(0.8) | |
withReplicationsResult(results => { | |
objective <~ results.mean("S0") //Store value of objective function | |
}) | |
} | |
} | |
} using (new Opt4JSetup { | |
param("p", 1, 1, 15) // Optimization parameter bounds | |
param("n", 10000, 100, 15000) | |
optimizer = EvolutionaryAlgorithm(generations = 30, alpha = 10) //Configure optimizer | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment