-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from Mala1180/feature/microbenchmarking
Feature/microbenchmarking
- Loading branch information
Showing
7 changed files
with
169 additions
and
48 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
src/test/scala/satify/update/converters/tseitin/benchmark/ConversionMemoryBenchmark.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/test/scala/satify/update/converters/tseitin/benchmark/ConversionProblemBenchmark.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} |
4 changes: 0 additions & 4 deletions
4
src/test/scala/satify/update/converters/tseitin/benchmark/MemoryBenchmark.scala
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/test/scala/satify/update/solver/dpll/benchmark/MemoryBenchmark.scala
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
src/test/scala/satify/update/solver/dpll/benchmark/SolvingBenchmark.scala
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
src/test/scala/satify/update/solver/dpll/benchmark/SolvingMemoryBenchmark.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/test/scala/satify/update/solver/dpll/benchmark/SolvingProblemBenchmark.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} |