package com.github.sbugat.nqueens;

import java.util.ArrayList;
import java.util.List;

import com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverCountQueens;
import com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverCheckCounting;
import com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverCheckRefactored;
import com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverFullyOptimized;
import com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverOneDimension;
import com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverWithExplicitConstraits;
import com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverWithExplicitInlineConstraits;
import com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverWithLists;
import com.github.sbugat.nqueens.tools.BenchmarkTools;
import com.github.sbugat.nqueens.tools.InvalidSolutionsException;

public abstract class BenchmarkAllSolvers {

	private static List<GenericNQueensSolver> getSolvers(final int chessboardSize) {

		final List<GenericNQueensSolver> genericNQueensSolverList = new ArrayList<>();

		// genericNQueensSolverList.add(new SlowBruteForceNQueensSolverWithListsNoQueensLimit(chessboardSize, true));
		// genericNQueensSolverList.add(new SlowBruteForceNQueensSolverWithLists(chessboardSize, false));
		genericNQueensSolverList.add(new BruteForceNQueensSolverFullyOptimized(chessboardSize));
		genericNQueensSolverList.add(new BruteForceNQueensSolverOneDimension(chessboardSize, false));
		genericNQueensSolverList.add(new BruteForceNQueensSolverWithLists(chessboardSize, false));
		genericNQueensSolverList.add(new BruteForceNQueensSolverCheckCounting(chessboardSize, false));
		genericNQueensSolverList.add(new BruteForceNQueensSolverWithExplicitInlineConstraits(chessboardSize, false));
		genericNQueensSolverList.add(new BruteForceNQueensSolverWithExplicitConstraits(chessboardSize, false));
		genericNQueensSolverList.add(new BruteForceNQueensSolverCountQueens(chessboardSize, false));
		genericNQueensSolverList.add(new BruteForceNQueensSolverCheckRefactored(chessboardSize, false));

		return genericNQueensSolverList;
	}

	/**
	 * Main greedy program.
	 * 
	 * @param args options
	 * @throws InvalidSolutionsException
	 */
	public static void main(final String args[]) throws InvalidSolutionsException {

		// Chessboard size
		final int chessboardSize = 8;
		final int benchmarkRun = 5;

		final List<GenericNQueensSolver> genericNQueensSolverList = getSolvers(chessboardSize);

		for (final GenericNQueensSolver genericNQueensSolver : genericNQueensSolverList) {

			final long solverBenchmark = BenchmarkTools.benchmark(genericNQueensSolver, benchmarkRun);

			System.out.println(genericNQueensSolver.getClass().getSimpleName() + " - " + BenchmarkTools.nanoSecondsToString(solverBenchmark)); //$NON-NLS-1$
		}
	}
}

@@ -78,668 +78,37 @@
 til.
-List;%0A%0Aimport com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverCountQueens;%0Aimport com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverCheckCounting;%0Aimport com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverCheckRefactored;%0Aimport com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverFullyOptimized;%0Aimport com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverOneDimension;%0Aimport com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverWithExplicitConstraits;%0Aimport com.github.sbugat.nqueens.solvers.bruteforce.BruteForceNQueensSolverWithExplicitInlineConstraits;
+Date;%0Aimport java.util.List;%0A
 %0Aimp
@@ -636,19 +636,16 @@
 ue));%0A%09%09
-// 
 genericN
@@ -661,36 +661,32 @@
 verList.add(new 
-Slow
 BruteForceNQueen
@@ -719,34 +719,38 @@
 dSize, false));%0A
+%0A
 %09%09
+// 
 genericNQueensSo
@@ -820,24 +820,27 @@
 rdSize));%0A%09%09
+// 
 genericNQuee
@@ -915,32 +915,35 @@
 ize, false));%0A%09%09
+// 
 genericNQueensSo
@@ -1011,32 +1011,35 @@
 ize, false));%0A%09%09
+// 
 genericNQueensSo
@@ -1111,32 +1111,35 @@
 ize, false));%0A%09%09
+// 
 genericNQueensSo
@@ -1226,32 +1226,35 @@
 ize, false));%0A%09%09
+// 
 genericNQueensSo
@@ -1335,32 +1335,35 @@
 ize, false));%0A%09%09
+// 
 genericNQueensSo
@@ -1406,19 +1406,13 @@
 lver
-CountQueens
+Array
 (che
@@ -1431,24 +1431,27 @@
  false));%0A%09%09
+// 
 genericNQuee
@@ -1813,9 +1813,9 @@
 e = 
-8
+9
 ;%0A%09%09
@@ -1843,9 +1843,9 @@
 n = 
-5
+1
 ;%0A%0A%09
@@ -2020,16 +2020,141 @@
 ist) %7B%0A%0A
+%09%09%09System.out.println(%22Start: %22 + new Date());%0A%0A%09%09%09System.out.print(genericNQueensSolver.getClass().getSimpleName() + %22: %22);%0A
 %09%09%09final
@@ -2239,17 +2239,16 @@
 rkRun);%0A
-%0A
 %09%09%09Syste
@@ -2265,59 +2265,15 @@
 tln(
-genericNQueensSolver.getClass().getSimpleName() + %22
+%22 done!
  - %22
@@ -2342,16 +2342,62 @@
 N-NLS-1$
+%0A%0A%09%09%09System.out.println(%22End: %22 + new Date());
 %0A%09%09%7D%0A%09%7D%0A

Add start/end time