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