iensen / plog2.0

A grounder and solver for P-log (A language combining non-monotonic logic with probabilities)
GNU General Public License v3.0
1 stars 1 forks source link

Implement Aggregates In P-log #11

Open iensen opened 6 years ago

iensen commented 6 years ago

A lot of examples have a more natural representation using Aggregates. For instance, the following program https://github.com/iensen/plog2.0/blob/master/plogapp/tests/nasa/A4n.plog has a rule:

lessthan5broken = false:- broken(Component1) = true, broken(Component2) = true, broken(Component3)= true, broken(Component4) = true, broken(Component5) = true, Component1<>Component2, Component1<>Component3, Component1<>Component4, Component1<>Component5, Component2<>Component3, Component2<>Component4, Component2<>Component5, Component3<>Component4, Component3<>Component5, Component4<>Component5.

That can be rewritten using aggregate: lessthan5broken = false:- #count{X: broken(X)} <5.

This will shorten the program and improve the inference significantly. We can use A-log aggregates (Gelfond, Zhang, 2014)