Commit 1355e796 authored by Romain Reuillon's avatar Romain Reuillon

[Plugin] enh: add objective metadata

parent b12b6d42
......@@ -26,17 +26,11 @@ sealed trait GUIPlugin
trait AuthenticationPlugin extends GUIPlugin {
type AuthType <: AuthenticationData
def data: AuthType
def factory: AuthenticationPluginFactory
def panel: TypedTag[HTMLElement]
def save(onsave: () Unit): Unit
def remove(onremoved: () Unit): Unit
def test: Future[Seq[Test]]
......@@ -46,18 +40,13 @@ sealed trait GUIPluginFactory {
trait AuthenticationPluginFactory extends GUIPluginFactory {
type AuthType <: AuthenticationData
def build(data: AuthType): AuthenticationPlugin
def buildEmpty: AuthenticationPlugin
def getData: Future[Seq[AuthType]]
trait WizardGUIPlugin extends GUIPlugin {
def factory: WizardPluginFactory
val panel: TypedTag[HTMLElement]
def save(
......@@ -71,10 +60,7 @@ trait WizardGUIPlugin extends GUIPlugin {
trait WizardPluginFactory extends GUIPluginFactory {
def build(safePath: SafePath, onPanelFilled: (LaunchingCommand) Unit): WizardGUIPlugin
def fileType: FileType
def parse(safePath: SafePath): Future[Option[LaunchingCommand]]
\ No newline at end of file
package org.openmole.plugin.method.evolution
import org.openmole.core.context.Val
import org.openmole.core.expansion.FromContext
import io.circe._
import io.circe.parser._
import io.circe.generic.extras.semiauto._
import io.circe.generic.extras.Configuration
import org.openmole.core.exception.InternalProcessingError
object Metadata {
def method = "evolution"
implicit val genDevConfig: Configuration = Configuration.default.withDiscriminator("implementation")
implicit val genDevConfig: Configuration = Configuration.default.withDiscriminator("implementation").withKebabCaseMemberNames
implicit val metadataEncoder: Encoder[Metadata] = deriveConfiguredEncoder[Metadata]
case class nsga2(genome: Seq[GenomeBoundData], generation: Long, frequency: Option[Long], method: String = method) extends Metadata
case class StochasticNSGA2(
genome: Seq[GenomeBoundData],
objective: Seq[NoisyObjectiveData],
generation: Long,
frequency: Option[Long],
method: String = method) extends Metadata
case object none extends Metadata
sealed trait GenomeBoundData
......@@ -26,19 +33,37 @@ object Metadata {
def apply(b: GenomeBound) = FromContext { p
import p._
b match {
case b: GenomeBound.ScalarDouble bound(, b.low.from(context).prettify(), b.high.from(context).prettify())
case b: GenomeBound.ScalarInt bound(, b.low.from(context).prettify(), b.high.from(context).prettify())
case b: GenomeBound.SequenceOfDouble bound(, b.low.from(context).prettify(), b.high.from(context).prettify())
case b: GenomeBound.SequenceOfInt bound(, b.low.from(context).prettify(), b.high.from(context).prettify())
case b: GenomeBound.Enumeration[_] enumeration(, b.values.prettify())
case b: GenomeBound.SequenceOfEnumeration[_] enumeration(, b.values.prettify())
case b: GenomeBound.ScalarDouble DoubleBound(, b.low.from(context), b.high.from(context))
case b: GenomeBound.ScalarInt IntBound(, b.low.from(context), b.high.from(context))
case b: GenomeBound.SequenceOfDouble DoubleSequenceBound(, b.low.from(context), b.high.from(context))
case b: GenomeBound.SequenceOfInt IntSequenceBound(, b.low.from(context), b.high.from(context))
case b: GenomeBound.Enumeration[_] Enumeration(,
case b: GenomeBound.SequenceOfEnumeration[_] Enumeration(,
case class bound(value: String, low: String, high: String) extends GenomeBoundData
case class enumeration(value: String, values: String) extends GenomeBoundData
case class DoubleBound(value: String, low: Double, high: Double) extends GenomeBoundData
case class IntBound(value: String, low: Int, high: Int) extends GenomeBoundData
case class DoubleSequenceBound(value: String, low: Array[Double], high: Array[Double]) extends GenomeBoundData
case class IntSequenceBound(value: String, low: Array[Int], high: Array[Int]) extends GenomeBoundData
case class Enumeration(value: String, values: Seq[String]) extends GenomeBoundData
object NoisyObjectiveData {
def apply(o: NoisyObjective[_]) = new NoisyObjectiveData(,, o.negative)
case class NoisyObjectiveData(
name: String,
delta: Option[Double],
negative: Boolean)
def fromString(s: String): Metadata =
decode[Metadata](s) match {
case Left(e) throw new InternalProcessingError(s"Error parsing metadata $s", e)
case Right(m) m
sealed trait Metadata
\ No newline at end of file
......@@ -156,8 +156,9 @@ object NSGA2 {
override def metadata(generation: Long, frequency: Option[Long]) = FromContext { p
import p._
import Metadata._
genome =,
objective =,
generation = generation,
frequency = frequency
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment