Re: solving an equation for all solutions with constraints: core.logic.fd

2014-06-11 Thread David Nolen
core.logic only currently supports solving finite domains CLP(FD), you'll have to look elsewhere for a CLP(R) solver for now. David On Tue, Jun 10, 2014 at 5:30 PM, cej38 wrote: > I picked a toy problem that was really easy to solve, figuring that once I > had the idea down, I would be able to e

Re: solving an equation for all solutions with constraints: core.logic.fd

2014-06-10 Thread Alex Engelberg
It doesn't totally make sense to me that you would have integer variables with real coefficients. If the coefficients are irrational and are not scaled versions of each other, then the problem is impossible. Otherwise, you can just scale them by a common factor and make them integers. For instance,

Re: solving an equation for all solutions with constraints: core.logic.fd

2014-06-10 Thread cej38
I picked a toy problem that was really easy to solve, figuring that once I had the idea down, I would be able to easily change the equation to the one that I am interested in solving. In moving to my real problem I hit the next snag I can't use real numbers within the equation. I note that the

Re: solving an equation for all solutions with constraints: core.logic.fd

2014-06-10 Thread Alex Engelberg
I couldn't help but overhear that you're working with Constraint Programming, so I thought I'd suggest that you try loco , which is a Clojure wrapper of a Java library specifically designed to work with these types of problems. The loco solution to your proble

Re: solving an equation for all solutions with constraints: core.logic.fd

2014-06-10 Thread David Nolen
That's that's the suggested way - just pick a large bound. David On Tue, Jun 10, 2014 at 11:28 AM, cej38 wrote: > I found the solution to my first problem at > https://github.com/clojure/core.logic/wiki/Features (with a few small > changes by me): > > (run* [q] > (fresh [x y] > (fd/in x y

Re: solving an equation for all solutions with constraints: core.logic.fd

2014-06-10 Thread cej38
I found the solution to my first problem at https://github.com/clojure/core.logic/wiki/Features (with a few small changes by me): (run* [q] (fresh [x y] (fd/in x y (fd/interval 0 9)) (fd/eq (= (+ (* x 3) (* y 2)) 8)) (== q [x y]))) I suppose that I could set (fd/interval 0

solving an equation for all solutions with constraints: core.logic.fd

2014-06-10 Thread cej38
I am interested in solving a simple equation for all of its solutions when some constraints are applied. This sounds like a problem for core.logic.fd. Let's use a toy example: 8 = 3*x + 2*y, where x and y must be non-negative integers. Here are the possible solutions: [x,y]= {[2,1],[0,4]}.