Hi Kish, First of all, thanks for your answer! In some points I wasn't really precise, so I try to clear it up a bit... Kish Shen wrote: > 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. > You are absolutely right! I forgot to put the closing brackets into the example code! ;-) > Secondly, I am not sure if > > SymValue is 'rear' > You are right again! I really should have pointed out, that 'rear' in my example code represents a numeric value, i.e. the value 3. I tried to make the example code more intuitive and "speaking" by replacing the numeric value with the actual meaning of the value. Sorry for bringing you on the wrong track! > 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. > See the antecedent explanation for the is/2 and =/2 issue. > > > Some further observations of mine on a smaller straightforward test problem instance: I run my code on a problem where I know that there are 2 nonsymmetrical solutions. Without sbds my code is given me 4 solutions where 2 of them are symmetrically equivalent to the former ones. When I plug in sbds with my 8 symmetry predicates, the search comes up with 14317 solutions (only duplicates of the 4 solutions I got without sbds)! Somehow even a lot more solutions are instantiated. Is it because I only exchange (in a symmetrical sense) the values and not the variables? Anyway, Kish thanks for pointing out the inprecise parts of my explanation! Cheers, Martin > 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_crosscoreop.com >> http://www.crosscoreop.com/mailman/options/eclipse-users >>Received on Thu Jul 05 2007 - 07:50:01 CEST
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET