Or even just a simpler way to represent it is to just focus on the following query(assuming the ic librarby is loaded) ?- A :: 0.0 .. 0.5, [B, C] :: 0.0 .. 1.0, A $= eval(B + C - B * C). A = A{0.0 .. 0.5} B = B{0.0 .. 1.0} C = C{0.0 .. 1.0} There are 4 delayed goals. Yes (0.00s cpu) If i had ?- A :: 0.0 .. 0.5, [B, C] :: 0.0 .. 1.0, A $= eval(B + C). A = A{0.0 .. 0.5} B = B{0.0 .. 0.5} C = C{0.0 .. 0.5} There is 1 delayed goal. Yes (0.00s cpu) it propagates correctly. I have been told( by Helmut Simonis, and I hope I paraphrase this correctly!) it is because ECLiPSe treats B+C and B*C as seperate and not foesn't see the it as as the same terms being used. Again any help is appreciated, Thanks, Wayne On Wed, Jul 22, 2009 at 11:52 AM, Wayne Mac Adams <waynemacadams_at_gmail.com>wrote: > Hi, > Hopefully someone can help me with my problem, I have been advised to send > an email to this mailing list. > > > I have the following predictate > > prob_sum([],Sum,Sum). > prob_sum([E | Tail], Sum,End):- > prob_sum(Tail,Sum+E-Sum*E,End). > > It take a list of Variables and gets the probabilistic sum fo them. > Somewhere else the sum is then constrained to be less than or equal to some > other variable. > However when the list has more than one element the domains of the > variables in the list don't seem to propagate correctly. > For example consider this query > > N::0.0..0.5, NA::0.0..1.0, NC::0.0..1.0, > prob_sum([NA,NC],0,M),N1::0.0..1.0, eval(M) $=N1, N1 $=<N. > > It gives the result > > ?- N::0.0..0.5, NA::0.0..1.0, NC::0.0..1.0, > prob_sum([NA,NC],0,M),N1::0.0..1.0, eval(M) $=N1, N1 $=<N. > N = N{0.0 .. 0.5} > NA = NA{0.0 .. 1.0} > NC = NC{0.0 .. 1.0} > M = 0 + NA{0.0 .. 1.0} - 0 * NA + NC{0.0 .. 1.0} - (0 + NA - 0 * NA) * NC > N1 = N1{0.0 .. 0.5} > There are 5 delayed goals. > Yes (0.00s cpu) > > As you can see the domains for NA and NC remain from 0.0..1.0 when you > would think they should be 0.0..0.5. > > Does anyone know how to solve this problem? > It forms part of a larger problem in which I am getting an incorrect result > because of the domains staying between 0.0..1.0. > > Any help is appreciated, > Thanks, > Wayne >Received on Wed Jul 22 2009 - 14:28:13 CEST
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET