caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Diego Olivier Fernandez Pons <Diego.FERNANDEZ_PONS@etu.upmc.fr>
To: Alain Frisch <Alain.Frisch@inria.fr>
Cc: Jon Harrop <jon@ffconsultancy.com>, <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Sudoku solver
Date: Tue, 15 Nov 2005 10:23:08 +0100 (NFT)	[thread overview]
Message-ID: <Pine.A41.4.44.0511151014250.1597664-100000@ibm1> (raw)
In-Reply-To: <4379A294.1050007@inria.fr>

    Bonjour,

> The -brute version is a simple-minded brute force search. There other
> one tries to use the constraint "each digit must appear in each bloc"
> (where a bloc is a line, a column, or a 3x3 sub-bloc) to place digits.
> It also chooses a cell with a minimal number of remaining choices when
> branching. Interestingly, disabling these optimizations does not seem to
> change the performance significantly.

The constraint "a single digit by block" is named "all different"  in
combinatorial optimization literature. The problem is that your
implementation is too naive : the "optimal" version (in the sense it can
ensure you always make a choice that has at least one solution for the
'alldiff' constraint) needs a matching algorithm and some graph theory.

There is a nice paper by Helmut Simonis "Sudoku as a constraint problem"
with reference to the relevant paper for the algorithms.

    http://www.icparc.ic.ac.uk/~hs/

You could also try to write a solver with FaCiLe (which actually contains
the optimal algorithm for "alldiff" constraints)


        Diego Olivier


  reply	other threads:[~2005-11-15  9:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-15  4:27 Jon Harrop
2005-11-15  8:55 ` [Caml-list] " Alain Frisch
2005-11-15  9:23   ` Diego Olivier Fernandez Pons [this message]
2005-11-15 12:56     ` Pascal Brisset
2005-11-15 13:22       ` Diego Olivier Fernandez Pons
2005-11-15 13:32         ` Pascal Brisset
2005-11-15 14:41       ` Christophe Raffalli
2005-11-15 19:05         ` Diego Olivier Fernandez Pons
2005-11-15 19:37         ` David Thomas
2005-11-16  6:07   ` Jon Harrop
2005-11-16  7:25     ` Alain Frisch
2005-11-15 20:56 ` Karl Zilles
2005-11-16  8:00   ` Oliver Bandel
2005-11-16  8:15     ` Alain Frisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.A41.4.44.0511151014250.1597664-100000@ibm1 \
    --to=diego.fernandez_pons@etu.upmc.fr \
    --cc=Alain.Frisch@inria.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=jon@ffconsultancy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).