Commit 0ac0ce72 authored by Romain Reuillon's avatar Romain Reuillon
Browse files

[Plugin] fix: update mgo

parent 1f8fc57d
......@@ -226,7 +226,7 @@ lazy val squants =
) settings(settings: _*)
lazy val mgoVersion = "3.28"
lazy val mgoVersion = "3.29"
lazy val mgo = OsgiProject(dir, "mgo", exports = Seq("mgo.*", "freestyle.*"), imports = Seq("!better.*", "!javax.xml.*", "!scala.meta.*", "!sun.misc.*", "*"), privatePackages = Seq("!scala.*", "!monocle.*", "!org.apache.commons.math3.*", "!cats.*", "!squants.*", "!scalaz.*", "*")) settings(
libraryDependencies += "fr.iscpif" %% "mgo" % mgoVersion,
......
......@@ -126,7 +126,7 @@ object NSGA2 {
}
def migrateToIsland(population: Vector[I]) = DeterministicGAIntegration.migrateToIsland(population)
def migrateFromIsland(population: Vector[I], state: S) = population
def migrateFromIsland(population: Vector[I], state: S) = DeterministicGAIntegration.migrateFromIsland(population)
def afterGeneration(g: Long, population: Vector[I]): M[Boolean] = interpret { impl
import impl._
......
......@@ -98,18 +98,9 @@ object NoisyNichedNSGA2Algorithm {
import cats.implicits._
import shapeless._
def aggregatedFitness[P: Manifest](aggregation: Vector[P] Vector[Double]): Individual[P] Vector[Double] =
NoisyNSGA2Operations.aggregated[Individual[P], P](vectorFitness[P].get, aggregation)(_)
def aggregatedFitness[P: Manifest](aggregation: Vector[P] Vector[Double]): Individual[P] Vector[Double] = NoisyNSGA2.fitness[P](aggregation)
case class Result[N](continuous: Vector[Double], discrete: Vector[Int], fitness: Vector[Double], niche: N, replications: Int)
// def result[N, P: Manifest](
// population: Vector[Individual[P]],
// aggregation: Vector[P] => Vector[Double],
// niche: Individual[P] => N,
// continuous: Vector[C],
// onlyOldest: Boolean) = {
def result[N, P: Manifest](
population: Vector[Individual[P]],
aggregation: Vector[P] Vector[Double],
......@@ -119,12 +110,12 @@ object NoisyNichedNSGA2Algorithm {
def nicheResult(population: Vector[Individual[P]]) =
if (population.isEmpty) population
else if (onlyOldest) {
val firstFront = keepFirstFront(population, NoisyNSGA2Operations.aggregated(vectorFitness[P].get, aggregation))
val firstFront = keepFirstFront(population, NoisyNSGA2.fitness[P](aggregation))
val sorted = firstFront.sortBy(-_.fitnessHistory.size)
val maxHistory = sorted.head.fitnessHistory.size
firstFront.filter(_.fitnessHistory.size == maxHistory)
}
else keepFirstFront(population, NoisyNSGA2Operations.aggregated(vectorFitness[P].get, aggregation))
else keepFirstFront(population, NoisyNSGA2.fitness[P](aggregation))
nicheElitism[Id, Individual[P], N](population, nicheResult, niche).map { i
val (c, d, f, r) = NoisyIndividual.aggregate[P](i, aggregation, continuous)
......@@ -152,8 +143,7 @@ object NoisyNichedNSGA2Algorithm {
def adaptiveBreeding[M[_]: cats.Monad: Random: Generation, P: Manifest](lambda: Int, operatorExploration: Double, cloneProbability: Double, aggregation: Vector[P] Vector[Double], discrete: Vector[D]): Breeding[M, Individual[P], Genome] =
NoisyNSGA2Operations.adaptiveBreeding[M, Individual[P], Genome, P](
vectorFitness[P].get,
aggregation,
aggregatedFitness(aggregation),
Individual.genome.get,
continuousValues.get,
continuousOperator.get,
......@@ -166,15 +156,16 @@ object NoisyNichedNSGA2Algorithm {
operatorExploration,
cloneProbability)
def elitism[M[_]: cats.Monad: Random: Generation, N, P: Manifest](niche: Niche[Individual[P], N], muByNiche: Int, historySize: Int, aggregation: Vector[P] Vector[Double], components: Vector[C]): Elitism[M, Individual[P]] =
def elitism[M[_]: cats.Monad: Random: Generation, N, P: Manifest](niche: Niche[Individual[P], N], muByNiche: Int, historySize: Int, aggregation: Vector[P] Vector[Double], components: Vector[C]): Elitism[M, Individual[P]] = {
def individualValues(i: Individual[P]) = values(Individual.genome.get(i), components)
NoisyProfileOperations.elitism[M, Individual[P], N, P](
vectorFitness[P],
aggregation,
i values(Individual.genome.get(i), components),
Individual.historyAge,
historySize,
aggregatedFitness(aggregation),
mergeHistories(individualValues, vectorFitness, Individual.historyAge, historySize),
individualValues,
niche,
muByNiche)
}
def expression[P: Manifest](fitness: (util.Random, Vector[Double], Vector[Int]) P, continuous: Vector[C]): (util.Random, Genome) Individual[P] =
NoisyIndividual.expression(fitness, continuous)
......
......@@ -58,7 +58,6 @@ object PSEAlgorithm {
@Lenses case class Individual(
genome: Genome,
phenotype: Array[Double],
mapped: Boolean = false,
foundedIsland: Boolean = false)
case class Result(continuous: Vector[Double], discrete: Vector[Int], pattern: Vector[Int], phenotype: Vector[Double])
......@@ -104,8 +103,7 @@ object PSEAlgorithm {
PSEOperations.elitism[M, Individual, Vector[Double]](
i values(Individual.genome.get(i), continuous),
vectorPhenotype.get,
pattern,
Individual.mapped)
pattern)
def expression(phenotype: (Vector[Double], Vector[Int]) Vector[Double], continuous: Vector[C]): Genome Individual =
deterministic.expression[Genome, Individual](
......@@ -141,8 +139,7 @@ object NoisyPSEAlgorithm {
@Lenses case class Individual[P](
genome: Genome,
historyAge: Long,
phenotypeHistory: Array[P],
mapped: Boolean = false)
phenotypeHistory: Array[P])
def buildIndividual[P: Manifest](genome: Genome, phenotype: P) = Individual(genome, 1, Array(phenotype))
def vectorPhenotype[P: Manifest] = Individual.phenotypeHistory[P] composeLens arrayToVectorLens
......@@ -182,7 +179,6 @@ object NoisyPSEAlgorithm {
vectorPhenotype[P],
aggregation,
pattern,
Individual.mapped,
Individual.historyAge,
historySize)
......@@ -334,7 +330,6 @@ object PSE {
def migrateFromIsland(population: Vector[I], state: S) =
population.filter(i !PSEAlgorithm.Individual.foundedIsland.get(i)).
map(PSEAlgorithm.Individual.mapped.set(false)).
map(PSEAlgorithm.Individual.foundedIsland.set(false))
}
......
......@@ -8,7 +8,7 @@ object Libraries {
lazy val gridscaleVersion = "2.21"
lazy val sshjVersion = "0.27.0"
lazy val mgoVersion = "3.28"
lazy val mgoVersion = "3.29"
lazy val bouncyCastleVersion = "1.60"
lazy val d3Version = "3.5.12"
lazy val tooltipserVersion = "3.3.0"
......
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