The 17x17 challenge. "Worth $289.00. This is not a joke."
blog.computationalcomplexity.org
blog.computationalcomplexity.org
The number of possible 4-colorings of a 17x17 grid is 4^289 which is about 10^174, but that doesn't take into account the permutations of colors (4!) and possible symmetries.
However, since almost all colorings have no symmetry that's largely irrelevant, so the number of colorings of the grid (up to permutations of colors) is about 4^289/24 which is about 4.122e172.
Within the 17x17 grid we must avoid X-Y-aligned rectangles with corners all the same color. The number of such rectangles is obtained by choosing two rows and two columns, and so is (17choose2)x(17choose2) = 23409.
also you're counting wrong. there are 2 or 3 options for the third square. 2 if the first 2 squares got the same color.
Step 1: (1,x,x,x)
Step 2:
There are 2 meaningful options (1,1,x,x) and (1,2,x,x) because (1,3,x,x) is the same as (1,2,x,x). Granted only apply to the first 2x2 grid.
Step 3: (1,1,1,x), (1,1,2,x), (1,2,1,x), (1,2,2,x), (1,2,3,x)
Step 4: (1,1,1,2), (1,1,2,1), (1,1,2,2), (1,1,2,3), (1,2,1,1), (1,2,1,2), (1,2,1,3), (1,2,2,1),(1,2,2,2),(1,2,2,3), (1,2,3,1),(1,2,3,2),(1,2,3,3),(1,2,3,4)
So 14 options.A) you don't need to innumerate every complete grid before eliminating them.
B) How you count is important, if you just looked at the top row the boxing effect does not help and you have almost 2 * 3 * 4^14 options.
PS: You can also cull some rotational summitry's from those 14 options before you start, but again that's only important if you are trying to actually calculate it.
Of course. For large grids, I wonder if you can eliminate everything that doesn't have nearly equal amounts of every color.
The reason you can't crack RSA is because after skipping composite numbers and small primes you cant further reduce the search space. Don't forget 20x20 box is known to not be solvable and the 16x16 box has at least one known solution.
Besides, to some extent you are preempting the problem. You've counted the number of colorings of the 2x2 grid and found there to be only a small number. The evidence suggests that the number of colorings of the 17x17 grid is either 1 or 0 (up to permutation of colors), but that doesn't mean the search is trivial.
I may not have expressed that clearly, but I hope I've conveyed the point.
0,0
0,1
However, the vast majority of the grids are eliminated by the boxing constriant before the grid get's all that large.This should reduce the number of possible grids by a factor of (17!)^2, leaving 3.25e143 colorings.
edit: nah, at this rate it won't finish. source here for those interested; you probably just need to iterate over the remaining empty values in a more effective way than I am: http://ctrl-v.org/3708
It did 13x13 really fast but I have a hunch it might not work very well for 17x17...
( Link: http://pastebin.com/m51149dd9 )
Edit: Oops, my random-restart code had an obvious bug. It's probably not very useful anyways, so I removed it.
1 1 . . . . . 1 1 . . . . . 1 . .
. 1 1 1 1 . . . . . . . . . . . .
1 . 1 . . 1 . . . . . 1 . . . . 1
1 . . 1 . . 1 . . . 1 . . . . 1 .
1 . . . 1 . . . . 1 . . . 1 . . .
. . . 1 . 1 . 1 . . . . . 1 . . .
. 1 . . . 1 1 . . 1 . . . . . . .
. . 1 . . . 1 1 . . . . 1 . . . .
. . . . 1 1 . . 1 . . . 1 . . 1 .
. . 1 . . . . . 1 1 1 . . . . . .
. . . . 1 . . 1 . . 1 1 . . . . .
. . . . . . 1 . 1 . . 1 . 1 . . .
. . . 1 . . . . . 1 . 1 1 . 1 . .
. 1 . . . . . . . . 1 . 1 1 . . 1
. . 1 . . . . . . . . . . 1 1 1 .
. . . . 1 . 1 . . . . . . . 1 . 1
. . . . . . . 1 . 1 . . . . . 1 1
The solver chokes on anything larger than a 6x6 grid, but I've had good luck adding one row at a time to a smaller solution.edit: He mentions that he already found a size 74 set in one of the linked pdfs. http://www.cs.umd.edu/~gasarch/BLOGPAPERS/17x17.pdf
1 0 1 0 2 0 2 1 0 2 1 3 3 2 3 3 1
3 3 0 3 1 2 3 0 0 1 1 1 2 2 2 0 1
3 2 3 2 2 0 1 0 3 0 3 3 1 1 0 2 1
0 3 1 2 1 1 2 3 1 0 3 0 0 3 2 0 2
0 1 1 3 3 3 1 0 1 1 2 2 3 2 0 2 0
3 1 2 2 3 1 0 1 0 3 0 2 0 3 0 1 2
1 1 1 2 0 2 3 2 3 3 0 0 1 2 0 0 3
2 2 0 0 3 1 0 1 3 1 3 0 1 2 1 3 2
0 0 2 0 0 2 0 3 1 2 1 2 1 3 3 1 3
3 2 2 1 0 3 0 1 1 0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 1 3 1 0 2 3 1 2
3 2 3 0 2 1 0 0 0 0 1 2 1 3 2 1 3
1 3 3 2 3 1 0 1 2 2 0 3 0 1 2 0 2
2 0 2 1 3 0 3 1 0 2 3 1 2 0 0 1 3
3 0 2 0 1 3 1 2 3 3 2 1 1 2 2 0 0
0 0 2 3 2 3 2 0 2 1 0 3 1 1 1 3 3
2 0 1 3 3 0 2 3 3 0 1 1 0 1 2 2 1
0 1 0 2 1 0 2 3 1 3 2 2 2 1 3 0 3
3 2 2 2 0 2 0 1 1 1 1 3 3 0 3 2 0
3 3 0 3 2 1 3 2 1 0 0 1 2 0 1 2 2
1 3 3 0 0 3 1 3 1 2 0 2 3 2 0 2 1
0 1 3 0 2 2 3 1 3 2 2 0 0 0 1 3 1
Edit: I can't reply to you, so...It's not pretty, but I did a few things. Instead of taking the top n candidates and breeding them randomly, I kept all of them (NUM_STATES 200 and KEPT_STATES 200), but weight them according to score. So the best scores have the highest chance of passing their DNA down to the next generation, but the occasional loser gets lucky too.
Mutation is also weighted, so the most likely number of mutations is zero, but it's possible to have up to 4. Increasing this value made the performance go down, but it's also possible that there is no way to get to a solution by incrementally tweaking a decent attempt. Which could explain why I'm stuck at 12.
There are a few optimizations that may or may not make a difference, for instance in the scoring function. I think the pick_best_states function was not actually picking the best states. If you had two states with the same score, the first one is kept, but the next one is not. I fixed this. The stupid thing is, with NUM_STATES and KEPT_STATES at 200, it's basically an n^2 sort now. I never bothered to improve that.
Finally, compiled with -O3 and let 'er rip.
I've only got to 30 here running 8 instances of mine.
(Also, I imagine this could probably benefit from a really fast PRNG, like an LCG.)
12032213310013002 21301001102213023 30120303220111321 03330220131122010 22313133001012230 03123321011233102 20313010123321102 03022111302120233 31232100023232131 03201103213001212 11000232021331223 20221213031300031 13130132102302302 31103210230220313 12310021322030311 21012022213103330 12201332333120100
i.e. find a grid where you can not make any moves in the game?
Combinatorics isn't really abstract as far as math goes. In fact some call it concrete mathematics.
Not that I really have anything against abstract mathematics. It's still very cool, but it's just not going to get me very excited - or at least this exact branch of it, I guess.
Huh? Is it naturally abstract?
(Are you, perhaps, somehow associated with this or another magnet program in the MD area?)
"Exactly one of the following sets is in OBS4: 19x17, 18x17, 17x17."
If I've understood it correctly, OBS4 is the set of grid-sizes which are impossible. But if 17x17 were impossible, surely the bigger ones would be too?
[Edit to answer my own question: the OBS4 set seems to be made up solely of the smallest such grid-sizes that can be given without being redundant.]
Ie, if (19,17) is in OBS4 then (19+x,17+y) is not 4-colorable either. So given a shape (x,y) or even a more funky collection of grid points like a triangle, to know if it's 4-colorable just check for all X in OBS4, if you can fit X inside your shape.
That's difficult.
Agreed, but that is why it would be worth $1M :-).
The problem posed here is about colouring a 17x17 grid such that there is no monochromatic rectangle.
These problems have nothing in common aside from the word "colouring" and the number "4".
This problem differs in two ways.
First, we're not looking for all of the vertices to be different colors. We're looking for them to not all be the same color. This is easier to do.
Second, he's not trying to color a simple planar graph. He means every rectangle on the grid -- for example, a 7 x 8 rectangle in the middle somewhere. This is much, much harder to do.
(To be fair, I made the same mistake on a first reading of the problem.)
Otherwise the problem seemed trivial.
On the other hand... how many possible 17x17 4-colored grids are there? Can this be brute forced?
I think that's quite a few. Your mileage may vary based on the force available to you for bruting.
You don't need quite that many -- you could test 2^289 (and you can probably skip many of them) and look for the "rectangle free subsets" that he mentions in the slides, and then just look for four of them that don't overlap. Still gonna take eons.
There's 289 points on the grid, and 4 options for each. So... 2^578 options.
Can this be brute forced?
That depends. Do you have a kilobit quantum computer available?
My bad - sorry.
4^(17*17) ~= 10^173.. a bit too many to brute force, but I'm sure you could narrow the number down a lot with simple heuristics (though it would still be too large to brute force).
http://en.wikipedia.org/wiki/Dual_graph
In this case, the dual of a grid is a grid. So at least that part of it would be the same problem. The other distinctions are true, though.