Re: [eclipse-clp-users] Q: Linear Programming with Disjunction constraints

From: Kish Shen <kisshen_at_cisco.com>
Date: Fri, 25 Apr 2008 00:26:47 +0100
Kim Lai wrote:
> hi, your reply is a great help for me. thanks.
> I use lib(eplex) to reformulate my problem as follow. and it really got 
> a solution.
> But after I port the following code to C++. I'm getting trouble with 
> ""How to extract the variables result"".
> A result like this 
> "A2{0.0 .. 1.7976931348623157e+308 @ 1.1999999992549422}"
> I'd like to extract A2=1.199 = 1.2
> But it's not even a string...
> in C++: I usually use "EC_word(Vars[i]).is_double(&d) == EC_succeed"
> to get a double or long int .....And this didn't work..
> ------------eclipse code------------------------

Your specific problem is that when a problem is solved by eplex, the 
problem variables are not instantiated. This allows you to modify the 
problem and resolve it. eplex_var_get/3 allows you to extract the 
solution value from the variable, e.g. for the variable A2 above,

....
eplex_var_get(A2, solution, A2Sol),


will instantiate A2Sol to the solution value of A2

So you should exract the solution values, and pass these to C++.

A more general point: I am not quite sure what you mean exactly by 
`porting to C++' - you seem to want to pass solution values from a 
ECLiPSe program to C++. This is probably the best way to use ECLiPSe as 
a constraint solver when you are using ECLiPSe with other languages -- 
but I would not call this `porting', but interfacing.

Cheers,

Kish
Received on Thu Apr 24 2008 - 16:27:27 CEST

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