Skip to content

Instantly share code, notes, and snippets.

@roland-ewald
Last active December 19, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roland-ewald/5966558 to your computer and use it in GitHub Desktop.
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)
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