I'm getting errors when using fd example:
(run* [q]
(fresh [x y]
(fd/in x y (fd/interval 1 10))
(fd/+ x y 10)
(== q [x y]))) ; => ([1 9] [2 8] [3 7] [4 6] [5 5] [6 4] [7 3] [8 2] [9 1])
Gives
Exception Constrained variable <lvar:q__50256> without domain clojure.core.logic/verify-all-bound/verify-all-bound*--48690 (logic.clj:2136)
from:
https://github.com/clojure/core.logic/wiki/Featuressome of the fd examples from the test namespace also fail. using 0.8.11
it seems perfect for the problem I want to solve, finding build orders in StarCraft II 🙂
I think in general core.logic would make for a useful tool in an RTS AI. What do people here think?
Maybe generate data to help train a neural net, or help it make decisions, that could then more easily be visualized.
figured out I was importing wrong, got it working now 🙂
Is there a way to generate the constraints in a macro. I need the following :
(pldb/with-db db (run 1 [q]
(fresh [x y z a b c]
(foo x y)
(foo a b)
(foo b c)
;; more constraints
(== q [x y z a b c])))
I can have many number of vars to fresh and also a lot of foo constraints. I have the following macro but it's not working.
(defmacro my-fresh
[db districts res]
`(pldb/with-db ~db (run 1 [q]
(fresh ~districts
(map (fn [[x y]] ('foo x y)) ~res)
(== q ~districts)))))
you don't need a macro
there is a goal that will combine a sequence of goals in to a single goal (via conjunction)