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:
“Experimental work provides the strongest evidence for scientific realism. This is not because we test hypotheses about entities. It is because entities that in principle cannot be observed are manipulated to produce a new phenomena
[sic] and to investigate other aspects of nature.”
—Ian Hacking (b. 1936)
“I ... observed the great beauty of American government to be, that the simple machines of representation, carried through all its parts, gives facility for a being moulded at will to fit with the knowledge of the age; that thus, although it should be imperfect in any or all of its parts, it bears within it a perfect principle the principle of improvement.
”
—Frances Wright (17951852)
“Circumstances ... give in reality to every political principle its distinguishing colour and discriminating effect. The circumstances are what render every civil and political scheme beneficial or noxious to mankind.”
—Edmund Burke (17291797)