All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.libs.jaicore.search.exampleproblems.nqueens.NQueensGraphSearchToNodeRecommendedTreeReducer Maven / Gradle / Ivy

package ai.libs.jaicore.search.exampleproblems.nqueens;

import ai.libs.jaicore.basic.algorithm.reduction.AlgorithmicProblemReduction;
import ai.libs.jaicore.search.model.other.SearchGraphPath;
import ai.libs.jaicore.search.probleminputs.GraphSearchInput;
import ai.libs.jaicore.search.probleminputs.GraphSearchWithNodeRecommenderInput;

public class NQueensGraphSearchToNodeRecommendedTreeReducer implements AlgorithmicProblemReduction, SearchGraphPath, GraphSearchWithNodeRecommenderInput, SearchGraphPath> {

	@Override
	public GraphSearchWithNodeRecommenderInput encodeProblem(final GraphSearchInput problem) {
		return new GraphSearchWithNodeRecommenderInput<>(problem, (n1, n2) -> Integer.valueOf(n1.getNumberOfAttackedCells()).compareTo(n2.getNumberOfAttackedCells()));
	}

	@Override
	public SearchGraphPath decodeSolution(final SearchGraphPath solution) {
		return solution;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy