3

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.

2 Answers2

3

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.

Max Ostrowski
  • 575
  • 1
  • 3
  • 15
2

you can also have a look at section 3.3.2 of the following paper:

The method presented there allows you to compute m different stable models of a logic program by finding m 1-diverse stable models. But note that m has to be given as input, hence the method is not directly applicable to the problem of computing one stable model that contains all stable models of a logic program.

Javier
  • 21
  • 1
  • Hi I kind of solve it, maybe not with the most optimized method, but it did the job. I gave an id to each answer set and afterwards with an "asp-wrapper program", I processed them. Thank you, for your aid :) :) – alexandros vassiliades Oct 09 '21 at 13:04