Skip to content

Instantly share code, notes, and snippets.

@ldacosta
Created June 9, 2015 20:50
Show Gist options
  • Save ldacosta/1b40a0e985649b44e5bf to your computer and use it in GitHub Desktop.
Save ldacosta/1b40a0e985649b44e5bf to your computer and use it in GitHub Desktop.
//
trait Model[T] {
def name: String // TODO: not sure of its utility
def randomPick: Seq[Double]
}
trait ContinuousModel[T] extends Model[T] {
implicit val continuousOpt: Continuous[T]
}
trait GaussianModel[T] extends ContinuousModel[T] {
def name: String
def mean: Seq[Double]
def stdDev: Seq[Double]
def randomPick: Seq[Double] = {
// TODO: using mean and variance select a point on that Gaussian. Then peg it to the constraints to have an actual point
Seq.empty // FIXME
}
}
//
trait Optimizable[T] {
// TODO: express the fact that "0" is better
def optimize(m: Model[T], fitnessF: T => Set[(Double, Probability)]): Option[T]
}
object Optimizable {
trait OptimizableGaussian[T] extends Optimizable[T] {
implicit val ops: Continuous[T]
def optimize(m: GaussianModel[T], fitnessF: T => Set[(Double, Probability)]): Option[T] = {
ops.fromDouble(m.mean) // TODO: whatever! I just wanted to express that the optimization could differ by family of Models.
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment