Search in sources :

Example 1 with NormalizeProgramTransformation

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

the class ChoiceManagerTests method setUp.

@BeforeEach
public void setUp() {
    String testProgram = "h :- b1, b2, not b3, not b4.";
    ASPCore2Program parsedProgram = new ProgramParserImpl().parse(testProgram);
    CompiledProgram internalProgram = InternalProgram.fromNormalProgram(new NormalizeProgramTransformation(SystemConfig.DEFAULT_AGGREGATE_REWRITING_CONFIG).apply(parsedProgram));
    atomStore = new AtomStoreImpl();
    grounder = new NaiveGrounder(internalProgram, atomStore, true);
    WritableAssignment assignment = new TrailAssignment(atomStore);
    NoGoodStore store = new NoGoodStoreAlphaRoaming(assignment);
    choiceManager = new ChoiceManager(assignment, store);
}
Also used : ASPCore2Program(at.ac.tuwien.kr.alpha.api.programs.ASPCore2Program) NaiveGrounder(at.ac.tuwien.kr.alpha.core.grounder.NaiveGrounder) AtomStoreImpl(at.ac.tuwien.kr.alpha.core.common.AtomStoreImpl) ProgramParserImpl(at.ac.tuwien.kr.alpha.core.parser.ProgramParserImpl) CompiledProgram(at.ac.tuwien.kr.alpha.core.programs.CompiledProgram) NormalizeProgramTransformation(at.ac.tuwien.kr.alpha.core.programs.transformation.NormalizeProgramTransformation) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with NormalizeProgramTransformation

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

the class TestUtils method buildSolverFromSystemConfig.

private static Solver buildSolverFromSystemConfig(ASPCore2Program prog, SystemConfig cfg) {
    AtomStore atomStore = new AtomStoreImpl();
    NormalProgram normalProg = new NormalizeProgramTransformation(cfg.getAggregateRewritingConfig()).apply(prog);
    InternalProgram preprocessed = cfg.isEvaluateStratifiedPart() ? new StratifiedEvaluation().apply(AnalyzedProgram.analyzeNormalProgram(normalProg)) : InternalProgram.fromNormalProgram(normalProg);
    return SolverFactory.getInstance(cfg, atomStore, GrounderFactory.getInstance(cfg.getGrounderName(), preprocessed, atomStore, cfg.isDebugInternalChecks()));
}
Also used : AtomStore(at.ac.tuwien.kr.alpha.core.common.AtomStore) AtomStoreImpl(at.ac.tuwien.kr.alpha.core.common.AtomStoreImpl) NormalProgram(at.ac.tuwien.kr.alpha.api.programs.NormalProgram) InternalProgram(at.ac.tuwien.kr.alpha.core.programs.InternalProgram) NormalizeProgramTransformation(at.ac.tuwien.kr.alpha.core.programs.transformation.NormalizeProgramTransformation) StratifiedEvaluation(at.ac.tuwien.kr.alpha.core.programs.transformation.StratifiedEvaluation)

Aggregations

AtomStoreImpl (at.ac.tuwien.kr.alpha.core.common.AtomStoreImpl)2 NormalizeProgramTransformation (at.ac.tuwien.kr.alpha.core.programs.transformation.NormalizeProgramTransformation)2 ASPCore2Program (at.ac.tuwien.kr.alpha.api.programs.ASPCore2Program)1 NormalProgram (at.ac.tuwien.kr.alpha.api.programs.NormalProgram)1 AtomStore (at.ac.tuwien.kr.alpha.core.common.AtomStore)1 NaiveGrounder (at.ac.tuwien.kr.alpha.core.grounder.NaiveGrounder)1 ProgramParserImpl (at.ac.tuwien.kr.alpha.core.parser.ProgramParserImpl)1 CompiledProgram (at.ac.tuwien.kr.alpha.core.programs.CompiledProgram)1 InternalProgram (at.ac.tuwien.kr.alpha.core.programs.InternalProgram)1 StratifiedEvaluation (at.ac.tuwien.kr.alpha.core.programs.transformation.StratifiedEvaluation)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1