> 'Case' seems to mimic the 'case' that we'd see in functional
> languages: ...
>
> But what is the difference between 'or' and 'cond'?
>
Below is my own personal set of notes that supplements the descriptions in
the user's manual. At least, I think they are right. ;-) Corrections are
welcomed.
--
Chris
<title>Disjunctive Constructs:</title>
Unit Commit:
or G1 then S1
[] G2 then S2
[] G3 then S3
end
Execution commits to the one and only one alternative disjunct that is not
failed (or raises an exception/failure if all disjuncts fail).
Blocks forever if more than one unfailed child spaces exist. Once only one
unfailed space remains, its store is merged and the parent thread resumes
executing Si. No nondeterminism is exhibited by this operation.
Logical Conditional:
cond S0
then S1
else S2
end
Execution is blocked until the S0 child space is either entailed or
disentailed. Disentailment continues with "else"; entailment merges the
child space and continues with "then". Logic programming's equivalent of
the IF THEN ELSE clause in imperative programming languages.
Parallel Conditional:
cond G1 then S1
[] G2 then S2
[] G3 then S3
else SN
end
This is the basic construct in concurrent logic programming languages (also
known as committed-choice languages). i.e. The resultant child
threads/spaces may execute in parallel in a distributed computation. The
first child space to be entailed is merged into its parent and execution
continues with the corresponding Si statement.
This is frequently termed don't care nondeterminism.
Choice Points:
dis G1 then S1
[] G2 then S2
[] G3 then S3
end
choice
G1 then S1
[] G2 then S2
[] G3 then S3
end
This is the basic construct for constraint logic programming languages.
i.e. Disjunction plus search. This is frequently termed don't know
nondeterminism.
Constructive Disjunction:
condis S1
[] S2
[] S3
end
Immediately lifts common information from the different alternatives of a
disjunctive constraint. That is, constrains the parent space based on the
union of [newly restricted] domains in all child spaces. Could be relevant
to computing solution clusters?
Conceptually, it works like the nondistributable disjunction (or ... end)
wrt failure and entailment of child spaces. It does not block, however,
before the strongest constraint implied by all subspaces is applied to the
parent space.
This doesn't appear to actually be available in Oz apparently, though it is
used in their documentation to explain semantics of certain propagators, and
there is a 1996 paper by Wurtz and Muller titled "Constructive Disjunction
Revisited" describing it as if it actually existed (at some point).
Reified Constraints:
R1 = (X - 1 =: Y)
R2 = (1 - X =: Y)
R1 + R2 >: 0
Unlike constructive disjunction, the propagators associated with R1 and R2
do not actively prune the constraint space (at least not until they are
implied by some external propagator), but this is useful for representing
soft constraints or preferences, and for modelling objective functions for
optimization problems.
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users