* <p/>
* Not recommended! It is recommended to use {@link #createSolverByXml()} instead.
* @return never null
*/
protected Solver createSolverByApi() {
SolverConfig solverConfig = new SolverConfig();
solverConfig.setSolutionClass(NQueens.class);
solverConfig.setEntityClassList(Collections.<Class<?>>singletonList(Queen.class));
ScoreDirectorFactoryConfig scoreDirectorFactoryConfig = new ScoreDirectorFactoryConfig();
scoreDirectorFactoryConfig.setScoreDefinitionType(ScoreDefinitionType.SIMPLE);
scoreDirectorFactoryConfig.setScoreDrlList(
Arrays.asList("org/optaplanner/examples/nqueens/solver/nQueensScoreRules.drl"));
solverConfig.setScoreDirectorFactoryConfig(scoreDirectorFactoryConfig);
TerminationConfig terminationConfig = new TerminationConfig();
terminationConfig.setBestScoreLimit("0");
solverConfig.setTerminationConfig(terminationConfig);
List<PhaseConfig> phaseConfigList = new ArrayList<PhaseConfig>();
ConstructionHeuristicPhaseConfig constructionHeuristicPhaseConfig = new ConstructionHeuristicPhaseConfig();
constructionHeuristicPhaseConfig.setConstructionHeuristicType(
ConstructionHeuristicType.FIRST_FIT_DECREASING);
phaseConfigList.add(constructionHeuristicPhaseConfig);
LocalSearchPhaseConfig localSearchPhaseConfig = new LocalSearchPhaseConfig();
ChangeMoveSelectorConfig changeMoveSelectorConfig = new ChangeMoveSelectorConfig();
changeMoveSelectorConfig.setSelectionOrder(SelectionOrder.ORIGINAL);
localSearchPhaseConfig.setMoveSelectorConfig(changeMoveSelectorConfig);
AcceptorConfig acceptorConfig = new AcceptorConfig();
acceptorConfig.setEntityTabuSize(5);
localSearchPhaseConfig.setAcceptorConfig(acceptorConfig);
phaseConfigList.add(localSearchPhaseConfig);
solverConfig.setPhaseConfigList(phaseConfigList);
return solverConfig.buildSolver();
}