Oz and Mozart Users Mailing List

Re: "class" constraints


From: Torsten Anders (t.anders@qub.ac.uk)
Date: Sat Jun 21 2003 - 16:58:43 CEST


Hi,

On Thu, 2003-06-19 at 23:38, Denys Duchier wrote:
> do you really need to invoke methods _before_ the class is fully known
> _and_ expect them to execute as early as possible. It is obvious
> (to me :-) that
> requiring the latter is not going to be particularly efficient... to
> put it plainly, it is going to suck.

Thanks again for your answer! I try to step back and explain a bit more
informal, general and application oriented what I would like to do.
Perhaps I just do not yet know what means I need, so instead I try to
describe my need.

I want to constrain a music score, where constraints are often context
dependent: certain compositional rules only hold in certain
circumstances. E.g., in traditional rule sets for some specific styles
of vocal music (so call counterpoint rules), certain rules on the pitch
intervals and durations are only valid at the end of some sub-part of a
piece (the end is marked by a so called cadence). I.e. if a certain
subpart of a score forms a cadence, then their are a few special
constraints on the pitches and durations to fulfil and other constraints
are weakened.

I now sketch a solution idea -- so far I thought it will fulfil this
need. So far I though, I may express context dependent constraints, by
applying the constraints only on all score elements which fulfil some
context-test-function (n-ary constraints are formulated as a unary
procedure on some score entity, which internally uses some data
structure API functions to access other score entities).

{ForAll {FilterScore Score TestFn}
        ConstraintProc}

My class dependent constraints are actually a special case of this
issue, my test-function tests for class membership.

I still think the semantics of such a construct is what I need, but
perhaps this can be done more efficiently. Obviously, there can not
happen any propagation by context constraints before some choices are
done which led to a situation fulfilling the test-function. I now think
it would be better to change the construct by, e.g., somehow formulating
the context-test-function by constraints instead and combine the context
test with the context constraints (e.g. by FD.impl ?).

> do you really need to invoke methods _before_ the class is fully known

Again, my "method dispatching" is just a special case of this. With my
"class constraints" idea I just wanted to formulate constraints which
dependent to the (initially unknown) class of a score object. The class
of an object is simple context. Ideally, the class dependent constraints
should be imposed as early as possible to make propagation happen.

Best,
Torsten

PS: Thank you for your code. Its pretty impressing to me to see how far
one can twist the Oz OOP model! ;-)

-
Please send submissions to users@mozart-oz.org
and administriva mail to users-request@mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.
Please send bug reports to bugs@mozart-oz.org.



This archive was generated by hypermail 2b29.