Andres
Andres

Reputation: 33

Using pyDatalog for constraint stores

Consider the following rules:

pyDatalog.create_atoms('X')
pyDatalog.create_atoms('Y')

pyDatalog.create_atoms('a')
pyDatalog.create_atoms('b')

b(X,1) <= (X<0)
b(X,Y) <= (X==1) & (Y>0)
a(X,Y) <= b(X,Y) & (X>0)

And the problem of finding the constraints that satisfy: a(X,1)

The question is: Can you use pyDatalog to come up with the list [(X==1)] ? or [(X>0), (X==1)]?

Thanks,

Upvotes: 2

Views: 218

Answers (1)

Pierre Carbonnelle
Pierre Carbonnelle

Reputation: 2625

Unfortunately not, at least with the current version :-)

pyDatalog can solve discrete constraint problems, not general constraint problems like the one you describe. pyDatalog can only return values, not criteria like X>0.

Note: you can combine the first 4 statements in just one:

pyDatalog.create_atoms('X, Y, a, b')

Upvotes: 2

Related Questions