Re: [eclipse-clp-users] Contributions to ECLiPSe

From: Kish Shen <kisshen_at_...5...>
Date: Mon, 28 Apr 2008 16:48:29 +0100
Hi Tallys,


Tallys Yunes wrote:
> 
> I have another (unrelated) question: I'm interfacing with Eclipse
> through C++ and I need to break down Eclipse terms into C++ values.
> Specifically, I wrote a predicate in Eclipse that takes a variable and
> creates a list version of its domain. So in C++ I call this predicate with
> post_goal, grab the list, and tear it apart. This list could be something
> like: [1..5, 10..20] or [1.5..6.3], etc. (I'm solving problems that mix
> integer and real variables).
> 

I would suggest that you try to do as much as possible on the ECLiPSe 
side, i.e. do the conversion from interval to numbers there, rather than 
trying to interpret the structures in C++.

> However, when the list comes back as [12.0__12.0] I don't know how to
> grab the two 12.0's from it, because I cannot use any of the "is_?" calls
> (is_long, is_double, etc.). How can I do this?
>

Bounded reals does not have an equivalent datatype in C++, so it is 
difficult to convert it to anything. Since it is an actual number rather 
than a variable with an interval, it is probably not the best idea to 
return the two bounds. One way to deal with it is to convert it to a 
(normal) real value (on the ECLiPSe side, using float/2), and return 
this. This should normally not be a problem, because the two bounds are 
the same or only differ a little.

 > Well, to help answer my own question, I can test whether the variable  is
 > real (get_solver_type) and change my eclipse predicate to pick the 
two > 12.0's (with get_bounds) and return the list as 12.0..12.0 instead 
of > 12.0__12.0.

You can test for bound reals directly using breal/1, and you can get the
bounds on a bounded real with breal_bounds/3.

 >Sorry. Should have spent more time thinking before bothering the
 >list users with a simple question.

You may want to send any further e-mails to me only, without sending it 
to the rest of the list, unless you think it is of general interest....

Cheers,

Kish


> Thanks a lot!
> Tallys
> 
> 
> On Mon, Apr 28, 2008 at 10:37 AM, Kish Shen <kisshen_at_...5...> wrote:
>> Hi,
>>
>>  Tallys Yunes' message asking about an implementation of nvalues
>>  constraint for ECLiPSe  reminds me:
>>
>>  We welcome and encourage contributions to ECLiPSe -- this is one of the
>>  reasons why ECLiPSe was open-sourced.   You can contact me or Joachim
>>  Schimpf about any contributions you want to make, and it could then be
>>  distributed with ECLiPSe.
>>
>>  Specific to Tallys' message, ECLiPSe currently does not have that many
>>  global constraints, and we would welcome any contributions here!
>>
>>  Cheers,
>>
>>  Kish
>>
>>
>>  Tallys Yunes wrote:
>>  > Hi,
>>  >
>>  > I have an application in which I'd like to use the nvalues
>>  > constraint, but it appears that this constraint is not
>>  > directly available in Eclipse (maybe version 6.0 will
>>  > include new global constraints?)
>>  >
>>  > So I was wondering if anyone out there has implemented
>>  > this constraint "by hand" and wouldn't mind sharing the
>>  > code :-) If not, then I guess I'll have to do it ...
>>  >
>>  > Thanks,
>>  > Tallys
>>  >
>>  > -------------------------------------------------------------------------
>>  > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>>  > Don't miss this year's exciting event. There's still time to save $100.
>>  > Use priority code J8TL2D2.
>>  > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>>  > _______________________________________________
>>  > ECLiPSe-CLP-Users mailing list
>>  > ECLiPSe-CLP-Users_at_lists.sourceforge.net
>>  > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
>>  >
>>
>>
>>  -------------------------------------------------------------------------
>>  This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>>  Don't miss this year's exciting event. There's still time to save $100.
>>  Use priority code J8TL2D2.
>>  http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>>  _______________________________________________
>>  ECLiPSe-CLP-Users mailing list
>>  ECLiPSe-CLP-Users_at_lists.sourceforge.net
>>  https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
>>
Received on Mon Apr 28 2008 - 08:48:52 CEST

This archive was generated by hypermail 2.3.0 : Thu Feb 22 2024 - 18:13:19 CET