Re: [eclipse-clp-users] How to declare a symbolic variable

From: Joachim Schimpf <joachim.schimpf_at_...44...>
Date: Tue, 22 Sep 2009 23:00:56 +1000
Meriem Djefel wrote:
> Deal All,
> I have a model with mixed variables: real, integer  and symbolic variables.
> The symbolic variable Motorization have the symbolic domain  
> MotorisationDomaine = [un_Mot_ECO, un_Mot_BP,un_Mot_HP, deux_Mot_ECO, 
> deux_Mot_BP,deux_Mot_HP]. I want to affect a precise value from its 
> domain to the variable Motorization, because I want to write constraints 
> like this :
> (
>        (Speed $= 300 , Motorization = un_Mot_ECO);
>        (Speed $= 400 , Motorization = un_Mot_ECO))
> ) infers ic
> 
> 
> How can I do this?

Since the ic solver does not support symbolic variables, you have
two choices:  either use a different solver for the symbolic variables
(sd or ic_symbolic), or encode your symbols as integers, and convert
them back to symbols once you have a result that you want to output.

In the longer term, you will probably have less problems if you use
the latter approach, i.e. encode everything as integers, because it
is easier to work with only one solver.

But it is possible to mix solvers, even with propia:

?- lib(ic), lib(sd), lib(propia).
Yes (0.33s cpu)

?- (X $= 10, Y = a ; X $= 15, Y = b) infers [sd, ic].
X = X{sd : [10, 15], ic : [10, 15]}
Y = Y{[a, b]}
There is 1 delayed goal.
Yes (0.00s cpu)


-- Joachim
Received on Tue Sep 22 2009 - 13:01:15 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST