Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Edit: oops missed the last paragraph of OP's question, let me rephrase.</p> <p>To digress briefly, the question you linked to had quite a hilarious discussion about the "level" of randomness for the selected solution, allow me to paraphrase:</p> <blockquote> <p>"...I really require matrices that are as random as possible..."</p> <p>"...The algorithm, as implemented in the code, is quite random..."</p> <p>"...if you choose this method, a different way to improve the randomness is to repeat the randomization process several times (a random number of times)..."</p> </blockquote> <p>None of these comments make any sort of sense, there is no such thing as "more" random, this is all exactly like this lovely <a href="http://thedailywtf.com/Articles/Random-Stupidity.aspx" rel="nofollow">Daily WTF entry</a>. That said, the last quote is almost onto something. It's well known that if you simulate a Markov chain, like that random swapping algorithm, for long enough you will eventually start generating samples from the <a href="http://en.wikipedia.org/wiki/Markov_chain#Steady-state_analysis_and_limiting_distributions" rel="nofollow">steady state distribution</a>. Just exactly what that distribution looks like, who knows... </p> <p>Anyway, depending on your objectives you may not really care what this distribution looks like as long as it contains enough elements. So some sort of swapping algorithm might be useful, but I really would not expect this to be easy since the problem is NP-Complete (more general than Sudoku). </p> <p>With that in mind, you could consider solving your problem any approach that works for <a href="http://en.wikipedia.org/wiki/Sudoku_algorithms" rel="nofollow">solving Sudoku</a>, if you are in Acadamia I would suggest getting a copy of IBM CPLEX 12 which is free for academic use. You can code up a Sudoku-like solver in their CP language (OPL) and as the integer linear program solver to generate solutions for you. I think they even have example code for solving Sudoku you can borrow from. </p> <p>Here's the only truly random and unbiased way I can think of to sample from such matrices: First get CPLEX to find <strong>all</strong> N solutions to the given Sudoku problem. After you have this set of N solutions, draw a random number between 1 and N and use that solution, if you want another one, draw another number. Since generating all solutions might be a bit slow, you could approximate something like this by telling the solver to stop after a certain number of solutions or time elapsed and only sample from that set.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload