Search in sources :

Example 1 with AggregateRewriting

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

the class NormalizeProgramTransformation method apply.

@Override
public NormalProgram apply(ASPCore2Program inputProgram) {
    ASPCore2Program tmpPrg;
    // Remove variable equalities.
    tmpPrg = new VariableEqualityRemoval().apply(inputProgram);
    // Transform choice rules.
    tmpPrg = new ChoiceHeadToNormal().apply(tmpPrg);
    // Transform aggregates.
    tmpPrg = new AggregateRewriting(aggregateRewritingCfg.isUseSortingGridEncoding(), aggregateRewritingCfg.isSupportNegativeValuesInSums()).apply(tmpPrg);
    // Transform enumeration atoms.
    tmpPrg = new EnumerationRewriting().apply(tmpPrg);
    EnumerationAtom.resetEnumerations();
    // Construct the normal program.
    NormalProgram retVal = NormalProgramImpl.fromInputProgram(tmpPrg);
    // Transform intervals.
    retVal = new IntervalTermToIntervalAtom().apply(retVal);
    // Rewrite ArithmeticTerms.
    retVal = new ArithmeticTermsRewriting().apply(retVal);
    return retVal;
}
Also used : ASPCore2Program(at.ac.tuwien.kr.alpha.api.programs.ASPCore2Program) AggregateRewriting(at.ac.tuwien.kr.alpha.core.programs.transformation.aggregates.AggregateRewriting) NormalProgram(at.ac.tuwien.kr.alpha.api.programs.NormalProgram)

Aggregations

ASPCore2Program (at.ac.tuwien.kr.alpha.api.programs.ASPCore2Program)1 NormalProgram (at.ac.tuwien.kr.alpha.api.programs.NormalProgram)1 AggregateRewriting (at.ac.tuwien.kr.alpha.core.programs.transformation.aggregates.AggregateRewriting)1