Re: GNUProlog vs. ECLiPSe

From: Andrew Cheadle <amc4_at_icparc.ic.ac.uk>
Date: Thu 13 Jan 2005 09:53:37 PM GMT
Message-ID: <20050113215337.GA8601@elstree.icparc.ic.ac.uk>
Hi Katharina

> can anyone halp me to transform than GNUProlog-program into one working
> with ECLiPSe (with the apropriate query)?

Sure. At the top of your file place the directive:

:- lib(ic).

to load the IC library (please see documentation for further details
on IC).

Then change the equality constraint of GNUProlog,
'#=#', to that of IC's, '#=', i.e. search and replace '#=#' for '#='.

Finally, remove the initialisation directive ':- initialization(t)'
from the bottom of your file.

In GNUProlog you executed the query 't' by consulting the file:
consult('gnuplbsp.pl'). The initialisation directive then ran the query.

In ECLiPSe simply compile the file and execute the query 't':

[eclipse 1]: ['gnuplbsp.pl'].

Yes (0.33s cpu)
[eclipse 2]: t.

Notice all you've done is setup constraints and ECLiPSe tells you have
delayed goals. The bounds on the variables are looser in ECLiPSe since
GNUProlog has maximum and minimum defined domain bounds which can be
thought of as implicitly narrowing the variable bounds. In IC we have
representations to 'infinity and beyond'. If you wish to achieve the same
then add domain bounds to your variables using IC's '::' operator.

So now you have an equivalent ECLiPSe program.

> In GNUProlog, I get possibilities for the value of the variables by
> simply running the file I attached. Than I can modify the file with one
> of the resulting values until all variables have a value.

How do you achieve this in GNUProlog, it's most likely very similar.

> I must write a java-program that generates the input to ECLiPSe, get the
> output (the possible values for the variables) and use that values to
> generate a new input and so on , until I've a value for every variable.

Please have a look at ECLiPSe's 'Embedding and Interfacing Manual'.

Hope that helps.

Cheers

Andy
Received on Fri Jan 14 10:24:54 2005

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:33 PM GMT GMT