Declared In: |
|
See Also: |
http://www.boost.org/doc/libs/1_60_0/libs/graph/doc/index.html
|
Introduction
The Constraint System base class.
Discussion
Other derived constraint systems inherit the functionality of this class. It implements the entailment, meet, join and implication operators. It heavily relies on the boost graph implementation.
Member Functions
- add_element
Adds an element to the CS where lower ⊑ elem ⊑ upper .
- bound
Calculates either GLB( elems ) or LUB( elems ).
- cs(const cs &)
Copy Constructor.
- cs(ELEM_TYPE, ELEM_TYPE)
Constructor.
- glb
Calculates GLB( elems )
- imp
Calculates the element elem1 → elem2 in the CS.
- is_distributive
Checks if the lattice is distributive.
- leq
Tests if elem1 ⊑ elem2 .
- lub
Calculates LUB( elems )
- p_getElementNum
Retrives the identifier of an element in the constraint system.
- print_cons
Prints (on the standard output) the elements of the CS along with its identifier (in parenthesis).
- print_relation
Prints (on the standard output) the ordering relation or its inverse.
- ~cs
Destructor.
Adds an element to the CS where lower ⊑ elem ⊑ upper .
public
void add_element(
ELEM_TYPE elem,
const std::vector<ELEM_TYPE>& lower = std::vector<ELEM_TYPE>(),
const std::vector<ELEM_TYPE>& upper = std::vector<ELEM_TYPE>() );
Parameters
-
elem
element to add to the CS.
-
lower
elements immediately entailed (in the ordering relation) by the element to be added. If none are given, the global infima of the CS is entailed by the element.
-
upper
elements immediately entailing (in the ordering relation) the element to be added. If none are given, the element is entiled by the global suprema of the CS.
Discussion
This function adds an element to the constraint system where the set of elements lower is directly related to the element and the element itself is related to the set of elements upper . It performs a transitive closure on the ordering relation for complexity advantages in the operators of the CS.
Complexity
O(n³) where n is the number of elements in the CS.
Calculates either GLB( elems ) or LUB( elems ).
protected
ELEM_TYPE bound(
const std::set<t_elem>& elems,
bool lower );
Parameters
-
elems
set of elements for bound calculation.
-
lower
true to calculate GLB, false to calculate LUB.
Return Value
calculated bound.
Complexity
O(n²) where n is the number of elements of the CS.
Copy Constructor.
public
cs (
const cs<ELEM_TYPE>& CS );
Parameters
-
CS
already instantiated CS.
Complexity
Constant.
Constructor.
public
cs (
ELEM_TYPE bottom,
ELEM_TYPE top );
Parameters
-
bottom
bottom of the CS.
-
top
top of the CS.
Complexity
Constant.
Calculates GLB( elems )
public
ELEM_TYPE glb(
const std::vector<ELEM_TYPE>& elems = std::vector<ELEM_TYPE>() );
Parameters
-
elems
elements to calculate their Greatest Lower Bound. If none are given then the global infima is calculated.
Return Value
⨅(elems ). If elems = ∅, the result is ⊥.
Complexity
Same as bound.
Calculates the element elem1 → elem2 in the CS.
public
ELEM_TYPE imp(
ELEM_TYPE elem1,
ELEM_TYPE elem2 );
Parameters
-
elem1
antecedent.
-
elem2
consequent.
Return Value
elem1 → elem2 .
Discussion
The definition of implication used here is the Heyting implication defined as c → d = ⨅{ e | c ⨆ e ⊒ d }. If d = ⊤ the result of the implication is ~c.
Complexity
O(n³) where n is the number of elements of the CS.
Checks if the lattice is distributive.
Return Value
true if the lattice is distributive and false otherwise.
Discussion
A lattice is distributive iff for all elements a, b and c the following holds; a ⨆ (b ⨅ c) = (a ⨆ b) ⨅ (a ⨆ c). Distributivity is necessary for modus ponens (i.e. c ⨆ (c → d) ⊒ d).
Complexity
O(n³) where n is the number of elements of the CS.
Tests if elem1 ⊑ elem2 .
public
bool leq(
ELEM_TYPE elem1,
ELEM_TYPE elem2 );
Parameters
-
elem1
element to be tested againts the other.
-
elem2
element to be tested against the other.
Return Value
true if elem1 ⊑ elem2 , false otherwise.
Complexity
Constant.
Calculates LUB( elems )
public
ELEM_TYPE lub(
const std::vector<ELEM_TYPE>& elems = std::vector<ELEM_TYPE>() );
Parameters
-
elems
elements to calculate their Least Upper Bound. If none are given then the global suprema is calculated.
Return Value
⨆(elems ). If elems = ∅, the result is ⊤.
Complexity
Same as bound.
Retrives the identifier of an element in the constraint system.
Parameters
-
elem
element of the constraint system.
Return Value
element's identifier, negative if not found.
Complexity
O(n) where n is the number of elements of the CS.
Prints (on the standard output) the elements of the CS along with its identifier (in parenthesis).
public
void print_cons(
const std::function<void(
ELEM_TYPE)>& printer );
Complexity
O(n) where n is the number of elements of the CS.
printer
a process that takes one element of the CS and prints it. it is mean to be passed as a parameter.
Prints (on the standard output) the ordering relation or its inverse.
Parameters
-
inverse
false to print the ordering relation, true to print its inverse
Complexity
O(n²) where n is the number of elements of the CS.
Destructor.
Complexity
Constant.
Typedefs
- t_elem
- t_relation
protected
typedef typename boost::graph_traits<t_relation>::vertex_descriptor t_elem;
Discussion
Type for the identifiers of the elements in the constraint system. Currently, it is equivalent to int .
protected
typedef typename boost::adjacency_list< boost::listS, boost::vecS, boost::bidirectionalS, boost::property<boost::vertex_name_t, ELEM_TYPE> > t_relation;
Discussion
Type for the ordering relation. Basically it is a graph representing the ordering relation's transitive closure.
See Also
http://www.boost.org/doc/libs/1_60_0/libs/graph/doc/adjacency_list.html
Member Data
- m_cons
- m_rel
protected
std::deque<ELEM_TYPE>* m_cons;
Discussion
Queue of the elements of the constraint system.
Discussion
Graph representing the ordering relation.
Last Updated: Wednesday, March 16, 2016
|