Twice the amount of variables needed

Aperta
#257 3 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@AbdallahS ci sta già lavorando.

Dal 22/4/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

For the well known example:

#const int_domain_size = 10000.

variable_declare(assign_x, x, fromFacts).
variable_domain(x, val(int, 1..int_domain_size)).

in direct.lp you have the rules:

_se_value(variable(X),V) :- direct_query(variable(X)), _se_assign(NAME,variable(X),E2), _se_value(E2,V), usc_active(NAME).

this is the reason we have double the variables, as it grounds to:

 _se_value(variable(x),val(int,10000)):-_se_assign(_label_anonymous,variable(x),val(int,10000)),direct_query(variable(x)).
_se_value(variable(x),val(int,9999)):-_se_assign(_label_anonymous,variable(x),val(int,9999)),direct_query(variable(x)).
_se_value(variable(x),val(int,9998)):-_se_assign(_label_anonymous,variable(x),val(int,9998)),direct_query(variable(x)).
...

we have 2 literals in the body, 1 literal in the head, that means that clasp probably introduces a variable for the whole body.

Is this rule correct like this? And more interesting, what means direct_query(variable(X)). This is a dynamic predicate and can't be optimized away, and is produced by the rule:
direct_query(X)  :- _se_assign(NAME,X,E).
which produces

direct_query(variable(x)):-_se_assign(_label_anonymous,variable(x),val(int,9998)).
direct_query(variable(x)):-_se_assign(_label_anonymous,variable(x),val(int,9999)).
direct_query(variable(x)):-_se_assign(_label_anonymous,variable(x),val(int,10000)).
...

Non of this is detected as deterministic. I'm not sure what the semantics of direct_query is, but maybe we could so something to define it "deterministically".

In short: I think this is the reason why we have twice the amount of predicates we need, but I do not know what is going on there because of the lack of my semantic knowledge

Lingua principale
Python
Stelle
4
Fork
0
Merge medio
2g 9h
PR unite (30g)
19

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di potassco/constraint-handler

Tutte le issue di potassco/constraint-handler

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.