The Decision Management Community posted a fun challenge: Santa’s elves are supposed to order nine reindeer according to a set of rules. The rules are:
- Comet behind Rudolph, Prancer, and Cupid.
- Blitzen behind Cupid.
- Blitzen in front of Donder, Vixen, and Dancer.
- Cupid in front of Comet, Blitzen, and Vixen.
- Donder behind Vixen, Dasher, and Prancer.
- Rudolph behind Prancer.
- Rudolph in front of Donder, Dancer, and Dasher.
- Vixen in front of Dancer and Comet.
- Dancer behind Donder, Rudolph, and Blitzen.
- Prancer in front of Cupid, Donder, and Blitzen.
- Dasher behind Prancer.
- Dasher in front of Vixen, Dancer, and Blitzen.
- Donder behind Comet and Cupid.
- Cupid in front of Rudolph and Dancer.
- Vixen behind Rudolph, Prancer, and Dasher.
The challenge is to create a decision model, but Continue reading “Reindeer Ordering”
This is the fourth and final part of the series showing how to solve the “Eight Queens” chess puzzle, using a database design and SQL. The main idea is to design using natural language and concepts of domains, predicates, constraints, sets, set operations, and relations.
Say we place a queen, Q1, on square c5, Continue reading “Eight Queens in SQL ”
The third article in the series.
To populate tables simply run the code; it is self explanatory. You may want to keep an eye on the model while reading the code.
Propositions and Facts
A proposition is a declarative sentence, Continue reading “Eight Queens in SQL ”
This is the second article in the series; the previous one introduced the problem and specified domains.
Links to all previous and this post’s code.
||Predicates, Constraints, Relations
The idea is to describe the problem using natural language and concepts of domains, predicates, constraints, relations and keys; here are a few simple rules to keep in mind.
From predicates and constraints to relations and keys
- A predicate variable — from a specific domain — maps to an attribute of the relation.
- Internal (to predicate) uniqueness constraints map to keys of the relation.
- External (to predicate) inclusion constraints map to foreign keys between two relations.
- A predicate and the matching relation represent — evaluate to — a set of facts about the universe of discourse (the problem).
- A predicate and the matching relation should not be separated, otherwise information will be lost, for all practical purposes.
Continue reading “Eight Queens in SQL ”