Eclipse's Prolog indomain?

Eclipse's Prolog indomain?

Post by Alexander » Sat, 22 Jul 2006 21:53:20

Dear all,

i'd like to use Eclipse's predicate indomain to find a value for a
noninstantiated Integervariable. What works perfectly is:

[eclipse 16]: X #> 2, indomain(X).

X = 3
Yes (0.00s cpu, solution 1, maybe more) ?

But actually I can not be sure, that there will always be a
lower interval border, such situations could happen:

[eclipse 17]: X #< 2, indomain(X).
out of range in indomain(X{-1.0Inf .. 1})

Actually I will have a number of Constraints before, and sometimes the
domain restriction will say, that X is from range -inf to 2, and I'm also
quiet sure that it would be enough to add the constraint X #> -1000000.
But a way keeping the infity first and start the search then would be
nicer. I wondered if there is one?

thanks for your answers,

best regards,


Eclipse's Prolog indomain?

Post by Joachim Sc » Sat, 22 Jul 2006 22:50:11

Good point. I guess it would be nice if indomain/1 would
enumerate top down in this case. You can redefine it:

:- local indomain/1.

indomain(X) :-
( get_min(X) > -1.0Inf ->
indomain(X, min)
indomain(X, max)

-- Joachim