[Newbie] Blocking statement in constraint programming
Thomas LUDWIG
thomas.ludwig at wanadoo.fr
Mon Apr 14 17:40:43 CEST 2003
Hi,
I have to make a program that helps in music composition, so I chose
Mozart for its constraint programming aspect.
To start, I have this trivial proc:
declare Contre
proc {Contre S C}
{FD.tuple compose 15 48#72 C}
{Browse S}
% pas d'intervale superieur a la quinte:
{ For 2 15 1 proc {$ I} (C.I) <: (C.(I-1)) + 7 end}
{ For 2 15 1 proc {$ I} (C.I) >: (C.(I-1)) - 7 end}
% pas d'intervale inferieure au ton:
{ For 2 15 1 proc {$ I} (C.I) \=: (C.(I-1)) + 1 end}
{ For 2 15 1 proc {$ I} C.I \=: C.(I-1) end}
{ For 2 15 1 proc {$ I} (C.I) \=: (C.(I-1)) - 1 end}
% regle bidon 1:
{ For 1 15 1 proc {$ I} C.I \=: I+47 end}
% regle bidon 2:
{ For 3 15 1 proc {$ I} C.I \=: C.(I-2) end}
% regle entre sujet et contre sujet: pas de second dim:
{ For 1 15 1 proc {$ I} (C.I) \=: (S.I) - 1 end}
{ For 1 15 1 proc {$ I} (C.I) \=: (S.I) + 1 end}
{FD.distribute ff C}
end
declare Do Re Mi Fa Sol La Si Sujet
Do = 60+0
Re = 60+2
Mi = 60+4
Fa = 60+5
Sol = 60+7
La = 60+9
Si = 60+11
Sujet = sujet(Do Mi Sol La Mi Re Do Re Mi Fa Sol Mi Re Do Do)
{Browse {SearchOne {Contre Sujet}}}
{Browse 'this is the end'}
It doesn't reach to end, and I don't know why :/ in my previous version,
I had :
proc {Contre C} and no rules about S.I and it worked fine.
But even if I suppress those rules, it's still blocking, so I guess i'm
miscalling SearchOne (the call looked like that in the "MapColoring"
exemple of the tutorial), but as I said, i'm a newbie and I don't know
how to correct that.
Thanks.
-
Please send submissions to users at mozart-oz.org
and administriva mail to users-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.
Please send bug reports to bugs at mozart-oz.org.
More information about the mozart-users
mailing list