Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 245
alexandros vassiliades Avatar asked Feb 18 '26 16:02

alexandros vassiliades


2 Answers

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.

like image 137
Max Ostrowski Avatar answered Feb 21 '26 13:02

Max Ostrowski


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

  • https://arxiv.org/abs/2008.06692

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.

like image 29
Javier Avatar answered Feb 21 '26 15:02

Javier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!