This functor defines heuristic constraints, which are constraints that express a mere preference instead of a strict constraint. Heuristic constraints are applied to parameter objects (instead of parameter values) using Score.apply_H. See that definition for further information.
Functor
Heuristics ("Heuristics.oz")
Import
- LUtils at "x-ozlib://anders/strasheela/source/ListUtils.ozf"
- MUtils at "x-ozlib://anders/strasheela/source/MusicUtils.ozf"
- Score at "x-ozlib://anders/strasheela/source/ScoreCore.ozf"
- Pattern at "x-ozlib://anders/strasheela/Pattern/Pattern.ozf"
- HS at "x-ozlib://anders/strasheela/HarmonisedScore/HarmonisedScore.ozf"
Export
Define
fun{Nega B}
[Heuristic constraint combinator] Logical negation. B (int in [0, 100]) is the result of a heuristic constraint.
fun{Conj Bs}
[Heuristic constraint combinator] Logical conjunction. Bs (list of ints in [0, 100]) is a list of results of heuristic constraints.
fun{Disj Bs}
[Heuristic constraint combinator] Logical disjunction. Bs (list of ints in [0, 100]) is a list of results of heuristic constraints.
fun{Less X Y}
fun{LessEq X Y}
fun{LessContinuous X Y}
fun{Greater X Y}
fun{GreaterEq X Y}
fun{GreaterContinuous X Y}
fun{Equal X Y}
fun{EqualContinuous X Y}
fun{SmallInterval X Y}
fun{LargeInterval X Y}
fun{Step X Y Args}
fun{Member_H X Ys}
fun{MemberContinuous X Ys}
[Heuristic constraint] X (int) is in Xs (list of ints). Continuous constraint (function returns 100 if X is exactly a member and otherwise a number indicating how close X is to some of the elements of Ys (the larger the closer).
fun{MakeGivenInterval_Abs Interval}
Returns a binary heuristic constraint: intervals of size Interval (int) up or down are preferred (the closer the better).
fun{Continuous X Y Z}
[Heuristic constraint] The intervals between X, Y and Z move in the same direction (only up and down are considered; for simplicity repetitions are considered upward motion as well).
proc{Cycle Params L Weight}
[encapulated heuristic constraint] Every element in Params (list of parameter objects) and its L-th (int) successor are constrained to be equal (EqualContinuous).
proc{FollowList Params Xs Weight}
[encapulated heuristic constraint] The values of Params (list of parameter objects) "follow" Xs (list of ints), and the smaller the differences the better. Naturally, Xs can be generated with arbitrary deterministic algorithmic composition techniques. Weight (int) is the constraint's weight, use 1 by default.
FollowList internally applies heuristic constraints to Params. Efficient heuristic: for each domain value decision, only a single parameter is involved.
proc{FollowIntervals Params Xs Weight}
[encapulated heuristic constraint] The intervals between the values of Params (list of parameter objects) "follow" the intervals between Xs (list of ints), and the smaller the differences the better. Variant of FollowList that allows for transposition.
proc{FollowFenv Params MyFenv Weight}
[encapulated heuristic constraint] The values of Params (list of parameter objects) "follow" MyFenv (Fenv instance), and the smaller the differences the better. Weight (int) is the constraint's weight, use 1 by default.
FollowFenv internally applies heuristic constraints to Params. Efficient heuristic: for each domain value decision, only a single parameter is involved.
Remember that fenvs are always defined with floats, there are internally converted to integers.
proc{FollowFenvIntervals Params MyFenv Weight}
[encapulated heuristic constraint] The intervals between values of Params (list of parameter objects) "follow" intervals between corresponding MyFenv (Fenv instance) value, and the smaller the differences the better.
End