Search in sources :

Example 6 with StratifiedEvaluation

use of at.ac.tuwien.kr.alpha.core.programs.transformation.StratifiedEvaluation in project Alpha by alpha-asp.

the class AlphaImpl method prepareDebugSolve.

@Override
public DebugSolvingContext prepareDebugSolve(final NormalProgram program, java.util.function.Predicate<Predicate> filter) {
    final DependencyGraph depGraph;
    final ComponentGraph compGraph;
    final AnalyzedProgram analyzed = AnalyzedProgram.analyzeNormalProgram(program);
    final NormalProgram preprocessed;
    if (this.config.isEvaluateStratifiedPart()) {
        preprocessed = new StratifiedEvaluation().apply(analyzed).toNormalProgram();
    } else {
        preprocessed = program;
    }
    depGraph = analyzed.getDependencyGraph();
    compGraph = analyzed.getComponentGraph();
    final Solver solver = prepareSolverFor(analyzed, filter);
    return new DebugSolvingContext() {

        @Override
        public Solver getSolver() {
            return solver;
        }

        @Override
        public NormalProgram getPreprocessedProgram() {
            return preprocessed;
        }

        @Override
        public NormalProgram getNormalizedProgram() {
            return program;
        }

        @Override
        public DependencyGraph getDependencyGraph() {
            return depGraph;
        }

        @Override
        public ComponentGraph getComponentGraph() {
            return compGraph;
        }
    };
}
Also used : ComponentGraph(at.ac.tuwien.kr.alpha.api.programs.analysis.ComponentGraph) Solver(at.ac.tuwien.kr.alpha.api.Solver) AnalyzedProgram(at.ac.tuwien.kr.alpha.core.programs.AnalyzedProgram) NormalProgram(at.ac.tuwien.kr.alpha.api.programs.NormalProgram) DependencyGraph(at.ac.tuwien.kr.alpha.api.programs.analysis.DependencyGraph) DebugSolvingContext(at.ac.tuwien.kr.alpha.api.DebugSolvingContext) StratifiedEvaluation(at.ac.tuwien.kr.alpha.core.programs.transformation.StratifiedEvaluation)

Aggregations

StratifiedEvaluation (at.ac.tuwien.kr.alpha.core.programs.transformation.StratifiedEvaluation)6 NormalProgram (at.ac.tuwien.kr.alpha.api.programs.NormalProgram)5 AtomStore (at.ac.tuwien.kr.alpha.core.common.AtomStore)4 AtomStoreImpl (at.ac.tuwien.kr.alpha.core.common.AtomStoreImpl)4 InternalProgram (at.ac.tuwien.kr.alpha.core.programs.InternalProgram)4 ASPCore2Program (at.ac.tuwien.kr.alpha.api.programs.ASPCore2Program)3 NoGood (at.ac.tuwien.kr.alpha.core.common.NoGood)3 TrailAssignment (at.ac.tuwien.kr.alpha.core.solver.TrailAssignment)3 Test (org.junit.jupiter.api.Test)3 AnalyzedProgram (at.ac.tuwien.kr.alpha.core.programs.AnalyzedProgram)2 DebugSolvingContext (at.ac.tuwien.kr.alpha.api.DebugSolvingContext)1 Solver (at.ac.tuwien.kr.alpha.api.Solver)1 ComponentGraph (at.ac.tuwien.kr.alpha.api.programs.analysis.ComponentGraph)1 DependencyGraph (at.ac.tuwien.kr.alpha.api.programs.analysis.DependencyGraph)1 CompiledProgram (at.ac.tuwien.kr.alpha.core.programs.CompiledProgram)1 NormalizeProgramTransformation (at.ac.tuwien.kr.alpha.core.programs.transformation.NormalizeProgramTransformation)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1