Closed Genco2 closed 2 years ago
There is no such thing as a variable arguments thing in ASP. But this does not matter as it should also not be possible to create predicates q
with different arities without knowing of it.
So you can have a rule:
q(X,Y,Z) :- a(X,Y,Z)
in your encoding, but then you know that you might get a q/3
predicate in your solution.
If you have a rule:
q(X,Y) :- b(X,Y)
then you know that you might have q/2
in your solutions. But you always know as you write your encoding rules by hand.
I would strongly suggest not to auto-generate rules, as clingo is not make for reading a huge rule set. You should rather generate a set of facts as your instance and have a small, fixed set of rules that then create your constraints wrt. the facts. Then you also always know the possible arities of q
.
Thanks a lot.
Hello, I am currently working on a ASP project. I have a question about constraints. For example, we have a functer with 3 variables, lets say q(X, Y, Z), and we only want the solutions that includes q(X,Y,Z) no matter what X, Y and Z are equal to. I guess, one of the proper ways to implement is adding the constraint ;
:- not q(_,_,_).
However, my question is, what if we do not the number of variables in the q . Maybe, in some cases, we will have q(X,Y) or q(X,Y,Z,Q). Is there a wildcard that corresponds "Eliminate all the solutions without q with no matter of how many variables it has" ? What are your recommendations for such case ? Thanks. Genco Cosgun