Re: [eclipse-clp-users] Java interfaces and constraints

From: Kish Shen <kisshen_at_...5...>
Date: Sun, 13 Sep 2009 07:48:06 +0100
Hi Simone,

simone pascucci wrote:
> Hi,
> I have some experience on logic programming but restricted to answer
> set semantics and p-stable semantics. I recently downloaded eclipse
> because I need to deal with a problem which involves arithmetic
> computation and the use of constraints. After reading the tutorial, I
> started to study the embedding manual (java interface) but many
> questions remain unsoluted:
> 1)  Is it possible to use constraint libraries when using java interfaces?


> 2) I'm trying to code the sendmore=money problem in java but one of
> the errors I get is related to the use of escape characters in the
> arithmetic constraint definition.

The Java interface is not intended to allow you to write ECLiPSe 
programs in Java. Rather, it is designed to allow you to communicate 
between Java and ECLiPSe, and to use each language to do what it is 
designed to do. For your example, the interface is not designed to allow 
you to write the send+more= money in Java.

An example of what you might do is in Java, you allow the user to 
construct send + more = money type puzzles, e.g. what variables should 
appear in the sum. and this information is then sent to ECLiPSe, where 
you have an ECLiPSe program that construct the puzzle and solves it,
and returning the solution to Java, which can then display the solution.

To summerise: the Java interface was not designed to make ECLiPSe a Java 
library so that you can write constraint programs in Java. If this is 
what you want to do, there are several constraint libraries for Java 
that you can use.

> 3) Assuming that it is possible to use constraint libraries, this
> automatically prevent me to pass a parameter object which implements
> the compoundTerm interfaces due to variables representation.
> Everything seems to suggest that I can't use the java interfaces for
> my goal. Can anyone post an example of java class which makes use of
> the constraint libraries?

The EXDR representation of ECLiPSe term was deliberately designed to 
support only a subset of ECLiPSe terms, so you can't construct complex 
constraints expressions where variables occur multiple times in the 
expression. EXDR is disigned for you to passed ground information (in 
the puzzle construction example, a ground representation of the 
variables in the puzzle and their positions), and variable are used for 
returning information (if you are making an RPC) -- e.g. the solution in 
the puzzle construction example.

If you are interested for a higher level view of the interface (i.e. how 
it is intended to be used, and the motivation for our design decisions), 
there is a paper that describe this:

A High-Level Generic Interface to External Programming Languages for ECLiPSe

and it is available at:



This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Sun Sep 13 2009 - 06:48:22 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 26 2019 - 09:14:36 CEST