Skip to content

Commit

Permalink
Document PartialOrdering
Browse files Browse the repository at this point in the history
  • Loading branch information
mezpusz committed Jan 3, 2025
1 parent c816f4e commit 60607bc
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions Kernel/PartialOrdering.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
/**
* @file PartialOrdering.hpp
* Defines a partial ordering between elements of some set.
*/

#ifndef __PartialOrdering__
Expand All @@ -35,13 +34,24 @@ enum class PoComp : uint8_t {
bool checkCompatibility(PoComp old, PoComp curr, PoComp& res);
std::string pocompToInfix(PoComp c);

/**
* Partial ordering between elements of some set. The set elements
* are denoted by IDs inside the class, which is given by order of
* appearance, as explained below. The set elements are abstracted
* via these IDs to increase sharing among partial ordering objects.
* Hence, operations modifying the objects are performed through
* static methods.
/**
* Partial ordering between elements of some set.
*
* We initially have an empty relation, and we extend this by
* maintaining a triangular array where each entry is a @b PoComp
* value. After each extension we compute the transitive closure
* of the current relation. Assuming this was done for the previous
* relation, it is enough to compute what has become "connected"
* through the newly added value. In certain cases, this extension
* fails as the new relation would be contradictory. This state
* is represented by a null partial ordering.
*
* The set elements are denoted by IDs inside the class, which is
* given by order of appearance, as explained below. The set
* elements are abstracted via these IDs to increase sharing among
* partial ordering objects. Hence, operations modifying the
* objects are performed through static methods, and we get shared
* heap-allocated objects, or null if the operation fails.
*/
class PartialOrdering
{
Expand All @@ -52,7 +62,7 @@ class PartialOrdering
/** Get empty partial ordering. */
static const PartialOrdering* getEmpty();
/** Add new element to partial ordering. The ID of this
* element is set to @b size()-1 of the new partial ordering. */
* element is set to @b _size-1 of the new partial ordering. */
static const PartialOrdering* extend(const PartialOrdering* po);
/** Tries to set relation between two elements with IDs @b x and @b y,
* and performs transitive closure over the entire set so far.
Expand Down

0 comments on commit 60607bc

Please sign in to comment.