Re: [eclipse-users] How to ic:search/6 with symmetry breaking during search (sbds) of lib(ic_sbds)?

From: Kish Shen <kisshen_at_...5...>
Date: Thu, 05 Jul 2007 00:50:17 +0100
Hi Martin,

I could not really help you with the symmetry breaking part of your 
question,  but as no one else have replied to your message yet, I 
thought I should reply and point out some points about the ECLiPSe code 
you presented -- I am not sure if the predicate you gave does what you 
intended:

Martin Berger wrote:
> rotate90(Var,Value,SymVar,SymValue) :-
> (
> 	(not var(Value)) -> (
> 		Var is SymVar,
> 		(Value == 'left') ->  SymValue is 'rear' ; true,
> 		(Value == 'right') ->  SymValue is 'front' ; true,
> 		(Value == 'front') -> SymValue is 'left' ; true,
> 		(Value == 'rear') -> SymValue is 'right' ; true
> 	) ; true
> ).
>
>   
Your bracketing for the if-then-else is unusual and probably does not do 
what you intend. Normally if-then-else would be bracketed in the 
following way:

( Cond -> Then ; Else)

and I assume you intend the above to be:

        (Value == 'left'  ->  SymValue is 'rear' ; true),
        (Value == 'right' ->  SymValue is 'front' ; true),
        (Value == 'front' -> SymValue is 'left' ; true),

which is not what your bracketing does.

Secondly, I am not sure if

SymValue is 'rear'

is doing what you intended. is/2 is used to evaluate arithmetic 
expressions, and  'rear'  is treated as a function call to rear/1, i.e. 
the above is equivalent to:

rear(SymValue)

and it is probably clearer to write it that way.

If your intention is to assign the atom rear (you don't need the quotes 
for simple atoms like these) to SymValue, you should use =/2 instead of 
is/2:

SymValue = real

The last point is that I would be somewhat surprised if SymValue can be 
assigned to non-numeric values, as variables for lib(ic) can only take 
on numeric values (i.e. symbolic finite domain is not directly 
supported). However, this may just reflect my lack of knowledge for the 
symmetry breaking library.

Cheers,

Kish


> In my problem, I am facing a pure value symmetry, at least as far as I 
> know and understand it! Thats why "Var is SymVar" and the value is set 
> to a symmetrical one. The symmetrical group is the dihedral group, the 
> symmetry group of a square. The group elements are: identity, 
> rotate90/180/270, reflextionX, reflextionY, flipCorner1, flipCorner2.
>
> However now, search is given my a lot more symmetrical solutions than 
> without sbds. I am not sure if the problem are the symmetry predicates 
> or there is any conflict/sideeffect with the rest of my code. Am I doing 
> or understand something completely wrong?
>
> I would happy to see more examples (of you) or a tutorial of how to 
> write symmetry predicates for sbds. Or can anybody of you give me some 
> advice or hints?
>
> Thank you for your help!
>
> Best regards,
> Martin Berger
>
> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users_at_...2...
> http://www.crosscoreop.com/mailman/options/eclipse-users
>   
Received on Thu Jul 05 2007 - 00:50:34 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:19 CEST