Re: [eclipse-clp-users] Routing algorithm, XML

From: Marco Gavanelli <marco.gavanelli_at_unife.it>
Date: Fri, 15 Apr 2011 10:10:43 +0200
On 14/04/11 22:24, A. Alaily wrote:
> Hi, I'm fairly new to ECLiPSe and I have to design a algorithm that uses a grid, exported as an XML file, for routing.
>
> Could you please inform me where to start looking? What would be good resources to check out?
>
> I have found good sources for general ECLiPSe knowledge, but I have not found anything as specific to what I will be doing.

Hi,

Concerning the XML, there is an XML library:

http://eclipseclp.org/doc/bips/lib_public/xml/

I've never used it, but you might have a look.

For the routing part, I am sending you as attachment a very simple 
implementation of the Travelling Salesman Problem, just to have and 
idea. It is not very efficient, but it is simple.

Usage:

% Generate a random graph of 5 nodes
[eclipse 2]: gen(5).

Yes (0.00s cpu)

% search for a TSP starting from node 0 and involving the nodes in the
% given list

[eclipse 3]: solve_tsp([1,2,3,4,5],C).
lists.eco  loaded in 0.01 seconds
Found a solution with cost 21
Found a solution with cost 18
Found a solution with cost 15
Found no solution with cost 8.0 .. 14.0

C = 15
Yes (0.04s cpu)

Cheers,
Marco

-- 
Marco Gavanelli, Ph.D. in Computer Science
Dept of Engineering
University of Ferrara
Tel/Fax  +39-0532-97-4833
http://www.ing.unife.it/docenti/MarcoGavanelli/



Received on Fri Apr 15 2011 - 08:32:14 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET