Slashdot Mirror


Solve a 'Simple' Chess Puzzle, Win $1 Million (st-andrews.ac.uk)

An anonymous reader brings an important announcement: Researchers at the University of St Andrews have thrown down the gauntlet to computer programmers to find a solution to a "simple" chess puzzle which could, in fact, take thousands of years to solve, and net a $1 million prize. Computer Scientist Professor Ian Gent and his colleagues, at the University of St Andrews, believe any program capable of solving the famous "Queens Puzzle" efficiently would be so powerful, it would be capable of solving tasks currently considered impossible, such as decrypting the toughest security on the internet. In a paper [PDF] published in the Journal of Artificial Intelligence Research today, the team conclude the rewards to be reaped by such a program would be immense, not least in financial terms with firms rushing to use it to offer technological solutions, and also a $1 million prize offered by the Clay Mathematics Institute in America.

Devised in 1850, the Queens Puzzle originally challenged a player to place eight queens on a standard chessboard so that no two queens could attack each other. This means putting one queen in each row, so that no two queens are in the same column, and no two queens in the same diagonal. Although the problem has been solved by human beings, once the chess board increases to a large size no computer program can solve it.

125 comments

  1. Large size? by hcs_$reboot · · Score: 2

    "once the chess board increases to a large size no computer program can solve it"

    How large is that? Many algorithms for simpler problems would fail if the size is multiplied by a big number.

    --
    Slashdot, fix the reply notifications... You won't get away with it...
    1. Re:Large size? by fahrbot-bot · · Score: 2

      "once the chess board increases to a large size no computer program can solve it"

      How large is that? Many algorithms for simpler problems would fail if the size is multiplied by a big number.

      More to the point, anything larger that 8x8 isn't a chess board - problem solved, where's my money?

      --
      It must have been something you assimilated. . . .
    2. Re:Large size? by Anonymous Coward · · Score: 0

      It's like saying 'double the number of polynomials and it takes longer to compute'

    3. Re:Large size? by K.+S.+Kyosuke · · Score: 1

      More to the point, anything larger that 8x8 isn't a chess board

      Well...

      --
      Ezekiel 23:20
    4. Re: Large size? by Anonymous Coward · · Score: 0

      click bait article

      "Before consideration, a proposed solution must be published in a refereed mathematics publication of worldwide repute (or such other form as the SAB shall determine qualifies), and it must also have general acceptance in the mathematics community two years after. Following this two-year waiting period, the SAB will decide whether a solution merits detailed consideration."

    5. Re:Large size? by Paradise+Pete · · Score: 1

      How large is that? Many algorithms for simpler problems would fail if the size is multiplied by a big number.

      To slashdot's apparent surprise, once again the article happens to provide the answer. Amazing run of good fortune there.

      -- "What would be necessary would be either a proof that there is an algorithm that can solve the n-Queens Completion puzzle in polynomial time, or a proof that no such algorithm exists.”

    6. Re:Large size? by Anonymous Coward · · Score: 0

      "once the chess board increases to a large size no computer program can solve it"

      sod that... I'm still stuck on a solution for n=2

  2. misleading title and rebranded P vs NP by z3alot · · Score: 5, Insightful

    First of all, the problem cant in any real sense be considered a chess puzzle, except in the superficial sense of placing queens on a board. Chess reasoning has nothing to do with a solution of the problem.

    Second of all, the $1m prize is exactly the clay millennium prize for the resolution of P vs NP. If n-qeens has a solution in P, being NP-complete, this implies P=NP.

    tldr Sensationalist title is sensationalist

    1. Re:misleading title and rebranded P vs NP by dcollins · · Score: 1

      Moreover, you can write a headline like this every single day and never exhaust the number P vs NP equivalent problems.

      How Sudoku could win you a million dollars

      Finding others is an exercise for the reader.

      --
      We know where leadership by an anti-intellectual "strongman" who scapegoats minorities and likes boisterous rallies goes
    2. Re:misleading title and rebranded P vs NP by Anonymous Coward · · Score: 0

      THANK YOU.

      This came up in my news feed somewhere else earlier in the week, and I was like WTF seriously!

    3. Re:misleading title and rebranded P vs NP by JoshuaZ · · Score: 1

      It also isn't even the only chess related problem which is NP-complete. For example, the retrograde chess problem is NP-complete. That problem is whether given an arbitrary chess board with some set of pieces, can you reach a given other configuration? It is very easy to make NP-complete or NP-hard problems involving chess, and this has to do with the fact that generic chess (who would win with a given configuration and a given set of pieces) is either PSPACE complete or EXP complete depending on how exactly one generalizes certain aspects of chess (such as the 50-move stalemate move). Curiously, Go is actually worse under some versions of the ko rule, extending even to being NEXP-complete (NEXP is conjectured to be larger than EXP or PSPACE and is provably bigger than NP).

    4. Re:misleading title and rebranded P vs NP by TimothyHollins · · Score: 2

      It's not necessarily the issue of P=NP, though such a solution absolutely would resolve this issue.

      The "problem" here is that there is no cost function. This is an Ariadne's Thread dilemma in that you can only verify your solution once you have placed as many queens as your placement will allow. You cannot place a single queen on an n x n board and then conclude that you are one step closer to a solution. There is no way to subdivide this problem, hence no way to solve it in a "sufficiently" fast manner (i.e. a greedy algorithm/DP or similar). You are constrained to exhaustive/B&B/randomized approaches, guaranteeing a upper bound of O(SUCK).

    5. Re:misleading title and rebranded P vs NP by igny · · Score: 1

      It is not equivalent to the clay millennium prize. One can solve the queen chess problem by building an efficient quantum computer. You can't get the clay millennium prize if you built such quantum computer.

      --
      In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
  3. Solve P=NP win $$$ by Anonymous Coward · · Score: 1

    Also something about chess.

  4. I solved it by Anonymous Coward · · Score: 2, Funny

    I have discovered a truly remarkable program which this box is too small to contain. I'll complete it after I get back from a duel I have later today.

    1. Re: I solved it by Jesus+H+Rolle · · Score: 1

      Don't forget your fedora!

  5. The actual content of the article by Anonymous Coward · · Score: 4, Informative

    Three researchers proved that the queen problem is NP-complete. The prize is the millennium prize for P=NP. The journal publication is at http://jair.org/papers/paper5512.html.

    1. Re: The actual content of the article by Anonymous Coward · · Score: 0

      Thanks, the summary didn't make any sense.

    2. Re:The actual content of the article by Anonymous Coward · · Score: 1

      I haven't read the paper, but I have a suspicion that this paper's conclusion that partially-filled N-queens is NP complete will be shown to be false.

      Why? Because my gut tells me that you can probably permute the board and convert partially-filled n-queens problem to a "normalized" form that can be solved as efficiently as the empty board n-queens problem: "can this input be rearranged into a prefix substring of the normalized solution for NxN?"

    3. Re:The actual content of the article by Anonymous Coward · · Score: 0

      I haven't read the paper, but I have a suspicion that this paper's conclusion that partially-filled N-queens is NP complete will be shown to be false.

      Why? Because my gut tells me that you can probably permute the board and convert partially-filled n-queens problem to a "normalized" form that can be solved as efficiently as the empty board n-queens problem: "can this input be rearranged into a prefix substring of the normalized solution for NxN?"

      One of the very few interesting comments here got a zero score... Speculative to be sure,.he knows this is the n-queens completion problem but he is set adrift in a sea of idiots yammering about about the 8 queens problem after a BS post referencing a totally inane university press release. I give up on /.

    4. Re:The actual content of the article by Anonymous Coward · · Score: 0

      Not exactly the n-queens problem (which is always yes (for n > 3)), but the n-queens completion problem, where the input to the problem is a board with some queens scattered around, and the question is whether there exists a solution to the n-queen problems that is an extension of the input.

    5. Re:The actual content of the article by Anonymous Coward · · Score: 0

      I like how you think.

    6. Re:The actual content of the article by michael_wojcik · · Score: 1

      Because my gut tells me that you can probably permute the board and convert partially-filled n-queens problem to a "normalized" form that can be solved as efficiently as the empty board n-queens problem: "can this input be rearranged into a prefix substring of the normalized solution for NxN?"

      Interesting idea, but JOTTOMH I'm concerned about the normalization step. Permutation grows super-polynomially, of course, so naive normalization won't get you out of NP-Complete.

      Or from the other direction: assuming one-way functions exist, then starting with a normal-form partial-N-queens solution, shuffling into any of the non-normal permutations is poly-time, but reversing that shuffle looks at first glance like it might be orthogonal to some other one-way functions.

      But that's based on, like, 30 seconds of thinking about it. So I'm probably missing something obvious.

  6. 8 queens? by fyngyrz · · Score: 2

    anything larger that 8x8 isn't a chess board - problem solved, where's my money?

    Not only that, but if an 8-queen solution works on an 8x8 board, it'll work just as well on a 1000x1000 or a 10k x 10k board, etc. board. Move it over, put it in the same relative location in the 8x8 group at the corner of the larger board, done. So solve for 8x8 and move.

    So you'll need to split that money with me, pal. :)

    Of course, it's just slightly possible that TFS is not an accurate summary of the actual article / problem, but...

    Nah. Besides, everyone knows that reading TFA is un-American. Even reading the summary raises red flags with Homeland Security, and may result in a National Security Letter (which you can read, but can't discuss.)

    --
    I've fallen off your lawn, and I can't get up.
    1. Re:8 queens? by CustomSolvers2 · · Score: 2

      Not only that, but if an 8-queen solution works on an 8x8 board, it'll work just as well on a 1000x1000 or a 10k x 10k board,

      The summary and even the linked page are a bit confusing on this front, but the paper is clearer. Apparently, this isn't an 8-queen problem, but an n-queen problem in an n*n board. The exact conditions aren't too clear either (e.g., "solve the problem really fast"), but it seems that creating an acceptably quick solution for n = 1000 should be enough.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    2. Re:8 queens? by Anonymous Coward · · Score: 2

      Since this is all really backed by the discussion about NP != P, what you need to do is create a polynomial time solution for it and then that will be "fast enough". If your algorithm executes in exponential time it won't be fast enough.

      If you don't understand what I just said, welcome to Slashdot, we (used to) talk tech stuff here. Read this: en.wikipedia.org/wiki/Time_complexity.

    3. Re:8 queens? by CustomSolvers2 · · Score: 2

      If you don't understand what I just said, welcome to Slashdot, we (used to) talk tech stuff here

      I am a senior programmer with 2 university degrees (one of them in engineering) who has been full-time working on software development for over the last 8 years. I know what your time complexity is and its exact applicability to my work: none. I also have been contributing here relatively often during the last years; most of the times by mostly focusing on "tech" issues. What do you think that is more "tech": actually solving a problem by coming up with the optimal algorithm; or getting lost (read below) on abstract ideas originally intended to precisely help you solve that problem more efficiently.

      In any case, I was plainly highlighting an evident, reality: unclear and misleading description. But I could even say that this whole proposal doesn't make too much sense as far as solving that problem much quicker is relatively easy; but this isn't the intended goal. The goal is to improve the way in which a wrong approach (= using a standard chess engine performing a standard analysis when this specific situation calls for much less than that) solves a problem by plainly ignoring the obvious solution of coming up with the more efficient, to the point approach. So, in the best scenario, this whole proposal is a (confusing) bad example to explain certain theoretical idea whose "tech" character might not be too clear.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    4. Re: 8 queens? by Anonymous Coward · · Score: 0

      I just ordered Knuth's TAOCP for my office. We're a networking shop and three guys are learning programming now. But when I am asked about "why did you choose a regex here instead of simply comparing strings" and I explain algorithmic complexity of compilation of a refer into either a DFA or NFA as well the computational complexity of the execution of the compiler result vs the computational complexity of searching string, they look at me like "I thought I was getting good at programming but if you're what a real programmer is, I have a really long way to go."

      So, I'll start teaching Big-O and algorithms formally soon at work.

      Of course... I'm curious with regards to the queen's puzzle. This strikes me as a problem that should be solved by graph theory in a means that could later be reduced in complexity. The proof however seems to me from brief evaluation to have a solveable root within a minimal spanning tree or similar.

      I'm itching to waste a few days trying to identify a method of solving the problem with a minimal spanning tree while also reducing branch decision depths.

      I have a severe asberger's "friend" I think could at least confirm it or beat me senseless for being stupid ... surprisingly while displaying no empathy within a few minutes of listening to me babble.

    5. Re: 8 queens? by CustomSolvers2 · · Score: 1

      Of course... I'm curious with regards to the queen's puzzle. This strikes me as a problem that should be solved by graph theory in a means that could later be reduced in complexity. The proof however seems to me from brief evaluation to have a solveable root within a minimal spanning tree or similar.

      Nothing even close to these lines. The solution is written in a post below, which I have completed with some additional help to get the idea. Basically, treating the problem not as chess (because this isn't chess), but as queens under restricted conditions which have to be in certain positions (= patterns which aren't too difficult to find after looking at a solved situation).

      Clarification for you + the parent: using the methodology (or computer or chair or pencil, etc.) which makes you work more comfortable is certainly fine. Blindly believing in pseudo-magical properties for said methodology starts sounding kind of weird, but it is OK with me (I live and let live). But when you start thinking that you can arbitrarily impose your restricted perception to others and use such an ignorance (because someone blindly believing in whatever without considering anything else is clearly a very ignorant person) to plainly attack anyone acting differently; in that exact moment, you become the kind of fanatic idiot who deserves to be treated as such.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    6. Re: 8 queens? by Anonymous Coward · · Score: 0

      The Queen's problem has nothing to do with standard chess engines, and that alone is a clear tip of an iceberg of misunderstanding. For something that is a long standing, well documented problem, there is no excuse for being that wrong and that sure you've solved it. If you have years of tech experience, then you should be well aware that the quality of one fluff piece news article is not an excuse for misunderstanding something widely written about.

    7. Re:8 queens? by Anonymous Coward · · Score: 0

      The problem with jackass elitists is that they don't understand how to change. Spending time trying to solve whether the problem is NP, rather than coming up with an ugly solution that's iterative and fails most of the time.

      Rather than calculating the mathematical bounds of the deterministic solution, why not come up with a new way of asking the question that changes the problem? Brute force it is how it's solved by hand. So brute force it for all soutions.

      And don't use "AI" to brute force it intelligently. Use human intelligence to map out "exclusion zones" for each placement. Start with one of the middle 4 squares (so you are less likely to be "trapped" at the end). Then spiral out placement, for each placement, you exclude one horizontal and one vertical, and two diagonals. Repeat until done.

      That's how a human does it, trying to minimize newly blocked squares with each placement. Best case o(n). Worst case much worse than that.

      Or, solve the problem in an inefficient manner, then use that program to solve the first 23.2B solutions (taking 10 years to do it), then you solve all 23.2B solutions in O(1) time with a simple lookup table, and meeting their time requirements.

      Problem solving isn't about solving the question asked, but simplifying it to something solvable.

    8. Re:8 queens? by PacoSuarez · · Score: 1

      About a half a minute on my laptop after programming for about 20 minutes. I am sure that's not what the prize is about.

      (C++14 using gcc on Linux)

      #include <iostream>
      #include <algorithm>
      #include <cstdlib>
      #include <cmath>

      int s[1000];

      double energy() {
          int result = 0;
          for (int i = 1; i < 1000; ++i) {
              for (int j = 0; j < i; ++j) {
                  if (std::abs(s[i]-s[j]) == i - j)
              ++result;
              }
          }
          return double(result);
      }

      int main() {
          std::srand(0);
          srand48(2);
          std::iota(s, s+1000, 0);
          double e = energy(), r = e;
          for (double T = 1.0; ; T *= .9999) {
              int i = std::rand() % 1000;
              int j = std::rand() % 1000;
              std::swap(s[i], s[j]);
              double n = energy();
              if (drand48() > std::exp((e-n)/T))
                  std::swap(s[i], s[j]);
              else {
                  e = n;
                  if (e < r) {
              std::cout << T << ' ' << e << '\n';
              r = e;
              if (e == 0)
                  break;
                  }
              }

          }

          for (int i = 0; i < 1000; ++i)
              std::cout << s[i] << ' ';
          std::cout << '\n';
      }

    9. Re:8 queens? by clovis · · Score: 2

      anything larger that 8x8 isn't a chess board - problem solved, where's my money?

      Not only that, but if an 8-queen solution works on an 8x8 board, it'll work just as well on a 1000x1000 or a 10k x 10k board, etc. board. Move it over, put it in the same relative location in the 8x8 group at the corner of the larger board, done. So solve for 8x8 and move.

      So you'll need to split that money with me, pal. :)

      Of course, it's just slightly possible that TFS is not an accurate summary of the actual article / problem, but...

      Nah. Besides, everyone knows that reading TFA is un-American. Even reading the summary raises red flags with Homeland Security, and may result in a National Security Letter (which you can read, but can't discuss.)

      You are correct, the article and the summary are misleading/wrong.
      Here's those guys explaining the problem and prize again.
      https://www.claymath.org/event...

    10. Re: 8 queens? by paradigm82 · · Score: 1

      Regarding:
      But when I am asked about "why did you choose a regex here instead of simply comparing strings" and I explain algorithmic complexity of compilation of a refer into either a DFA or NFA as well the computational complexity of the execution of the compiler result vs the computational complexity of searching string, they look at me like "I thought I was getting good at programming but if you're what a real programmer is, I have a really long way to go."
      The reason for choosing to use a regex over a string comparison has nothing to do with the computational complexity of one versus the other. They are both linear in the length of the string. However, a regex offers a much more powerful comparison because you're not limited to comparing for an exact match (as with a string compare) but can put many more constraints on the structure you are comparing against/searching for. But the regex is not anymore linear time than the string comparison is. There are situations where a regex is faster by some constant due to less memory access etc. for instance if the regex is shorter than the string you would be comparing to (since the string compare will have to scan through two strings in memory), but firstly this has nothing to do with computational complexity, NFA/DFA etc. as you mention but is just due to the way computers are constructed in practice and only involves a constant factor. Secondly, it means the problem you are solving is more about matching a pattern than comparing to a fixed string (where you would have to embed a fixed string containing the pattern into the program) so it is not really a subtle performance optimization to use a regex, it is simply the correct solution for all sorts of reasons.

    11. Re:8 queens? by CustomSolvers2 · · Score: 1

      About a half a minute on my laptop after programming for about 20 minutes. I am sure that's not what the prize is about.

      There seems to be lots of misunderstanding(-prone people) in this thread (and I have to still read a few replies below; I don't want even to imagine what is waiting for me down there! Pff). Please, re-read my comment and tell me where I have written any indication regarding the proceeding or expectations in this specific problem? I have plainly summarised what the linked page (+ a sensible interpretations of its contents because it is very unclear) says. That professor is expressly saying that for n=1000, the time requirements are already unacceptably high and that's why I interpret that they would consider a good enough solution anything working reasonably fast under these conditions. By bearing in mind that the time requirements are already tremendously high for that value, it makes sense to assume that a reasonably-fast solution under these conditions will already be fast enough for much higher values of n.

      Now, your code. Well... it pure (dishonest) nonsense which might not even compile (didn't test it and I am not used to deal with C++, so I cannot tell for sure at first sight). Apparently, you have written a loop performing some variations in an array (presumably including the 1000 queens; although you should have written it to deal with n queens & n*n board; although well... why bothering right?). You are calling a weird method with a weird name (energy) performing weird things and whose point within the loop is unclear (wasting time for no reason? Looking cool because writing nested loops is cool? Not sure). The algorithm is basically built on random numbers, calculations and actions which, even after a very quick look, are clearly not having anything to do with what this problem is about.

      Ironically, an efficient solution for this problem isn't too difficult, could be built quite quickly too and the code would be pretty much of the same size than the one you wrote (there is some comments about this in the posts below; and I am afraid that I will have to write even further clarifications right now, so even you should be able to understand what is a pretty simple concept). But, unlikely your sad attempt, It would actually be solving the problem; rather than proving your low understanding skills, what seems a dishonest(ly aggressive) behaviour and not precisely a very solid programming approach.

      In summary, your algorithm is pure crap and kind of tells something about your personality and expectations. Are you used to deal with lying people to whom you usually lie, right? You don't solve things and try to understand/be understood, you plainly censor anyone saying anything even slightly different than what you consider acceptable/can understand (apparently, not too much) and intentionally rely on what you think that are obscure ways (although really are petty attempts only showing your ignorance and the one of those with whom you usually deal) to prove your underlying point!? If are used to situations where you can show this piece of crap to someone with even a tiny understanding of programming (in any language) and that person says to you "OK, no problem", you would be certainly surrounded by extremely ignorant and dishonest people. The only sensible behaviour of a person (not even a programmer) facing something which cannot fully understand is trying to understand it (even via asking you), without daring to make the slight decision like appraising/criticising it before that happens. Just the fact that you think that throwing a piece of crap making absolutely no sense in this context and expecting (actually knowledgeable!) people to blindly accept that and plainly lie to you ("it is ok"), tells quite a lot about the quality of the knowledge, principles, expectations of quite few "programmers" or "software developers" (as whatever you choose to self-identify). Please, go back to your made-up world of abstract words, liars and poor-quality everything and don't bother me again with your pathetic nonsense.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    12. Re: 8 queens? by Anonymous Coward · · Score: 0

      Actually we already know how to solve the problem efficiently for all n greater than 3. The Wikipedia page for the eight Queens problems has a reference to the paper in its opening paragraph.

    13. Re:8 queens? by CustomSolvers2 · · Score: 1

      Down this thread, you can find a PHP code delivering what is expected. It might not be perfect (not really sure), but it is certainly very close to solve the problem here. And the size of the code (+ effort for an actually knowledgeable person, actually understanding the problem and actually delivering a reasonably acceptable solution) is similar to your crap. See? Doing something useful or relevant requires pretty much the same effort than making a fool of yourself, lying and contributing towards creating a shitty world/environment. So, if you are not in a position to properly understand whatever issue for whatever reason, why don't you make all of us a favour and plainly don't do anything? Why do you think that sharing crap has any value to anyone, that the whole world has to be understanding with whatever problems you have? Knowledgeably, actively, relevantly, positively (what also includes reasonable critics) contribute or just do nothing. It isn't too difficult, right?

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    14. Re:8 queens? by michelcolman · · Score: 1

      I'm not sure whether or not I understood your "solution", but if I did, I don't think it works quite as easily as you suggest.

      What I think you proposed, was dividing the larger board into a grid of sub-grids, and then just filling them in recursively (so, for example, to get a 64x64 solution, start with an 8x8 solution, replace each empty square with an empty 8x8 grid inside of it, and each queen with an 8x8 solution). If that's your method, it doesn't work because the diagonals on the higher order board spill over into adjacent squares, therefore no longer guaranteeing a conflict-free setup. A queen on the 64x64 grid can conflict with another queen which, in the original 8x8 supergrid, is a knight's jump away.

      Or maybe you were doing it differently?

      Anyway, as you suggested, solving nxn is not really what they're looking for. The problem is completing an nxn board with a number of queens already fixed on the board.

    15. Re: 8 queens? by CustomSolvers2 · · Score: 1

      The Queen's problem has nothing to do with standard chess engines

      Certainly it doesn't, but after a quick look at the paper and after how they seem to be facing the problem, they don't seem to be aware about that fact. I would personally never have thought about facing this situation in that way; you can read some of my comments in the lower part of this thread to confirm that point.

      For something that is a long standing, well documented problem,

      Honestly, this is the first time when I have thought about this problem and it seemed pretty straightforward to me. As commented below, the first approach coming to my mind (and the one I have right now, after having discussed with different people here) was to analyse the solved 8x8, look for the sure trends related all the positions of the queens and care about variations on said pattern provoked by increase/decrease of the board size; by assuming this to be relatively easy because of all the variations being very regular and symmetrical. But even in case of being proven a complex pattern, I would have stick to that approach anyway and wouldn't ever consider the option of building a chess-like algorithm (i.e., one accountings for the queen moves and analysing forward/backwards).

      there is no excuse for being that wrong and that sure you've solved it

      Wrong? Look down this thread, where you can find a reasonably good first step to solve this problem for any n in PHP. I didn't write it, but that person came from an equivalent approach which was my first thought after having read this problem. If I knew that there was some money really involved or anything making my effort worthy, I would certainly create an algorithm solving this problem for any n. And my approach would start from similar lines to that code below.

      If you have years of tech experience, then you should be well aware that the quality of one fluff piece news article is not an excuse for misunderstanding something widely written about.

      I am still not sure how I have misunderstood anything, but I have seen quite a few people here misunderstanding lots of things which I consider pretty evident. All what I have done was, initially, correcting the numerous lacks in the description of the problem; and afterwards, highlighting issues which I considered evident (e.g., even despite having clear what the intention of the authors is, the proposed example is bad because can be solved much easily than what they seem to think).

      Regarding your "widely written about", note that I mainly focus on objectively analysing the given conditions and, as a first resource, I usually rely on my own knowledge/expertise. If I understand that the problem is too complex, I might try to find already-done solutions; rarely by blindly applying them (I do almost nothing blindly) but mostly to speed up my understanding about the problem and the best way to proceed. In this specific case, I didn't see the need of doing such a thing and that's why I didn't do any research about existing solutions to this problem.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    16. Re:8 queens? by CustomSolvers2 · · Score: 1

      I have already spent too much time here replying people showing what I consider different forms of ignorance, poor-understanding and even dishonesty. Although your intention + knowledge/understanding capabilities aren't completely clear after reading your post (which honestly I have just quickly skimmed through), I don't feel like starting what looks like a new set of nonsensical misinterpretations going nowhere. Sorry, but I will plainly ignore what you wrote.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    17. Re: 8 queens? by CustomSolvers2 · · Score: 1

      Actually we already know how to solve the problem efficiently for all n greater than 3

      No idea who is "we" and what "efficiently" means in this context, but this is the first time I see/think about this problem and my first impression regarding how to face it doesn't seem too improvable. There seems to be clearly-defined, regularly-varying patterns whose understanding/implementation/validation doesn't look too difficult; and the resulting algorithm would solve the problem for n almost immediately (take a look at a PHP code below written by someone else to understand better what I mean).

      If, when I started posting in this thread, I was aware about the numerous confusions and misunderstanding that what I thought evident would provoke, I would have started working right away on implementing+validating an algorithm and posting it here, rather than spending so much time by addressing abstract concerns. I have learned my lesson and this is what I will do next time.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    18. Re:8 queens? by PacoSuarez · · Score: 1

      Good grief. It's amazing all you could deduce from reading one line of text I wrote and from not reading the code associated with it. You didn't understand what the code is about, but somehow that indicates some problem with me, not with you. I see.

      The program I wrote works. It's a straightforward implementation of simulated annealing (look it up) for this problem, where the word "energy" is the standard term for the thing you are trying to minimize. I didn't bother making it for general n (although you can substitute 1000 by n and be done), I didn't comment it and I didn't give the variables reasonable names because it was a quick exercise to see whether finding a solution for n=1000 is very hard or not (it isn't), not production code.

      Now, take your pill and breathe.

    19. Re:8 queens? by Whibla · · Score: 1

      I confess I didn't understand the code, but that doesn't prevent me asking:

      How long did it take to run for n=1,000?

      How long will it take to run for n=1,000,000?

    20. Re:8 queens? by CustomSolvers2 · · Score: 1

      Now, take your pill and breathe.

      OK. I am always ready to recognise my errors and even to give as many chances as necessary to people really meaning well. I guess that the fact that my first impression about your intentions was really bad is pretty clear; even that I have had quite few bad experiences with misunderstanding-prone individuals. But if I made a mistake, I would be more than happy to correct it. And even in case of realising that your intention was good, regardless of the accuracy of your approach, I would also apologise for my reaction. So, please, explain how this algorithm is expected to accomplish what is intended here.

      At a first sight, I see the following:
      - Two references to random variables (just this is more than enough to know that it will not deliver what is expected).
      - A loop whose definition and iterations are quite unclear and, in any case, doesn't seem to obey to the expected X/Y positions within the board.
      - That energy method performs unclear-why iterations through the main array (containing not sure what, because 2D information is expected), calculates a mysterious double variable by analysing the relationship between all the positions (curious point: there is no arguments; so that function behaves always identically independently upon the given iteration in the main loop, it only cares about the contents of the main array) and returns a double variable whose exact contribution to the main loop is also a mystery.

      All what I can see here is that your algorithm doesn't meet the basic requirements (i.e., analysing/returning a 2D collection by following a set of very strict rules), relies on random analysis (what is completely against all what this is about) and seems extremely unclear regarding what it is expected to accomplished in each single step.

      Please, explain how you were expecting to account for the proposed problem in this way or, at least, what was your impression regarding the expected outputs/behaviour. You could even just tell me why you thought that this approach (which perhaps you took from somewhere else and which you used at a different point for other purpose) was helpful here. You can use a very simple example to illustrate your ideas, if you wish; there is a very nice picture in the Wikipedia page about the 8-queen problem showing how a solved setup looks like. You could just tell me how you were expecting your algorithm to deliver anything even close to that. I look forward to understanding better your intention/contribution and to eventually apologising for having misinterpreted your post.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    21. Re:8 queens? by CustomSolvers2 · · Score: 1

      If you want to spend time on something actually relevant, you should take a look at the PHP code in the lower part of this thread. It might need some tweaking, but it already represents a first good enough approach. The time requirements there are negligible.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    22. Re: 8 queens? by Anonymous Coward · · Score: 0

      Wrong? Look down this thread, where you can find a reasonably good first step to solve this problem for any n in PHP. I didn't write it, but that person came from an equivalent approach which was my first thought after having read this problem. If I knew that there was some money really involved or anything making my effort worthy, I would certainly create an algorithm solving this problem for any n. And my approach would start from similar lines to that code below.

      Do not piss on us and tell us it's raining. You have not solved any NP-complete problem, and apparently your response to being wrong is to double down on stupid. You may not be self-aware enough to detect your own bullshit, but everyone else can smell it.

    23. Re:8 queens? by mikael · · Score: 1

      The same could be said about factorizing large integer numbers in encryption or bitcoin mining with 256-bit hashes based on SHA-256. But it's the ratio to the vast combination size relative to the actual available solutions. Universities have a similar challenge in finding a campus wide timetable that guarantees that no student has a set of courses that clash in terms of tutorials/lectures/lab times, but that all students can attend tutorials/lectures/labs that are common to many subjects.

      --
      Vintage computer adverts: http://www.vintageadbrowser.com/computers-and-software-ads
    24. Re: 8 queens? by mikael · · Score: 1

      You can try a recursive solution. For each queen, place that queen somewhere on the board, mark off those squares that are blocked, for the next queen, repeat the same process. Repeat until you have filled the entire grid. You can exploit symmetry. For the first queen, you only need to try 1/8th of the board due to symmetry due to reflection/rotations.

      Perhaps there is some number sequence that only applies to boards of given sizes.

      --
      Vintage computer adverts: http://www.vintageadbrowser.com/computers-and-software-ads
    25. Re: 8 queens? by CustomSolvers2 · · Score: 1

      Do not piss on us and tell us it's raining. You have not solved any NP-complete problem

      Where have I even remotely suggested such a thing?!

      You may not be self-aware enough to detect your own bullshit, but everyone else can smell it.

      What bullshit? What are you talking about and with whom? I have created nothing, another user did, but there is an actual code down this thread! A properly working sensible algorithm which might need some tweaking, but already represents a very good first step to solve this specific problem (nobody said anything about solving any generic nothing). Something which anyone with a bit of (programming) knowledge should be able to almost immediately understand; not like the c++ code making no sense at any level which someone (you?) wrote for a reason I don't even know (still waiting for his explanations). Is this what you call bullshiting? Writing a completely nonsensical code and expect your audience to be so ignorant that they cannot even analyse it?! Nobody has implied that this has any effect on your precious NP/P, all this is in your head and in the misinterpretation-prone attitude you are showing right now.

      I honestly don't know what is the matter with some people online, labelling themselves as software developers but being scared of code! Not even understanding a simple algorithm! And reacting aggressively with anyone on account of their own lacks! Constantly lying and thinking that everyone lies to them?! It is freaking code!! It is exactly what it is!! There is no possible interpretation. It works/delivers what is expected or not! All your world of bullshit(ing), believing, abstract talking, etc. should ideally have no place in a so technical field as programming! You create problems where there is none! Why don't you try to just have the opposite behaviour? Why don't you enjoy your world of peculiarities, but let other people do things in a different way and stop assuming craziness and provoking nonsensical chaos? No (even slightly) sensible person can read most of the posts I have been writing in this thread (+ the original posts provoking them) and believe that this is normal! You have to make a very relevant effort to misunderstand so simple, to the point and adaptable ideas (+ my readiness to explain anything further) as the ones I wrote here. This is one of the few scenarios where "the problem is just you" is fully applicable. Seriously, go deal with those like you and stop bothering actually honest, knowledgeable people exclusively interested in knowing/understanding/solving.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    26. Re: 8 queens? by Anonymous Coward · · Score: 0

      Isn't complexity among the most basic knowledge to have to develop programs efficiently ?
      What's next? The concept of reference, loops and memory allocation?

    27. Re: 8 queens? by CustomSolvers2 · · Score: 1

      Isn't complexity among the most basic knowledge

      No. It is a convention used mostly by people having CS degrees. It is an as efficient way to communicate things as any other methodology by assuming that all the interlocutors are comfortable by relying on those concepts. I do specialise in improving efficiency and building very efficient algorithms completely from scratch and have never needed these concepts. I have fluidly communicated with other programmers in many different situations without relying on those ideas. They are purely and simply an alternative (out of many different ones) to perform a very simple task. You might be more comfortable by relying on it, I am not.

      The concept of reference, loops and memory allocation?

      Loops are one of the most basic parts of programming, which you have to use no matter what language or implementations are you working on. Memory allocation isn't a problem in programming languages since quite a few year ago; but, when dealing with older languages (e.g., right now I am developing a very demanding application in pure C), you also need to forcibly account for that. Reference is again an abstract concept with different implementations in different languages on which you might rely, but might not need to understand its abstract/theoretical definition.

      One thing is learning basics which might be done in many different ways and by focusing on different aspects; a different story is becoming an experienced/professional programmer what includes not just your theoretical background/initial learning, but many other things (e.g., general/technical knowledge and attitude, predisposition, really linking all the world, systematically learning, etc.) and mainly lots of practice, ideally under demanding enough conditions.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    28. Re:8 queens? by CustomSolvers2 · · Score: 1

      (I wrongly thought that this was a reply to one of my comments. Oopsie! To many messages not precisely too appealing for a Sunday. LOL)

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    29. Re: 8 queens? by retchdog · · Score: 1

      "I honestly don't know what is the matter with some people online, labelling themselves as software developers but being scared of code! Not even understanding a simple algorithm! And reacting aggressively with anyone on account of their own lacks! Constantly lying and thinking that everyone lies to them?!"

      methinks he doth protest too much.

      seriously, you're out of your fucking league on this one and really don't know what you're talking about. fwiw, it's out of my league too, but i'm at least smart and educated enough to understand what the problem is asking.

      and, yes, the downstream "real-world" implications for submitting something worthy of the prize would be incredible. with an efficient solution to N-Queens (essentially a permutation search), you could make everyday cloud-computing hundreds of times more efficient just by automatically optimizing job schedules and processor concurrency. hell, with just a little bit of savvy, you could replace Amazon as the de facto standard compute provider and still have them begging to use your tech for warehouse optimization.

      --
      "They were pure niggers." – Noam Chomsky
    30. Re: 8 queens? by CustomSolvers2 · · Score: 1

      seriously, you're out of your fucking league on this one and really don't know what you're talking about. fwiw, it's out of my league too, but i'm at least smart and educated enough to understand what the problem is asking.

      LOL. It is probably out of your league, it is certainly not out mine. Nothing even slightly related to software development, mathematics and even abstract description of whatever reality (the fact of not liking too much abstract whatever without a close relationship to actual applicability doesn't mean that I cannot deal with that; a different story is that abstract-ideas-focused people tend to not be too objective, honest and sensible-critic-friendly, what traditionally was associated with scientific/engineering/technical fields, via random and unmotivated attacks "like this is too much for you". LOL. Abstractly and wrongly repeating a few mantras isn't out of the league anyone; properly understanding the underlying concepts and sensibly criticising them is certainly out of the league of many people, but not mine).

      Just because of that statement, you seem a perfect candidate for this cult of knowing nothing talking a lot and feeling attacked/attacking to anyone saying anything even slightly outside what you have trained to repeat. I guess that you specialise in other abstract sub-field which you think that is completely unrelated to this, but actually is pretty much the same: nicely-wrapped ignorance (at least, when misused). Abstract theories/fields might be extremely helpful when used wisely by sensible people. Blindly believing and defending whatever abstract idea regardless of anything else and attacking anyone sensibly discussing about any of its points is fanaticism. People defending that are fanatics. And the corresponding theory/field stops being scientific-like and becomes religious-/faith/cult-like.

      and, yes, the downstream "real-world" implications for submitting something worthy of the prize would be incredible.

      As a good fanatic, you aren't listening to what I say or trying to understand my point. You are plainly repeating your ultimate truths by assuming what might be my position. You are plainly having a conversation with yourself (via creating a virtual version of me thinking what you consider that I have to think to allow your replies to make sense). I will repeat it for the last time, so please read the following paragraph very carefully:

      I HAVEN'T SAID A WORD ABOUT THE NP/P IMPLICATIONS OF THIS PROBLEM AT ANY POINT. I HAVEN'T COMMENTED ANYTHING ABOUT WHAT I THINK ABOUT NP/P, ITS EVENTUAL RESOLUTION, HOW THIS PAPER OR THIS PROBLEM IS RELATED TO THIS OR ANYTHING EVEN CLOSE TO THAT. MY ONLY MENTION TO ALL THIS HAS BEEN TO MERELY HIGHLY THE FACT THAT THE CLAIMED PRIZE WAS ACTUALLY LINKED TO ASSUMED THAT SOLVING THAT PROBLEM WILL IMPLY TO SOLVE NP/P; THIS IS MENTIONED IN THE LINKED PAGE BUT NOT IN THE SUMMARY AND THIS IS ALL WHAT I SAID.

      Now you can read each single of my comments in this thread and confirm by yourself that statement: all the references NP/P have been done by people like you with whatever (understanding) problems, unwilling to have a proper conversation to understand others and plainly wanting to fanatically defend their ideas against non-existent attacks. All my posts here were firstly focused on clarifying the confusing bits in both the summary and the linked page; and afterwards, on highlighting that a trivial solution (where the time requirements are negligible) is possible for this problem via forgetting about chess and facing it the location of elements under certain constraints following a very clear pattern which might slightly change with increasing/decreasing sizes. Another user wrote what I consider a sensible implementation and plainly referred to that implementation as a good example of my ideas. Additionally, I have been correcting lots of unmotivated misunderstandings, (slight) attacks and plainly dishonest attitudes of people whose motivations I cannot e

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    31. Re:8 queens? by Paradise+Pete · · Score: 1

      The exact conditions aren't too clear either (e.g., "solve the problem really fast"),

      They are clear: "What would be necessary would be either a proof that there is an algorithm that can solve the n-Queens Completion puzzle in polynomial time, or a proof that no such algorithm exists.”

    32. Re: 8 queens? by Paradise+Pete · · Score: 1

      You're not even solving the right problem. The actual problem is n queens on an n-sized board on which (and here's the important part) some of the queens have already been placed and cannot be moved.

    33. Re: 8 queens? by Anonymous Coward · · Score: 0

      Hummm... you do not know what you are talking about. That is the short version.

      The long one, some people tried to give but you chose to ignore.
      And yes, I make my money by implementing algorithms to search for solutions in NP problems, developing heuristics that match the business constraints the best we can.

      And if you could do that, we would probably be talking to each other in the real world.

    34. Re:8 queens? by CustomSolvers2 · · Score: 1

      "What would be necessary would be either a proof that there is an algorithm that can solve the n-Queens Completion puzzle in polynomial time, or a proof that no such algorithm exists.”

      Can you please tell me where you can find that sentence in the summary or in the linked page?

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    35. Re:8 queens? by SandorZoo · · Score: 1

      I confess I didn't understand the code

      It's fairly straight forward. The "s" array holds numbers from 0 to N, and represents the positions of queens on the board, for example if s[3]==5 then there's a queen at position (3,5). This method of representing the board automatically ensures no two queens share a row or column, so you just have to worry about diagonals.

      The "energy" function compares every queen with every other queen to see if they are on the same diagonal, and returns the number that are.

      The code starts with numbers all in order in the array (so s[0]==0, s[1]==1, s[2]==2, etc.), representing the queens all along the same diagonal from corner to corner. It then just keeps swaping entries at random until there are no queens on the same diagonal. The exact details of which swaps to keep, and which to undo is determined using simulated annealing

      How long did it take to run for n=1,000?

      On my system it takes a couple of minutes for n=1000. However, there's an obvious optimisation, that instead of recalculating the energy every iteration, you just adjust the current value every time you swap two elements. That brings the running time to under a second.

      How long will it take to run for n=1,000,000?

      For n=10,000 the time goes up to 3 minutes, so as it stands I don't think 1,000,000 is feasible with this algorithm.

    36. Re: 8 queens? by CustomSolvers2 · · Score: 1

      You're not even solving the right problem.

      ?! OK.

      (and here's the important part) some of the queens have already been placed and cannot be moved.

      Where is exactly that point explained in the description or the linked paper? How many queens have already been placed? Where have those queens been placed? Describe the problem properly and I will update my impressions.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    37. Re:8 queens? by Whibla · · Score: 1

      Thanks. That was very informative.

      I don't think 1,000,000 is feasible with this algorithm.

      You might be right. It might not be productive either.

    38. Re: 8 queens? by Paradise+Pete · · Score: 1
      It's in the linked paper . I got there from the link in the article.

      The new research concerns the n-Queens Completion Problem, where not only is the board larger, but also some queens have already been placed. That is, if some queens have already been placed on the n-by-n board, can you find a solution to the n-Queens puzzle without moving any of those queens?

      ...

      First, as just mentioned, the paper is about the n-Queens Completion problem, not the original n-Queens puzzle. Second, even the discovery of an algorithmic solution to the n-Queens Completion puzzle for all n would not be enough. What would be necessary would be either a proof that there is an algorithm that can solve the n-Queens Completion puzzle in polynomial time, or a proof that no such algorithm exists.”

    39. Re: 8 queens? by CustomSolvers2 · · Score: 1

      Thanks. But this is neither the Slashdot description nor the page linked from it. That page is referred by a link inside the linked page, which BTW I don't recall seeing yesterday (there was a link to the PDF version of the actual paper which I cannot find anymore). They might have updated that description.

      Anyway, my original post was meant to make clear what wasn't clear and your reference is precisely reinforcing that impression, as far as having to go to the page linked by the page linked in the summary isn't precisely clear :)

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    40. Re: 8 queens? by CustomSolvers2 · · Score: 1

      This is a different problem. Not what yesterday's description/linked page were saying (better: implying). But, no problem...

      If you have a m number of queens already placed in random (but valid) locations, I would also go with my preliminary idea of finding patterns. Rather than starting from the top/bottom, you start from one of the existing queens (because you have to know their location) and check the acceptable positions from it by applying the corresponding pattern (as suggested in the comments in the lower part: knight-like movements); then move the next queen or, when not having more placed queens available, start applying the corresponding pattern for empty locations. It certainly seems doable with negligible time requirements and by involving only a bit more of effort/slightly complex algorithm.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    41. Re:8 queens? by Anonymous Coward · · Score: 0

      I am a senior programmer with 2 university degrees (one of them in engineering) who has been full-time working on software development for over the last 8 years.

      In other words you are what we call as a "n00b" (technical term).

    42. Re: 8 queens? by retchdog · · Score: 1

      holy shit dude you are fucked up.

      i was just kidding before. your solution in PHP is genius & you're one of the few on the right track.

      --
      "They were pure niggers." – Noam Chomsky
    43. Re: 8 queens? by CustomSolvers2 · · Score: 1

      holy shit dude you are fucked up.

      I am not the kind of person who easily jumps to conclusions after a small conversation + minor additional information (e.g., your signature), but I am pretty sure already that your opinion has a very little value for me (and for anyone whose opinion I might consider). You seem the kind of person who can say one thing or right the contrary, by showing exactly the same knowledge and conviction.

      i was just kidding before.

      Again without being too much into drawing conclusions after a small conversation, I stick to my aforementioned saying-one-thing-or-just-the-contrary-and-for-no-clear-reason-seems-easy-to-you.

      your solution in PHP

      As said to you, repeated many times in others comments and as some people might automatically deduce from the fact of being two different users (separated by a very relevant UID difference), this is not my code. That code was written by another user who I don't know. I have plainly refer to it as a clear reference to explain my ideas on this front, because I would have written something similar.

      is genius

      I don't think so. It is a pretty simple algorithm in its preliminary stage (not even properly validated under all the conditions). I also consider the underlying idea pretty simple as far as this was the first approach coming to my mind.

      you're one of the few on the right track.

      The beauty of an actually working code (or clearly defined ideas about how to proceed to build certain algorithm -> this was my only contribution), as opposed to abstractly talking, lying, blindly guessing, etc., is that it can be easily validated. That code (understood as a preliminary step, which has to be adapted to the actual conditions of the problem, about which I knew later; apparently, some queens were already expected to be in the board) delivers what it is expected to deliver. On the other hand, abstractly talking about the eventual existence of a potential solution and the completely-out-of-proportion consequences of such an event is pretty difficult to be confirmed/dismissed. I was honestly very surprised to find so much people having problems to understand what I thought that was an evident approach to this problem. I thought that most of people here, mainly in a programming-focused discussion, were quite knowledgeable. Well, I guess that having prejudices (even positive ones) isn't too good :)

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    44. Re: 8 queens? by Paradise+Pete · · Score: 1

      It was obvious that the problem wasn't the straightforward placing of queens, so I knew I had to look further if I wanted to find out what the actual problem was. Fortunately there was a link in the article so I didn't have to go far. It shouldn't be too hard to come up with an algorithm that usually finds a solution. But that's still not solving the correct problem. You either have to prove that it can be solved in polynomial time or prove that it cannot. An algorithm that "works" is not that, even if you find one that never fails. That's not good enough, you have to prove it.

    45. Re: 8 queens? by CustomSolvers2 · · Score: 1

      It was obvious that the problem wasn't the straightforward placing of queens

      As explained, the new conditions (already placed queens) are too relevant as far as they don't affect the main underlying issues here: constant clearly-defined behaviours (movements of the queens; or better: distances between queens to allow a valid position) under regularly varying conditions (+1 queen/column/row). Just by analysing the problem in that way, it is clear that there is a more or less consistent pattern regardless of its complexity. The pure combinatorics/trial-and-error approach tends to be easier to implement and even less error-prone; in fact, I do tend to face the problems in that way under a wide variety of conditions. But here that alternative wasn't an option and trying to find the underlying pattern should have been seen as the only possible alternative.

      You either have to prove that it can be solved in polynomial time or prove that it cannot. An algorithm that "works" is not that, even if you find one that never fails. That's not good enough, you have to prove it.

      Having an algorithm actually delivering the expected results, whose performance might be easily and accurately measured, isn't good enough; but abstractly defining the complexity of a potential solution (what basically is an indirect way to have a generic impression about the expected performance of the corresponding algorithm) is good enough?! I am not interested in discussing about certain issues, but it seems that there is something there which isn't right.

      I think that you are trying to justify what cannot be justified without wanting to see the actual reality. There is no solution for what these people expect as far as they made a mistake (or, at least, didn't define properly the constraints of the potential solution). They thought that this specific example was descriptive of a certain abstraction and, from that mistake, deduced what might be the consequences for said abstraction in case that the problem would be solved. If the $1 million prize was really linked to the actual solution of the proposed problem, it would have been possible (even perhaps rightfully) to argue about whether the prize should be awarded for the proposed pattern-finding approach or not. But the reality is that the prize is actually associated with proving certain abstraction which has nothing to do with this specific problem as proposed ("solve it as you wish").

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    46. Re: 8 queens? by CustomSolvers2 · · Score: 1

      I meant "(already placed queens) aren't too relevant".

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    47. Re: 8 queens? by Paradise+Pete · · Score: 1
      It's a math problem. That's how math works. You have to prove things. Without proofs you're building on a foundation of sand.

      I think that you are trying to justify what cannot be justified without wanting to see the actual reality.

      I'm not trying to justify anything. I'm trying to explain the problem. You're approaching it from a programming point of view. That's the wrong point of view. The prize is being offered for a mathematical proof, not for an algorithm, no matter how clever it might be.

    48. Re: 8 queens? by Paradise+Pete · · Score: 1

      I meant "(already placed queens) aren't too relevant".

      Yes, I knew what you meant. But considering that the non-completion problem has a straightforward and known solution, and yet the completion version is the basis for this mathematical prize, I think you are underestimating the relevance of it.

    49. Re: 8 queens? by CustomSolvers2 · · Score: 1

      It's a math problem. That's how math works

      As explained below, I do get your point, but actually there are no maths involved in this specific situation. This is a simple pattern finding/applying which is very difficult or even impossible to be generalise to any other situation (what the maths contributions would be about). Basically, building an algorithm to allow the given piece of software to efficiently perform the expected actions. This is pure software development and algorithm building; a heterogeneous skill requiring knowledge from different sources (but mostly practice) and usually mastered by people from certain background (scientific, mathematical and similar). But this specific solution has more of common sense and problem-solving skills that maths. In fact, a person with low programming knowledge but relevant chess experience might even have intuitively delivered a quite sound solution.

      You have to prove things. Without proofs you're building on a foundation of sand.

      It isn't impossible to come with a better proof for anything than an actually tangible solution. It is also impossible to try to use a wrong example to proof what cannot be proven by using said example. Proving that this approach can deliver what the proposal expects is quite straightforward. A different story is to deliver what the proposers were expecting (= this case to be a descriptive example of certain abstraction).

      I'm not trying to justify anything. I'm trying to explain the problem. You're approaching it from a programming point of view. That's the wrong point of view.

      It is curious because, for me, I am the one explaining you what is going on (completely serious). I understand the (wishful) INTENTION of the proposal. I understand the point which you are trying to defend. But nothing of this is associated with the reality of this specific example. They made a mistake which you don't want to see. They thought that this example was descriptive of a problem, but it really isn't. They thought that any algorithm would have to deal with the huge increase of complexity associated with any combinatorial approach dealing with so many alternatives, but they were wrong! If you face the problem as a pretty basic pattern which is slightly modified with the variation of the conditions (= higher/lower board size), such an eventually wouldn't exist. The algorithm is already extremely fast and has a very low complexity, you can call this whatever you want.

      Let me explain it with a clear pseudocode:

      A) What they had:
      LOOP WHILE (i1 < max1)
      i1++
      max2 = geometrical_increase(i1)
      WHILE (i2 < max2) i2++ END LOOP
      END LOOP

      B) What they were looking for:
      LOOP WHILE (i1 < max1)
      i1++
      max2 = lower_increase(i1)
      WHILE (i2 < max2) i2++ END LOOP
      END LOOP

      C) What is actually required:
      LOOP WHILE (i < max) i++ END LOOP

      The prize is being offered for a mathematical proof, not for an algorithm, no matter how clever it might be.

      The prize is certainly offered for a mathematical proof, but for a different one: the one generically proving that certain abstraction is true for a wide variety of equivalent situations. There you have maths involved. Solving this specific problem doesn't contribute in absolutely any way to prove/dismiss that abstraction. That's why these guys made a mistake; they assumed that solving this problem would have required to come up with the kind of generic optimisation approach which would have brought some insights in the aforementioned abstraction, but this isn't the case. They should have chosen a different example or adequately defined the conditions under which this one might have been solved. A proposal on the lines of "consider all the possible queen movements and come up with a way to highly reduce the associated complexity" might have done the trick; but they simply asked for solutions for that problem.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    50. Re: 8 queens? by CustomSolvers2 · · Score: 1

      considering that the non-completion problem has a straightforward and known solution, and yet the completion version is the basis for this mathematical prize, I think you are underestimating the relevance of it.

      I think that, when having a clearly-defined, actually-analysable and punctually-criticisable problem/solution, you should better stick to the given conditions. Having some initial minor prejudices seems as a quite sensible behaviour in these situations ("they offer a lot", "these people seem to know what they are talking about", etc.), but this should be it. Expecting whatever final assessment to be based upon so abstract prejudices is very far from ideal; at least, among (even slightly) knowledgeable and keen-on-properly-understanding people. You don't need to guess, to blindly hope or to expect a more less arbitrary outcome when you have access to the given conditions, knowledge and willingness to adequately understand. Anyway, as already commented in my previous post, I think that this conversation has been extended for too long already. Bye.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    51. Re: 8 queens? by Paradise+Pete · · Score: 1

      Do you know what "proof" means? I'm giving up on you. It's their problem and their prize. They made the rules. You can't change them just because you want to.

    52. Re: 8 queens? by CustomSolvers2 · · Score: 1

      Do you know what "proof" means? I'm giving up on you. It's their problem and their prize. They made the rules. You can't change them just because you want to.

      Firstly, "proof" has many meanings and implications depending upon the context. Secondly, having something actually delivering it is the best possible proof of something which anyone could ever come up with (isn't it evident?). And thirdly, you are also misunderstanding the prize/rules/proposers: on one hand, you have the proposers of this specific X-queen problem which aren't offering any money and which only want a proof that said problem can be solved (= delivering an actual solution would be the best proof possible); on other hand, you have the prize for the NP-P problem which is $1 million and which is given to anyone proving the (in)equality NP-P. The only linkage between both situations has been done via an error of the aforementioned first party by thinking that the N-queen problem was definitory of the NP-P proof, but it really isn't.

      Is seriously so difficult to understand? These aren't too complex concepts. Could you make a tiny effort to just read/comprehend any of my multiple repetitions of basically the same ideas to get it? Anyway, this will be last answer to you because I cannot see the point of explaining (evident) ideas to those not able/willing to understand them.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
  7. the right tool by Anonymous Coward · · Score: 0

    too bad that with Prolog solving the queen problem using CLP(FD) (using gprolog for instance) 500 queens can be solved in less than a second...

    1. Re:the right tool by alexo · · Score: 2

      too bad that with Prolog solving the queen problem using CLP(FD) (using gprolog for instance) 500 queens can be solved in less than a second...

      The problem is that, as the the paper shows, the n-queen problem is NP-complete, which in layman's terms means that the best algorithm that we know of would take exponential time to solve it.

      To illustrate it, let's assume a hypothetical problem that has an (exponential) algorithm which takes 1 second to solve it with an input of 500 (queens or otherwise), and that the base of the exponent is 2 -- meaning that it would take 2 seconds to solve for an input of 501, 4 seconds for an input of 502, and so on.

      Continuing the series, an input of 506 would take over a minute to solve, 512 will take over an hour, 517 over a day, 521 over a month, 525 over a year... In a million years you will be able to solve the problem with an input of 544. Are you seeing the picture?

      Now the $1M prize is for either finding a polynomial complexity algorithm for solving that class of problems, or for a definite proof that one is not possible. Most mathematicians assume that the second outcome is correct, but no proof has been found, thus no $1M awarded.

      This of course does not take into account quantum computing, but that's a different question.

  8. Define "quick" by mark-t · · Score: 1

    Serious question... I've written something like that before, and although it wasn't speedy... I don't recall it being particularly long either.

    Also, does it have to come up with all solutions quickly, or just one?

    1. Re:Define "quick" by mark-t · · Score: 1

      Nm... answered my question. They want a P solution.... the algorithm I wrote I never tried for anything 1000x1000 before, so I don't know how it would do.

    2. Re:Define "quick" by As_I_Please · · Score: 2

      "Quick" is defined in terms of how the running time for the solver scales with the size of the board. If you plot the time it takes to place N queens on an NxN board, you get an exponential curve for all currently known solvers. Either of two possibilities will result in winning $1 million:

      1. Proving that this is the best one can do and that there are no better algorithms.
      2. Finding a queens-placing algorithm whose running time is bounded by a polynomial function on N.

    3. Re:Define "quick" by JoshuaZ · · Score: 1
      http://jair.org/papers/paper5512.html has the actual paper. What they have proven is that determining whether one can on an n-n chess board, given a starting set of queens in certain locations solve the n-queens problem on that board is NP-complete, and that counting the number of solutions is P#-complete (which is a little more technical and I don't want to get into). Here's the basic idea (if you want more, I recommend reading an intro complexity book like "The Nature of Computation" by Moore and Mertens):

      A a class of yes or no questions is in P if there is an algorithm which in time which is bounded by a polynomial of the length of the problem instance can answer the question. Easy examples of classes in P are "Is the number k have an even number of digits?", and "Does a divide b with remainder c?".

      A class of problems is in NP if when it is a set of yes or no questions where when the answer is yes, there is an algorithm to which one can supply a proof that can be checked to be valid in polynomial time. An example of a problem class in NP is "Is the number n composite?" since if the answer is yes, the proof given is to just give the divisor and someone can check that. Note that this problem turns out to actually be in P, but this is a deep result https://en.wikipedia.org/wiki/AKS_primality_test. Also, note that any problem class in P is trivially in NP because the proof one then uses is simply the empty string, and the algorithm is simply one's P-algorithm.

      It turns out that certain problem classes are NP-complete. A class of problems is NP-complete essentially if the problem class is in NP, and if one had a magic device which could solve the problem instantly then one could use it to solve all NP problems. It turns out that many, many problems are NP-complete, to the point where many computer science journals will no longer accept papers proving something is NP complete unless there's something noteworthy about it (such as proving it for a historically significant problem like in this case, or proving it for a problem that people have previously not succeeded at proving to be NP complete).

    4. Re:Define "quick" by michael_cain · · Score: 1

      Good of you to point out that the actual problem is something much harder than described in the OP. If the problem is just to find one solution to the n-queens problem, there are constructive algorithms for placing queens on the board that produce one solution (well, four with symmetry) in O(n) operations. Not just polynomial, but linear.

    5. Re:Define "quick" by mark-t · · Score: 1

      Perhaps you had failed to notice that I had said never mind in the above reply to my own post. I realized what they were talking about after I had already posted the first comment. Slashdot doesn't allow deletion of posts, so....

      Clearly I should have paid more attention before posting, but I would have figured that my previous comment would make it obvious that I was aware of that mistake.

      Anyways, telling me to shut up after I already admitted my bad is at best only making you look like you are too darn lazy to actually read posts that you bother to reply to.... or do you just have some sort of sort of inexplicable compulsion to rub people's mistakes in their faces even after they've already admitted them?

    6. Re:Define "quick" by mark-t · · Score: 1

      To be fair, the article doesn't actually say where to submit any "entries". In all likelihood, anybody who *did* find an efficient way of solving the problem (and for what it's worth, I believe that such a way exists... at least for finding *a* solution, not necessarily all possible ones) would probably be disqualified from receiving the prize on the technicality that they hadn't actually counted the total number of ways it can be solved, but simply generated a single correct solution.

  9. The story is mis-worded. You did it again editors. by Jack9 · · Score: 4, Informative

    > Dr Jefferson added: “There is a $1,000,000 prize for anyone who can prove whether or not the Queens Puzzle can be solved quickly so the rewards are high.”

    It's not the solution that gets you the prize, but the proof that the solution can be done quickly (without exploring nearly every permutation).

    --

    Often wrong but never in doubt.
    I am Jack9.
    Everyone knows me.
  10. Here's your algorithm by Jack9 · · Score: 1

    Start cursor in the upper left cell.
    Mark/Queen location

    --- Subroutine start
    Shift cursor right, down 2 (like a Knight!)
    Mark
    if out of bounds or final Y row
            break
    --- Subrouting end

    Shift cursor up, right 2
    Mark

    --- Subroutine start
    Shift cursor right, up 2
    Mark
    if out of bounds or initial Y row
            break
    --- Subrouting end

    Done. There is a simple solution, but the prize is about being able to prove there is a simple solution, without coming up with it (P = NP)

    --

    Often wrong but never in doubt.
    I am Jack9.
    Everyone knows me.
    1. Re:Here's your algorithm by CustomSolvers2 · · Score: 1

      Done. There is a simple solution, but the prize is about being able to prove there is a simple solution, without coming up with it (P = NP)

      Setting some sensible constraints to a problem makes sense; even expecting a specific solution out of different possibilities. But just thinking about a very specific approach while (poorly) enunciating a problem doesn't make other solutions invalid; the person enunciating the problem is the one being wrong.

      From the confusing summary and linked page, your approach (didn't test it, but looks fine; I mean something on these lines) is the solution. It is not the solution they expect because they made a mistake by proposing a so bad example. A problem on these lines should always be faced by relying on an approach like yours, an algorithm exclusively focusing on queens (+ finding the patterns allowing the intended reasonably straightforward distribution to happen).

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    2. Re:Here's your algorithm by Sique · · Score: 1

      You can claim your prize as soon as your algorithm put onto a standard computer came up with a solution to the "n queens on an n x n board" with n=1000.

      --
      .sig: Sique *sigh*
    3. Re:Here's your algorithm by CustomSolvers2 · · Score: 1

      You can claim your prize as soon as your algorithm put onto a standard computer came up with a solution to the "n queens on an n x n board" with n=1000.

      No. I can bet you 1 million (I don't having this amount with me, but I might be getting it soon. LOL) right now that the parent poster will not get anything. This was some kind of promotion of their paper by bringing into picture that other prize for proving N/NP problem (their site links to the prize's site). But they seemed to have made their message too commercial and too unclear until the point of seeming to be proposing a different thing.

      On the other hand, that algorithm (or another one on these lines) will certainly deliver what is expected for any number of n. I was about to write something like that when I saw the parent post. At least my approach would be to replicate the solved 8-queen setup which, as you can see in the picture, is quite regular; and, as proposed by the parent poster, lets all the queens at knight-movement distances. This is the only kind of approach which will ever come to my mind (but I am a quite experienced programmer with lots of experience in coming up with efficient algorithms, so perhaps other people might not think like me) when trying to solve this problem. You only want to locate certain elements (queens), why to consider others (remaining pieces)? You know that there is a solved subset (8 queens), why not taking it as starting point? Are the movements/dimensions changing regularly? Yes. Solution: look for the surely-existing pattern, implement it and job done.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    4. Re:Here's your algorithm by Sique · · Score: 1
      I don't think you got the joke.

      I know what his algorithm does. And for n=1000, it will take more time than a billion universes put together. Thus he will get nothing -- at least not in this Universe.

      --
      .sig: Sique *sigh*
    5. Re:Here's your algorithm by CustomSolvers2 · · Score: 1

      I don't think you got the joke.

      I am afraid that the only not getting it is you. Read my previous comment again, mainly the second paragraph. I recommend you to do it slower this time.

      I know what his algorithm does. And for n=1000, it will take more time than a billion universes put together.

      The second sentence seems to indicate that the first sentence is wrong and you didn't understand my previous comment (read it again, please). Here comes more help just in case: you want to find out the right locations for the queens right? Now visit the Wikipedia article which I am linking in my previous comment and look at the picture on the RHS, this is how the queens have to be located in an 8x8. Tell me, how long it would take you to come to that conclusion? I will answer it for you: a negligible amount of time because you don't need to find all the possible moves of the queens, but plainly replicating the shown structure; or, as suggested by the parent post, start from certain cell and locate one queen, then move like a knight and locate another one and so on.

      Do you get the idea now? You don't need to perform lots of calculations, you don't need to account for all the possible combinations of moves, all what you need is to create a pretty simple algorithm locating objects in certain places for an increasingly growing board by following a pretty simple pattern. Clear now? Do you think that our universe will be here during the next few seconds required for any computer to perform all these actions for virtually any size of n?

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    6. Re:Here's your algorithm by Jack9 · · Score: 1

      It takes under a second to run this (given a fair bit of memory, since scripting languages are greedy):

      $start = microtime();

      $n = 1000;
      $emptyVal = 0;
      $queenVal = 1;
      $n_by_n_array = array_fill(0, $n, array_fill(0, $n, $emptyVal));
      $xptr = 0;
      $yptr = 0;

      $queensPlaced = 0;

      while(true)
      {
              $n_by_n_array[$yptr][$xptr] = $queenVal;
              $queensPlaced++;

              $xptr += 1;
              $yptr += 2;
              if ($yptr >= $n)
              {
                      break;
              }
      }

      $yptr -= 1;
      $xptr += 2;

      while(true)
      {
              $n_by_n_array[$yptr][$xptr] = $queenVal;
              $queensPlaced++;

              $xptr += 1;
              $yptr -= 2;
              if ($yptr 0)
              {
                      break;
              }
      }

      echo "Placed:".$queensPlaced."\n";
      $end = microtime();
      echo "Execution Time (seconds):".$end-$start."\n";

      --

      Often wrong but never in doubt.
      I am Jack9.
      Everyone knows me.
    7. Re:Here's your algorithm by clovis · · Score: 1

      I gotta say this is interesting, but maybe not workable.
      Is there a simple algorithm for locating the solved 8x8 into a 10x10 and then placing the remaining 2 queens into the open squares?
      We can't know ahead of time what the new location of the solved puzzle will be in the larger puzzle.
      We'll have to try all the possible new locations. I doubt it can be guaranteed that if a solution for n exists, then there will be guaranteed a solution for n+1 in which that n solution can be embedded, and that is a requirement for using the extending an existing solution method.
      It's possible that for the queens problem that any n solution can be embedded in a solved n+1,
      but I know that's not true for some other of these P != NP problems.

      And we have to consider that there are many unique solutions for 8x8, so which one of these do we choose for placing in the 10x10? If the algorithm has to try them all, we're getting back into NP solution time. At best all we can do is solve the exponential time problem quicker, but it won't become solved in P time because we are basically using the same algorithm as the original problem (That is, try a solution and test to see if it works)

      For example, placing the solved 8x8 (first one shown in the wiki article) into a 10x10's corner cannot be solved (as will most other locations), so your placing algorithm to find the location that will work will essentially be the same as the placing of 8 queens in the original problem. (That is, try a solution and test to see if it works)

      Also, such an algorithm (using a solved puzzle to be extended into a larger n) results in our having to solve all the puzzles from n=8 to n=999 to find n=1000 solution. That's will only change the NP problem into P if the algorithm to extend the solution is P time, but I'm not seeing that in this case.

      Besides, as you observed before, the prize is not for the Queens problem anyway.

    8. Re:Here's your algorithm by CustomSolvers2 · · Score: 1

      I gotta say this is interesting, but maybe not workable.

      Even before testing it and by being completely aware that such a proceeding is certainly not recommendable, I am quite sure that it is perfectly (and relatively simply) doable.

      Is there a simple algorithm for locating the solved 8x8 into a 10x10 and then placing the remaining 2 queens into the open squares?

      This isn't exactly what I meant. My approach was to use the solved sample to understand how to proceed, to find out the trend (by including how it varies with bigger/smaller board sizes) and to implement it. What the parent poster is proposing (i.e., starting in a given position and moving like the knight would do) seems as a descriptive enough way to show what I mean. Finding the pattern doesn't mean to exactly replicate the given conditions regardless of anything else, but to find out how are the pieces located with respect to each other/the board and how these positions change with increasing/decreasing sizes. The increases/decreases of board/number of queens are regular so just focusing on the simpler scenarios (e.g., 7*7 and 9*9) should be more than enough to come up with a reasonably good approach. But even in case that I was wrong (very unlikely to happen, even though I haven't done any test; but I have lots of experience on this front and I honestly don't see a problem here) and that the eventual algorithm was much more complicated; even in the worst scenario possible, this problem should always be faced by avoiding the tremendous over-complication of accounting for all the possible movements (even after coming up with a way to reduce them). This problem is about finding final positions and you should create an algorithm delivering those; creating an algorithm properly understanding complex + time-consuming behaviours when you could easily do it manually (for simple scenarios + find pattern) is a clearly bad approach. Even worse, these guys seem to be relying on standard chess approaches which are unnecessarily expensive under the current conditions.

      And we have to consider that there are many unique solutions for 8x8

      No we haven't. This is one of the ways to face this problem wrongly: thinking in it as it would chess, which is a way much more complex reality than what we really have here. All what you need is a single way for it to work; and you need to focus on the most scalable (pattern-find-friendly) version. At first sight, that picture/parent proposal seemed to me as a really good one, but it might not be proven good enough and you might have to analyse a different one. You might even consider different approaches for different sizes.

      I gotta say this is interesting, but maybe not workable.

      Even before testing it and by being completely aware that such a proceeding is certainly not recommendable, I am quite sure that it is perfectly (and relatively simply) doable.

      Is there a simple algorithm for locating the solved 8x8 into a 10x10 and then placing the remaining 2 queens into the open squares?

      This isn't exactly what I meant. My approach was to use the solved sample to understand how to proceed, to find out the trend (by including how it varies with bigger/smaller board sizes) and to implement it. What the parent poster is proposing (i.e., starting in a given position and moving like the knight would do) seems as a descriptive enough way to show what I mean. Finding the pattern doesn't mean to exactly replicate the given conditions regardless of anything else, but to find out how are the pieces located with respect to each other/the board and how these positions change with increasing/decreasing sizes. The increases/decreases of board/number of queens are regular so just focusing on the simpler scenarios (e.g., 7*7 and 9*9) should be more than enough to come up with a reasonably good approach. But even in case that I was wrong (very unlikely to happen, ev

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    9. Re:Here's your algorithm by CustomSolvers2 · · Score: 1

      Ah! Come on! This has been my worse wrong-posting here since ever. Please, read only up to the first "You might even consider different approaches for different sizes.", otherwise you might get yourself into an endless loop. LOL

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    10. Re:Here's your algorithm by CustomSolvers2 · · Score: 1
      (I am reposting by removing the unnecessary repetitions, a direct consequence of my Sunday-morning reliability :))

      I gotta say this is interesting, but maybe not workable.

      Even before testing it and by being completely aware that such a proceeding is certainly not recommendable, I am quite sure that it is perfectly (and relatively simply) doable.

      Is there a simple algorithm for locating the solved 8x8 into a 10x10 and then placing the remaining 2 queens into the open squares?

      This isn't exactly what I meant. My approach was to use the solved sample to understand how to proceed, to find out the trend (by including how it varies with bigger/smaller board sizes) and to implement it. What the parent poster is proposing (i.e., starting in a given position and moving like the knight would do) seems as a descriptive enough way to show what I mean. Finding the pattern doesn't mean to exactly replicate the given conditions regardless of anything else, but to find out how are the pieces located with respect to each other/the board and how these positions change with increasing/decreasing sizes. The increases/decreases of board/number of queens are regular so just focusing on the simpler scenarios (e.g., 7*7 and 9*9) should be more than enough to come up with a reasonably good approach.

      But even in case that I was wrong (very unlikely to happen, even though I haven't done any test; but I have lots of experience on this front and I honestly don't see a problem here) and that the eventual algorithm was much more complicated; even in the worst scenario possible, this problem should always be faced by avoiding the tremendous over-complication of accounting for all the possible movements (even after coming up with a way to reduce them). This problem is about finding final positions and you should create an algorithm delivering those; creating an algorithm properly understanding complex + time-consuming behaviours when you could easily do it manually (for simple scenarios + find pattern) is a clearly bad approach. Even worse, these guys seem to be relying on standard chess approaches which are unnecessarily expensive under the current conditions.

      And we have to consider that there are many unique solutions for 8x8

      No we haven't. This is one of the ways to face this problem wrongly: thinking in it as it would chess, which is a way much more complex reality than what we really have here. All what you need is a single way for it to work; and you need to focus on the most scalable (pattern-find-friendly) version. At first sight, that picture/parent proposal seemed to me as a really good one, but it might not be proven good enough and you might have to analyse a different one. You might even consider different approaches for different sizes.

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    11. Re:Here's your algorithm by CustomSolvers2 · · Score: 1

      I am not sure that you can blindly apply what works for 8x8 to any size without doing anything else, but the eventual modifications are likely to be quite irrelevant. As written above, you should be able to come with a reasonably reliable approach just by analysing the simpler scenarios (7x7 and 9x9) and see how lower/higher sizes affect the original pattern. Also properly validating this approach, even just for a few simpler scenarios isn't completely straightforward (at least, not as straightforward as writing my thoughts here :)). Anyway, your overall approach and this PHP algorithm look certainly nice; mainly after having read how difficult seem for some people to understand what I thought that was pretty evident (= first idea coming to my mind after seeing the problem).

      --
      Custom Solvers 2.0 = Alvaro Carballo Garcia = varocarbas.
    12. Re:Here's your algorithm by Whibla · · Score: 1

      I share CustomSolvers2's reserve in your apparent assumption that a technique that works specifically(?) on an 8*8 board would work for larger boards. A simple, and obvious test would be to try it with a 9*9 grid, and eyeball the result - though you'd have to implement some way to view the proposed solution for that board size. I don't even know, does the particular algorithm you're using work for all the smaller board sizes as well? FWIW, I'm a bit ashamed to admit I do not currently understand your code, nor, fully, the algorithm.

      I note that you said the 'program' took about 1 second to run for a grid size of 1,000. While I think I could figure out roughly the running time for a grid of 1,000,000 perhaps you could 'weigh in'?

      Thanks

    13. Re:Here's your algorithm by Jack9 · · Score: 1

      My solution does not satisfy as a solution for n queens in an n x n board for many different values. Notably, there is no solution for n=4, n=3, n=2.

      The problem is deceptively easy for n/2+1 placements. Once past that, it takes an increasingly (maybe infinitely) complex perturbation to get a stable algorithm as size increases. See 8x8 below, where 8/2+1 placements are algorithmically simple.

      1 0 0 0 0 0 0 0
      0 0 0 0 1 0 0 0 -- 1, ceil(n/2) always a valid placement starting from 0 index
      0 1 0 0 0 0 0 0
      0 0 0 0 0 0 0 0
      0 0 1 0 0 0 0 0
      0 0 0 0 0 0 0 0
      0 0 0 1 0 0 0 0
      0 0 0 0 0 1 0 0

      Finish out with a sort of bounce-redirection of the "knight moves" every time you hit a boundary:
      1 0 0 0 0 0 0 0
      0 0 0 0 1 0 0 0
      0 1 0 0 0 0 0 0
      0 0 0 0 0 0 0 1
      0 0 1 0 0 0 0 0
      0 0 0 0 0 0 1 0
      0 0 0 1 0 0 0 0
      0 0 0 0 0 1 0 0
      8 Queens. Simple enough except deciding when to "bounce" is one problem, and what direction change is another (-2y +1x or -1y +2x).

      The gymnastics (logical rules necessary to fit queens properly) continue to grow, the larger the grid gets. As illustrated, the problem is verification more than coming up with general solutions (that are only approximations that fit a set of sizes in practice).

      If you were able to come up with a relatively simple general solution, it's not very hard for a computer to calculate 1mil x 1mil grid (https://www.quora.com/How-many-operations-per-second-can-a-computer-do-How-is-it-related-to-GHz). If you can parallelize this problem (which will do so nicely), the processing time of that experiment won't be noticeable. Proving that it's properly parallelized is another NP problem.

      --

      Often wrong but never in doubt.
      I am Jack9.
      Everyone knows me.
    14. Re:Here's your algorithm by Whibla · · Score: 1

      Thanks.

      If you were able to come up with a relatively simple general solution, it's not very hard for a computer to calculate 1mil x 1mil grid (https://www.quora.com/How-many-operations-per-second-can-a-computer-do-How-is-it-related-to-GHz). If you can parallelize this problem (which will do so nicely), the processing time of that experiment won't be noticeable. Proving that it's properly parallelized is another NP problem.

      And I tend to agree.

  11. Where is my Beowulf cluster joke by MerlynEmrys67 · · Score: 1

    Ok, So give me a cluster of 30K machines, each machine having access to a few k of computer cores (think 4 GPUs) that gives me access to about 100M compute cores to solve this problem. I imagine this is a rather ridiculously easy problem to throw cores at - so with 100M cores in a compute cluster I imagine this problem simplifies into a few months worth of cluster time...

    --
    I have mod points and I am not afraid to use them
    1. Re:Where is my Beowulf cluster joke by Jason1729 · · Score: 1

      You imagine wrong. Which is the entire point.

    2. Re:Where is my Beowulf cluster joke by lucm · · Score: 0

      with 100M cores in a compute cluster I imagine this problem simplifies into a few months worth of cluster time...

      It depends. Do the nodes in the cluster run systemd?

      --
      lucm, indeed.
  12. I solved that by Anonymous Coward · · Score: 0

    But this comment field is too small for me to post it.

  13. P=NP is easy to do in Python by lucm · · Score: 1, Offtopic

    I don't understand the fuss, I found not only one but TWO ways to figure out P=NP using Python. Doesn't even require numpy or a GPU and it works even with super big numbers.

    #Solution 1:

    for N in range(sys.maxsize):
            P = 0
            if P == N * P:
                    print("it works.")

    #Solution 2:

    for P in range(sys.maxsize):
            N = 1
            if P == N * P:
                    print("it works.")

    Python is so powerful.

    --
    lucm, indeed.
  14. When will slashdot hit rock bottom? by Jason1729 · · Score: 1

    And slashdot gets stupider yet.

    So, prove P=NP, win $1 million. Makes sense, why is this nonsense even here?

  15. Re:The story is mis-worded. You did it again edito by fourfaces · · Score: 0

    Such a proof would not necessarily be worth a million dollars. It could be applicable only to the Queens Puzzle and to nothing else.

  16. Re:The story is mis-worded. You did it again edito by TimothyHollins · · Score: 2

    Yes it would. The Queen's Puzzle is an NP-complete problem, hence a solution to it would solve every other NP-complete problem.

  17. Java by Anonymous Coward · · Score: 0

    I read the paper.

    They wrote their solver in Java.. You can't trust anything they say, especially about performance.

    1. Re:Java by abies · · Score: 1

      Complexity of base solution is O(n!). If you think that going possibly 2-3 faster with your favorite toy language compared to java is going to change much for n=1000, you are seriously confused.

  18. Visualizer of different algos by gbell · · Score: 3, Interesting

    Really cool in-browser visualizer of 5 different algorithms for solving this problem...

    http://haseebq.com/n-queens-visualizer/

  19. The summary and article are crap by alexo · · Score: 1

    Both the summary and the article are crap.

    The important part is the following line from the abstract:

    We show that n-Queens Completion is both NP-Complete and #P-Complete.

    All the rest (other than the math in the actual paper) is fluff.

  20. Obviously, by rholtzjr · · Score: 1

    the answer is 42.

  21. Re:The story is mis-worded. You did it again edito by Anonymous Coward · · Score: 0

    Citation needed.

  22. feels like by bugs2squash · · Score: 1

    it feels like it should be possible to set up a physical analog of the problem and let it find its own stable point. Isn't this what quantum computing is meant to solve ? Or is that cheating by trying every possible solution just very quickly ? There, I've just demonstrated my ignorance (again).

    --
    Nullius in verba
  23. Re: The story is mis-worded. You did it again edit by Anonymous Coward · · Score: 0

    Because AA batteries solve all portable energy problems.

  24. Re:The story is mis-worded. You did it again edito by Anonymous Coward · · Score: 0

    It's almost certainly not NP-complete. The problem is trivially in P/poly. Proving it NP-complete would prove P/poly contains NP, which is nearly as big of a breakthrough as showing P = NP.

  25. Re: The story is mis-worded. You did it again edit by z3alot · · Score: 1

    https://en.m.wikipedia.org/wik...â"Levin_theorem Cook showed that any decision problem with easily checkable solution could be mechanically and quickly converted into a Boolean satisfiability problem of similar size. Thus, SAT became the first known example of a so called NP-complete problem. Other examples are then much more easily found by giving a procedure to convert SAT problems into that kind of problem. Such a procedure was apparently given for some variation of the queen problem. So in fact yes, an algorithm fast for specifically queens can be composed with the (already known) fast transformation from SAT and ultimately through Cooks construction for any particular NP problem (where he is able to be completely general by taking as input the Turing machine for the solution checker)

    If you think it's unbelievable, that's completely natural. No one would suspect the existance of NP complete problems from the start.