Q1: %%%% Config #const n = 5. %%%% Code % selected is not an empty predicate 1 { selected(1..n) }. Q2: %%%% Config %% N #const n = 5. %% M #const m = 4. %%%% Helpers %% Ts t(1..n). %% Es e(1..m). %%%% Code % there is an E,...

There is no 'official' way to handle lists in ASP as far as I know. But, DLV has built-in list handling similar to Prolog's. The way you implement a list, the list itself cannot be used as a term and thus what if you want to bind between variables in...

How about this: #minimize {batteryFlat(mycar); batteryFlat(yourcar); hasNoFuel(mycar); hasNoFuel(yourcar); brokenIndicator(mycar); brokenIndicator(yourcar)}. The set is now separated with ; and you can then use , to conjoin conditions. Each element has the same priority, but if you want different priorities you can do something like: #minimize {[email protected]: batteryFlat(mycar); [email protected]: batteryFlat(yourcar); hasNoFuel(mycar); hasNoFuel(yourcar);...

Solved. It turns out the native abs function doesn't really work as I expected it to, but defining both conditions for the adj function does the disjunctive trick and works like a charm. This: a(1..3). adj(X,Y) :- a(X), a(Y), X-Y==1. adj(X,Y) :- a(X), a(Y), Y-X==1. #hide a/1. Outputs: Answer: 1...

I'm assuming you'll want the totals for each "pick", and I assume pick is defined as pick(P) :- curr(P, _). You should tell in the code which pick you mean. In the clingo3 guide case you cite this is not needed. In clingo3: % clingo3 curr(p4,2). curr(p4,2). curr(p4,6). curr(p5,2). curr(p5,1)....