answer-set-programmingclingo

Gather all answer sets into one answer set (ASP)


my question is, if I can gather all answer sets into one answer. I attach the code below for my program. The results that it returns and a description of what I would like to have.

% Main domain predicates definitions
argument(1..3).
element(1).


#show scope/2.

{scope(A, U) : element(U)}:- argument(A).

what I get is shown in the picture below

enter image description here

But what I would like to get is, some predicate that has a unique id for each answer set. For example:

newScope(1,empty)-newScope(2,2,1)-newScope(3,3,1)-....-newScope(8,1,1)|newScope(8,2,1)|newScope(8,3,1)

thanks in advance to whomever has the patience to answer me.


Solution

  • You can't do this, except if you accept an exponential blowup in atoms and even than it isn't that easy. You can't enumerate answer sets in a single answer set (the complexity for enumerating is higher, so you can't solve n NP problems (enumeration) inside one NP problem (except you describe n NP problems in your encoding, which is not practical).

    Maybe you can describe what you are trying to achieve and there are other ways of how to do this.

    Your problem could be solveable with disjunctive rules, as then the complexity rises to NP^2. Edit: I found that https://github.com/potassco/guess_and_check could exactly do what you are looking for to describe a NP^2 problem without manually writing the disjunctive logic program.