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

ai.libs.jaicore.planning.hierarchical.algorithms.forwarddecomposition.BestFirstForwardDecompositionReducer Maven / Gradle / Ivy

package ai.libs.jaicore.planning.hierarchical.algorithms.forwarddecomposition;

import ai.libs.jaicore.planning.core.EvaluatedSearchGraphBasedPlan;
import ai.libs.jaicore.planning.hierarchical.algorithms.forwarddecomposition.graphgenerators.tfd.TFDNode;
import ai.libs.jaicore.planning.hierarchical.problems.htn.CostSensitiveHTNPlanningProblem;
import ai.libs.jaicore.planning.hierarchical.problems.htn.IHTNPlanningProblem;
import ai.libs.jaicore.search.model.other.EvaluatedSearchGraphPath;
import ai.libs.jaicore.search.probleminputs.GraphSearchInput;
import ai.libs.jaicore.search.probleminputs.GraphSearchWithSubpathEvaluationsInput;
import ai.libs.jaicore.search.problemtransformers.GraphSearchProblemInputToGraphSearchWithSubpathEvaluationInputTransformer;

public class BestFirstForwardDecompositionReducer> extends
AForwardDecompositionReducer, EvaluatedSearchGraphBasedPlan, GraphSearchWithSubpathEvaluationsInput, EvaluatedSearchGraphPath> {
	private final SimpleForwardDecompositionReducer simpleReducer = new SimpleForwardDecompositionReducer();
	private GraphSearchProblemInputToGraphSearchWithSubpathEvaluationInputTransformer transformer = new GraphSearchProblemInputToGraphSearchWithSubpathEvaluationInputTransformer<>();

	@Override
	public GraphSearchWithSubpathEvaluationsInput encodeProblem(final CostSensitiveHTNPlanningProblem problem) {
		GraphSearchInput searchInput = this.simpleReducer.encodeProblem(problem.getCorePlanningProblem());
		return new GraphSearchWithSubpathEvaluationsInput<>(searchInput.getGraphGenerator(), this.transformer.getNodeEvaluator());
	}

	@Override
	public EvaluatedSearchGraphBasedPlan decodeSolution(final EvaluatedSearchGraphPath solution) {
		return new EvaluatedSearchGraphBasedPlan<>(this.getPlanForSolution(solution), solution);
	}

	public GraphSearchProblemInputToGraphSearchWithSubpathEvaluationInputTransformer getTransformer() {
		return this.transformer;
	}

	public void setTransformer(final GraphSearchProblemInputToGraphSearchWithSubpathEvaluationInputTransformer transformer) {
		this.transformer = transformer;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy