Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cilib.exec._
- import scalaz._
- import Scalaz._
- case class PrettyPrinter[S](progress: Progress[NonEmptyList[Entity[S, Double]]]) {
- def algorithm: String =
- "Algorithm: " + progress.algorithm
- def problem: String =
- "Problem: " + progress.problem
- def env: String =
- "Environment: " + progress.env
- def seed: String =
- "Seed Value: " + progress.seed
- def iteration: String =
- "Iteration: " + progress.iteration
- def data: String =
- progress.value.zipWithIndex.map(x => {
- "Entity " + (x._2 + 1) + "\n" +
- "Position: " + x._1.pos.pos.toList.mkString(", ") + "\n" +
- "Bounds: " + x._1.pos.boundary + "\n" +
- "Objective: " + { x._1.pos match {
- case Point(_, _) => "No Solution"
- case Solution(_, _, o) => o.toString
- }} + "\n"
- }).toList.mkString("\n")
- def print: String =
- List(algorithm, problem, env, seed, iteration, data).mkString("\n")
- }
- /* Example output
- Algorithm: gbestPSO
- Problem: spherical
- Environment: Unchanged
- Seed Value: 12
- Iteration: 1000
- Entity 1
- Position: -8.730969538820549E-37, -6.901927373365559E-39, 9.052529288449284E-38
- Bounds: NonEmpty[[-5.12, 5.12],[-5.12, 5.12],[-5.12, 5.12]]
- Objective: Single(Feasible(7.705407561314136E-73),List())
- Entity 2
- Position: 8.861523679566886E-37, -2.6192883222213787E-37, 2.272751331731796E-39
- Bounds: NonEmpty[[-5.12, 5.12],[-5.12, 5.12],[-5.12, 5.12]]
- Objective: Single(Feasible(8.538778977831153E-73),List())
- ...
- */
Add Comment
Please, Sign In to add comment