Principle
The calendar is stored as a binary tree where leafs represent elementary time periods. Other nodes represent the period of time covered by all their descendants.
The period of time covered by a reservation is represented by a set of "top-nodes". This set is the minimal set of nodes that exactly cover the reservation period of time.
A node of the binary tree is a "top-node" for a given reservation if
- all its descendants are inside the reservation period of time,
and
- it is the root node, or at least one descendant of the parent node is outside of the reservation period of time.
The following value is stored in each node:
q(node) = max(q(left child), q(right child)) + total amount of reserved resource for all reservations having this node as a "top-node"(for code optimization, the two parts of this sum are usually stored separately.)
Read more about this topic: Top-nodes Algorithm
Famous quotes containing the word principle:
“I do not mean to exclude altogether the idea of patriotism. I know it exists, and I know it has done much in the present contest. But I will venture to assert, that a great and lasting war can never be supported on this principle alone. It must be aided by a prospect of interest, or some reward.”
—George Washington (17321799)
“Thou art blind to the danger of marrying a woman who feels and acts out the principle of equal rights.”
—Angelina Grimké (18051879)
“The principle of asceticism never was, nor ever can be, consistently pursued by any living creature. Let but one tenth part of the inhabitants of the earth pursue it consistently, and in a days time they will have turned it into a Hell.”
—Jeremy Bentham (17481832)