[Haskell-cafe] Find a point inside (x,y,z) -> Bool
Levent Erkok
erkokl at gmail.com
Thu Oct 29 17:01:03 UTC 2015
This problem can be considered as an instance of the more general SAT
problem, in which you're trying to find a satisfying assignment to a
predicate. You might want to give that approach a try, though it does
require changes in representation. Here's a *very* simple example:
Prelude> :m Data.SBV
Prelude Data.SBV> let f (x, y, z) = 0 .<= x &&& y .>= 2 &&& z .<=
x+(y::SInteger)
Prelude Data.SBV> sat f
Satisfiable. Model:
s0 = 0 :: Integer
s1 = 2 :: Integer
s2 = 2 :: Integer
Your "f" is probably going to be much more complicated, but if you can
afford to move to symbolic types, then SBV can bridge the gap and a SAT/SMT
solver can give you the required points. Or tell you if there isn't any,
like in the following example:
Prelude Data.SBV> sat $ \x y -> x .> y &&& x .< (y::SInteger)
Unsatisfiable
-Levent.
On Thu, Oct 29, 2015 at 2:01 AM, martin <martin.drautzburg at web.de> wrote:
> Hello all,
>
> I hope this is not a too silly question. It goes like this:
>
> Suppose I have a shape defined as
>
> (x,y,z) -> Bool
>
> how can I find a Point inside this shape? Obviously I could iterate
> through all possible x,y and z, but this appears
> very expensive.
>
> There may be no point at all at x=0. With brute force iteration I would
> have no clue that the False I am receiving with
> (0,1,1) is caused by x=0 and I may nedlessly try all combinations of y and
> z without ever receiving a True.
>
> Are there any alternative ways of finding points inside a shape?
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151029/6d1758fa/attachment.html>
More information about the Haskell-Cafe
mailing list