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: caml-list@inria.fr
Subject: Re: [Caml-list] Persistence
Date: Tue, 22 Feb 2005 10:06:31 +0100 (NFT)	[thread overview]
Message-ID: <Pine.A41.4.44.0502220943520.1089778-100000@ibm1> (raw)
In-Reply-To: <200502212324.11937.jon@jdh30.plus.com>

    Bonjour,

> > Could you send around the source code to this?  I intuitively knew
> > that such performance results were likely, but had never had such
> > a convincing example to wave at people.
>
> Yes. The implementation of traveling salesman given in my book is
> another example which is several orders of magnitude faster than the
> C/C++/Fortran implementations given in all of the other text books
> that I have read.

Branch-and-bound algorithms (pure integer, not LP based) are good
candidates for important speed-ups due to data persistence : when you
backtrack it is most of the time much faster to restart from a
memorized data structure than to reconstruct it, specially with
structured data like ordered sets, graphs, etc.

Generally speaking, the _good_ paradigm to program B&B solvers for
NP-hard problems is mixed functional/imperative programming (in other
words ML), because you benefit from fast recursion, data persistence,
garbage collection while you use very few floating point computations.

Actually, most of the commercial C/C++ libraries for constraint
programming (= integer branch and bound) include a 'functional layer'
that contains one or several garbage collectors, persistent data
structures, a system to make persistent user-defined data structures,
function objects, etc.

Winning against a mixed imperative/functional implementation in e.g.
C/C++ require a lot of low-level implementation work - and you will
end anyway implementing some kind of 'functional core'. Worse,
algorithmic wins (better algorithms) are most of the time several
order of magnitude superior than implementation wins (better
implementation).

Therefore it is also more convenient to use a high level language like
Caml in order to focalize on algorithms rather than implementation.


        Diego Olivier


  reply	other threads:[~2005-02-22  9:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-21 20:17 Don Syme
2005-02-21 23:24 ` Jon Harrop
2005-02-22  9:06   ` Diego Olivier Fernandez Pons [this message]
2005-02-22 11:59     ` Thomas Fischbacher

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.0502220943520.1089778-100000@ibm1 \
    --to=diego.fernandez_pons@etu.upmc.fr \
    --cc=caml-list@inria.fr \
    /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).