Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/microbenchmarking #139

Merged
merged 4 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package satify.update.converters.tseitin.benchmark

import org.scalameter.api.*
import satify.model.problems.{NQueens, GraphColoring, NurseScheduling}
import satify.update.converters.Converter
import satify.update.converters.ConverterType.Tseitin

object ConversionMemoryBenchmark extends Bench.OfflineReport:
override def measurer = new Measurer.MemoryFootprint

performance of "N-Queens conversion memory" in {
val sizes: Gen[Int] = Gen.range("size")(2, 10, 1)
measure method "N-Queens Conversion" in {
using(sizes) in { size =>
val cnf = Converter(Tseitin).convert(NQueens(size).exp, false)
}
}
}

performance of "Graph-Coloring conversion memory" in {
val nodes = List("n1", "n2", "n3")
val edges = List(("n1", "n2"), ("n2", "n3"))
val colors = 2
val sizes: Gen[Int] = Gen.range("size")(0, 1, 1)
measure method "Graph-Coloring Conversion" in {
using(sizes) in { size =>
val cnf = Converter(Tseitin).convert(GraphColoring(edges, nodes, colors).exp, false)
}
}
}

performance of "Nurse-Scheduling conversion memory" in {
val nurses = 3
val days = 1
val shifts = 3
val sizes: Gen[Int] = Gen.range("size")(0, 1, 1)
measure method "Nurse-Scheduling Conversion" in {
using(sizes) in { size =>
val cnf = Converter(Tseitin).convert(NurseScheduling(nurses, days, shifts).exp, false)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package satify.update.converters.tseitin.benchmark

import org.scalameter.api.*
import satify.model.problems.{GraphColoring, NQueens, NurseScheduling}
import satify.update.converters.Converter
import satify.update.converters.ConverterType.Tseitin

object ConversionProblemBenchmark extends Bench.OfflineReport:
import satify.update.converters.ConverterType.Tseitin

performance of "N-Queens conversion time" in {
val sizes: Gen[Int] = Gen.range("size")(1, 10, 1)
measure method "N-Queens Conversion" in {
using(sizes) in { size =>
val cnf = Converter(Tseitin).convert(NQueens(size).exp, false)
}
}
}

performance of "Graph-Coloring conversion time" in {
val nodes = List("n1", "n2", "n3")
val edges = List(("n1", "n2"), ("n2", "n3"))
val colors = 2
val sizes: Gen[Int] = Gen.range("size")(0, 1, 1)
measure method "Graph-Coloring Conversion" in {
using(sizes) in { size =>
val cnf = Converter(Tseitin).convert(GraphColoring(edges, nodes, colors).exp, false)
}
}
}

performance of "Nurse-Scheduling conversion time" in {
val nurses = 3
val days = 1
val shifts = 3
val sizes: Gen[Int] = Gen.range("size")(0, 1, 1)
measure method "Nurse-Scheduling Conversion" in {
using(sizes) in { size =>
val cnf = Converter(Tseitin).convert(NurseScheduling(nurses, days, shifts).exp, false)
}
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package satify.update.solver.dpll.benchmark

import org.scalameter.api.*
import satify.model.problems.{NQueens, NurseScheduling, GraphColoring}
import satify.update.solver.Solver
import satify.update.solver.SolverType.*
import satify.update.converters.ConverterType.Tseitin

object SolvingMemoryBenchmark extends Bench.OfflineReport:
override def measurer = new Measurer.MemoryFootprint

performance of "N-Queens solving memory" in {
val sizes: Gen[Int] = Gen.range("size")(2, 5, 1)
measure method "N-Queens Solving" in {
using(sizes) in { size =>
val s = Solver(DPLL, Tseitin).solveAll(NQueens(size).exp, false)
}
}
}

performance of "Graph-Coloring solving memory" in {
val nodes = List("n1", "n2", "n3")
val edges = List(("n1", "n2"), ("n2", "n3"))
val colors = 2
val sizes: Gen[Int] = Gen.range("size")(0, 1, 1)
measure method "Graph-Coloring Solving" in {
using(sizes) in { size =>
val s = Solver(DPLL, Tseitin).solveAll(GraphColoring(edges, nodes, colors).exp, false)
}
}
}

performance of "Nurse-Scheduling solving memory" in {
val nurses = 3
val days = 1
val shifts = 3
val sizes: Gen[Int] = Gen.range("size")(0, 1, 1)
measure method "Nurse-Scheduling Solving" in {
using(sizes) in { size =>
val s = Solver(DPLL, Tseitin).solveAll(NurseScheduling(nurses, days, shifts).exp, false)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package satify.update.solver.dpll.benchmark

import org.scalameter.api.*
import satify.model.problems.{GraphColoring, NQueens, NurseScheduling}
import satify.update.solver.Solver
import satify.update.solver.SolverType.*

object SolvingProblemBenchmark extends Bench.LocalTime:
import satify.update.converters.ConverterType.Tseitin

performance of "N-Queens solving time" in {
val sizes: Gen[Int] = Gen.range("size")(2, 5, 1)
measure method "N-Queens Solving" in {
using(sizes) in { size =>
val s = Solver(DPLL, Tseitin).solveAll(NQueens(size).exp, false)
}
}
}

performance of "Graph-Coloring solving time" in {
val nodes = List("n1", "n2", "n3")
val edges = List(("n1", "n2"), ("n2", "n3"))
val colors = 2
val sizes: Gen[Int] = Gen.range("size")(0, 1, 1)
measure method "Graph-Coloring Solving" in {
using(sizes) in { size =>
val s = Solver(DPLL, Tseitin).solveAll(GraphColoring(edges, nodes, colors).exp, false)
}
}
}

performance of "Nurse-Scheduling solving time" in {
val nurses = 3
val days = 1
val shifts = 3
val sizes: Gen[Int] = Gen.range("size")(0, 1, 1)
measure method "Nurse-Scheduling Solving" in {
using(sizes) in { size =>
val s = Solver(DPLL, Tseitin).solveAll(NurseScheduling(nurses, days, shifts).exp, false)
}
}
}