alpha-asp / Alpha

A lazy-grounding Answer-Set Programming system
BSD 2-Clause "Simplified" License
58 stars 10 forks source link

Same aggregate cannot be used twice #340

Open rtaupe opened 2 years ago

rtaupe commented 2 years ago

The following program:

head1(A,N) :- body1(A), n(N), N <= #count { B : lit(A,B) }.
head2(A,N) :- body2(A), n(N), N <= #count { B : lit(A,B) }.

causes:

Exception in thread "main" java.lang.RuntimeException: AggregateInfo for AggregateLiteral already existing.! Should not happen.
        at at.ac.tuwien.kr.alpha.commons.util.Util.oops(Util.java:101)
        at at.ac.tuwien.kr.alpha.core.programs.transformation.aggregates.AggregateRewritingContext.registerAggregateLiteral(AggregateRewritingContext.java:93)
        at at.ac.tuwien.kr.alpha.core.programs.transformation.aggregates.AggregateRewritingContext.registerRule(AggregateRewritingContext.java:70)
        at at.ac.tuwien.kr.alpha.core.programs.transformation.aggregates.AggregateRewriting.apply(AggregateRewriting.java:82)
        at at.ac.tuwien.kr.alpha.core.programs.transformation.NormalizeProgramTransformation.apply(NormalizeProgramTransformation.java:31)
        at at.ac.tuwien.kr.alpha.api.impl.AlphaImpl.normalizeProgram(AlphaImpl.java:139)
        at at.ac.tuwien.kr.alpha.api.impl.AlphaImpl.prepareSolverFor(AlphaImpl.java:286)
        at at.ac.tuwien.kr.alpha.Main.main(Main.java:104)

Related feature: #141