From: Kish Shen <kisshen_at_...5...>

Date: Mon, 19 Jan 2009 15:08:54 +0000

Date: Mon, 19 Jan 2009 15:08:54 +0000

Ulrich Scholz wrote: > Dear all, > > it seems that ic on the order and kind of the constraints that are used. > > For example, why does ECLiPSe find the correct answer with "[eclipse 5]" but > delays with "[eclipse 7]"? > The reason for the difference is that in the first case, the initial domain you assigned the two variables has two values: 1 and 100 ([1,100]), and so local propagation is able to reduce this to the empty interval when your two constraints are posted. Did you intend [1,100], rather than [1..100] (or actually [2..99], which is what you have in your second example): [eclipse 2]: [X,Y] :: [2..99], X #= Y, X #> Y. lists.eco loaded in 0.01 seconds X = X{2 .. 98} Y = X{2 .. 98} Delayed goals: -(X{2 .. 98}) + X #> 0 Yes (0.01s cpu) [eclipse 3]: > > > [eclipse 3]: integers([X]), ic:(X #>X). > > No (0.00s cpu) > [eclipse 4]: integers([X,Y]), X #= Y, X #>Y. > > X = X{-1.0Inf .. 1.0Inf} > Y = X{-1.0Inf .. 1.0Inf} > > > Delayed goals: > -(X{-1.0Inf .. 1.0Inf}) + X #> 0 > Yes (0.00s cpu) > [eclipse 5]: [X,Y] :: [0,100], X #= Y, X #> Y. > > No (0.00s cpu) > [eclipse 7]: integers([X,Y]), X#>1, Y#>1, X#<100, Y#<100, X#=Y, X#>Y. > > X = X{2 .. 98} > Y = X{2 .. 98} > > > Delayed goals: > -(X{2 .. 98}) + X #> 0 > Yes (0.00s cpu) > > > > To get failure fast, I could use labeling as follows. Is there a better way? > > testVariables(Vars) :- > setval(test, 0), > > ( > labeling(Vars), > setval(test, 1), > fail > ; > true > ), > > getval(test, 1). I am not sure I understand what you are trying to do here -- if labeling succeeds, it means that there is a consistent assignment of values to your variables in Vars, i.e. for your inconsistent examples, a call to labeling will fail eventually. It may take a while, as it may need to remove inconsistent values from your domain one by one... Cheers, KishReceived on Mon Jan 19 2009 - 15:09:08 CET

*
This archive was generated by hypermail 2.2.0
: Mon Jul 09 2018 - 02:05:29 CEST
*