Commit 3f216f85 authored by Mathieu Leclaire's avatar Mathieu Leclaire
Browse files

Use directly OpenMOLE data API

parent 85719031
...@@ -30,3 +30,4 @@ metals.sbt ...@@ -30,3 +30,4 @@ metals.sbt
.DS_Store .DS_Store
*.history *.history
**/openmole/bin/org.openmole.marketindex/src/main/resources/openmole-market **/openmole/bin/org.openmole.marketindex/src/main/resources/openmole-market
result/*
...@@ -13,8 +13,7 @@ import boopickle.Default._ ...@@ -13,8 +13,7 @@ import boopickle.Default._
import scala.scalajs.js.typedarray.{ArrayBuffer, TypedArrayBuffer} import scala.scalajs.js.typedarray.{ArrayBuffer, TypedArrayBuffer}
import com.raquo.laminar.api.L._ import com.raquo.laminar.api.L._
import shared.DataUI import org.openmole.plugin.hook.omr.OMROutputFormat
import shared.DataUI.OMRData
object App { object App {
...@@ -31,21 +30,14 @@ object App { ...@@ -31,21 +30,14 @@ object App {
) )
Post[shared.Api].convergence().call().foreach {c=> Post[shared.Api].convergence().call().foreach {c=>
c match { convergencePlot.set(NSGA2.convergence(c))
case nsga2: DataUI.NSGA2.Convergence=> convergencePlot.set(NSGA2.convergence(nsga2))
case _=>
}
} }
Post[shared.Api].metadata().call().foreach {m=> Post[shared.Api].metadata().call().foreach {m=>
m match { setMetadata(m.OMRData)
case nsga2: DataUI.NSGA2.Metadata=> setMetadata(nsga2.OMRData) //println("M " + nsga2.OMRData.method)
case stNSGA2: DataUI.StochasticNSGA2.Metadata=> setMetadata(stNSGA2.OMRData)//println("M " + stNSGA2.OMRData.method)
}
} }
def setMetadata(omrData: OMRData) = { def setMetadata(omrData: OMROutputFormat.OMRData) = {
method.set(omrData.method) method.set(omrData.method)
experiment.set(s"${omrData.fileName} - ${omrData.version}") experiment.set(s"${omrData.fileName} - ${omrData.version}")
} }
......
...@@ -6,14 +6,12 @@ import org.openmole.plotlyjs.all._ ...@@ -6,14 +6,12 @@ import org.openmole.plotlyjs.all._
import scala.scalajs.js.JSConverters.{iterableOnceConvertible2JSRichIterableOnce, _} import scala.scalajs.js.JSConverters.{iterableOnceConvertible2JSRichIterableOnce, _}
import org.openmole.plotlyjs.PlotlyImplicits._ import org.openmole.plotlyjs.PlotlyImplicits._
import com.raquo.laminar.api.L._ import com.raquo.laminar.api.L._
import org.openmole.plotlyjs.HistogramDataBuilder.HistogramDataBuilder
import shared.DataUI
import scala.scalajs._ import scala.scalajs._
object NSGA2 { object NSGA2 {
def convergence(convergenceData: DataUI.NSGA2.Convergence) = { def convergence(convergence: org.openmole.plugin.method.evolution.data.AnalysisData.Convergence) = {
val plotDiv = div() val plotDiv = div()
val layout = Layout val layout = Layout
...@@ -24,9 +22,14 @@ object NSGA2 { ...@@ -24,9 +22,14 @@ object NSGA2 {
val data = linechart.lines val data = linechart.lines
val (generations, hypervolume) = convergence match {
case st: org.openmole.plugin.method.evolution.data.AnalysisData.StochasticNSGA2.Convergence => st.generations.map{gs => (gs.generation.toString, gs.hypervolume.getOrElse(0.0))}.unzip
case n: org.openmole.plugin.method.evolution.data.AnalysisData.NSGA2.Convergence=> n.generations.map{gs => (gs.generation.toString, gs.hypervolume.getOrElse(0.0))}.unzip
}
val dataRef = data val dataRef = data
.x(convergenceData.generationConvergence.map{_.generation.toString}.toJSArray) .x(generations.toJSArray)
.y(convergenceData.generationConvergence.map{_.hypervolume.getOrElse(0.0)}.toJSArray) .y(hypervolume.toJSArray)
.marker(marker.symbol(square).color(all.color.rgb(180, 0, 0)).size(12.0)) .marker(marker.symbol(square).color(all.color.rgb(180, 0, 0)).size(12.0))
val config = Config.displayModeBar(false) val config = Config.displayModeBar(false)
......
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