Fork me on GitHub
#core-logic
<
2017-03-03
>
kneiva07:03:12

Having a list of integers how would I find the biggest square area that can fit in the columns? With clojure.logic or preferrably with https://github.com/aengelberg/loco. I couldn’t find an example or a tutorial that help me with this kind of problem. Examples:

1234321     321     423

   0                0
  ***       0       0 0
 0***0      **      **0
00***00     **0     **0
= 3         = 2     = 2

hiredman08:03:43

it seems like the kind of think you might be able to find a formula for

hiredman08:03:14

I think with logic programming or some kind of sat solver you are going to have trouble, because both of those tend to be good answering "does a solution to this exist" and less so at solving "find me the solution with property x"

hiredman08:03:55

actually, I think you can put that in terms of does X exist: "Does X exist where X is a number that fits in row 0, and row 0 + X, and X+1 doesn't fit in row 0 + X + 1"

hiredman08:03:54

the biggest result or smallest result, is a constraint relative to all the other answers, which means you have to compute all the other possible answers

kneiva08:03:33

Ok, I think that helps. I’ll ponder on it. Thanks!