| Title: | Posetic Data Analysis |
|---|---|
| Description: | Build and manipulate partially ordered sets (posets), to perform some data analysis on them and to implement multi-criteria decision making procedures. Several efficient ways for generating linear extensions are implemented, together with functions for building mutual ranking probabilities, incomparability, dominance and separation scores (Fattore, M., De Capitani, L., Avellone, A., Suardi, A. (2024). A fuzzy posetic toolbox for multi-criteria evaluation on ordinal data systems. ANNALS OF OPERATIONS RESEARCH <doi:10.1007/s10479-024-06352-3>). |
| Authors: | Alessandro Avellone [aut, cre], Lucio De Capitani [aut], Marco Fattore [aut] |
| Maintainer: | Alessandro Avellone <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.1.0 |
| Built: | 2026-05-18 11:20:10 UTC |
| Source: | https://github.com/cran/poseticDataAnalysis |
Build and manipulate partially ordered sets (posets), to perform some data analysis on them and to implement multi-criteria decision making procedures. Several efficient ways for generating linear extensions are implemented, together with functions for building mutual ranking probabilities, incomparability, dominance and separation scores (Fattore, M., De Capitani, L., Avellone, A., Suardi, A. (2024). A fuzzy posetic toolbox for multi-criteria evaluation on ordinal data systems. ANNALS OF OPERATIONS RESEARCH doi:10.1007/s10479-024-06352-3).
Maintainer: Alessandro Avellone [email protected]
Authors:
Alessandro Avellone [email protected]
Lucio De Capitani [email protected]
Marco Fattore [email protected]
Starting from a dataset related to statistical units, scored against
ordinal 0/1-indicators and partially ordered component-wise into a Boolean lattice ,
it finds the bidimensional data representation generated by a specific reversed pair of lexicographic linear extensions.
BidimentionalPosetRepresentation(profile, weights, variablesPriority)BidimentionalPosetRepresentation(profile, weights, variablesPriority)
profile |
Boolean matrix of dimension |
weights |
real vector of length |
variablesPriority |
integer vector of dimension |
a list of 2 elements named 'LossVAlue' and 'Representation'.
'LossVAlue' real number indicating the value of the global error corresponding to the representation induced by the chosen 'variablesPriority'.
'Representation' a data frame with values (one value for each observed profile) of 5 variables named 'profiles', 'x', 'y', 'weights' and 'error'.
'$profile' is an integer vector containing the base-10 representation of the -dimensional Boolean vectors representing observed profiles.
'$x' is an integer vector containing the x-coordinates of points representing observed profiles in the bidimensional representation.
'$y' is an integer vector containing the y-coordinates of points representing observed profiles in the bidimensional representation.
'$weights' is a real vector with the frequencies/weights of each observed profile.
'$error' is a real vector with the values of the approximation errors associated to each observed profile
in the bidimensional representation.
#SIMULATING OBSERVED BINARY DATA #number of binary variables k <- 6 #building observed profiles matrix profiles <- sapply((0:(2^k-1)) ,function(x){ as.integer(intToBits(x))}) profiles <- t(profiles[1:k, ]) #building the vector of observation frequencies weights <- sample.int(100, nrow(profiles), replace=TRUE) #Chosing (at random) a variable priority vp <- sample.int(k, k, replace=FALSE) result <- BidimentionalPosetRepresentation(profiles, weights, vp)#SIMULATING OBSERVED BINARY DATA #number of binary variables k <- 6 #building observed profiles matrix profiles <- sapply((0:(2^k-1)) ,function(x){ as.integer(intToBits(x))}) profiles <- t(profiles[1:k, ]) #building the vector of observation frequencies weights <- sample.int(100, nrow(profiles), replace=TRUE) #Chosing (at random) a variable priority vp <- sample.int(k, k, replace=FALSE) result <- BidimentionalPosetRepresentation(profiles, weights, vp)
Constructs a component-wise poset, starting from a collection of binary variables.
BinaryVariablePOSet(variables)BinaryVariablePOSet(variables)
variables |
A vector of character strings (the names of the input binary variables). |
Given input binary variables, the function produces a poset , where is the set of binary vectors built from the variables, and is the component-wise order.
An object of S4 class 'BinarVariablePOSet' (subclass of 'POSet').
vrbs <- c("var1", "var2", "var3") binPoset <- BinaryVariablePOSet(variables = vrbs)vrbs <- c("var1", "var2", "var3") binPoset <- BinaryVariablePOSet(variables = vrbs)
An S4 class to represent a Binary Variable POSet.
ptran external pointer to C++ data
Computes the dominance matrix of the input poset, based on the BLS formula of Brueggemann et al. (2003).
BLSDominance(poset)BLSDominance(poset)
poset |
Object of S4 class 'POSet' (the input poset). Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
The BLS dominance matrix
Brueggemann R., Lerche D. B., Sørensen P. B. (2003). First attempts to relate structures of Hasse diagrams with mutual probabilities, in: Sørensen P.B., Brueggemann R., Lerche D.B., Voigt K.,Welzl G., Simon U., Abs M., Erfmann M., Carlsen L., Gyldenkærne S., Thomsen M., Fauser P., Mogensen B. B., Pudenz S., Kronvang B. Order Theory in Environmental Sciences Integrative approaches.The 5th workshop held at the National Environmental Research Institute (NERI), Roskilde, Denmark, November 2002. National Environmental Research Institute, Denmark - NERI Technical Report, No. 479.
el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) res <- BLSDominance(pos)el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) res <- BLSDominance(pos)
'BubleyDyerEvaluation' computes the averages of the input functions (defined on linear orders) over a subset of linear extensions of the input poset, randomly generated by the Bubley-Dyer procedure.
BubleyDyerEvaluation( generator, n = NULL, error = NULL, output_every_sec = NULL )BubleyDyerEvaluation( generator, n = NULL, error = NULL, output_every_sec = NULL )
generator |
S4 object of class 'BubleyDyerEvaluationGenerator' created by function [BuildBubleyDyerEvaluationGenerator()], implicitly containing the poset and the list of functions, whose averages are to be estimated. |
n |
Number of linear extensions to be generated. See the 'Details', for further information on this parameter. |
error |
A real number in
If both arguments 'n' and 'error' are specified by the user, the number of linear extensions actually generated is 'n'. |
output_every_sec |
Integer specifying a time interval (in seconds). |
The function 'BubleyDyerEvaluation' allows the user to update previously computed averages, so as to improve estimation accuracy.
The 'generator' internally stores the averages computed at each call of 'BubleyDyerEvaluation'.
At the subsequent call (with the same 'generator' argument), the previously computed averages are
updated, based on the newly sampled linear extensions.
In this case, the number of additional linear extensions is determined either directly, by parameter 'n',
or indirectly, by specifying parameter 'error', which sets the desired
"distance" from uniformity of the sampling distribution of linear extensions, in the Bubley-Dyer procedure.
In the latter case, the number of additional linear extensions is computed as
, where is the number of linear extensions necessary to achive the desired "distance"
and is the total number of linear extensions generated in the previous calls of 'BubleyDyerEvaluation'.
If , no further linear extensions are generated and a warning message is displayed.
In case new function averages are desired, run 'BubleyDyerEvaluation' with a 'generator' argument newly generated by function 'BuildBubleyDyerEvaluationGenerator'.
List of the estimated averages, along with the number of linear extensions used to compute them.
Bubley, R., Dyer, M. (1999). Faster random generation of linear extensions. Discrete Mathematics, 201, 81-88. https://doi.org/10.1016/S0012-365X(98)00333-1
el1 <- c("a", "b", "c", "d") el2 <- c("x", "y") el3 <- c("h", "k") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = el1, dom = dom) pos2 <- LinearPOSet(elements = el2) pos3 <- LinearPOSet(elements = el3) pos <- ProductPOSet(pos1, pos2, pos3) # median_distr computes the frequency distribution of median profile elements <- POSetElements(pos) median_distr <- function(le) { n <- length(elements) if (n %% 2 != 0) { res <- (elements == le[(n + 1) / 2]) } else { res <- (elements == le[n / 2]) } res <- as.matrix(res) rownames(res) <- elements colnames(res) <- "median_distr" return (as.matrix(res)) } # computation with parameter n BDgen <- BuildBubleyDyerEvaluationGenerator(poset = pos, seed = NULL, median_distr) res <- BubleyDyerEvaluation(BDgen, n=40000, output_every_sec=1) #refinement results with parameter n res <- BubleyDyerEvaluation(BDgen, n=10000, output_every_sec=1) #refinement results with parameter error res <- BubleyDyerEvaluation(BDgen, error=0.2, output_every_sec=1) #Attempt to further refine results with parameter `error=0.2` does not modify previous result res <- BubleyDyerEvaluation(BDgen, error=0.2, output_every_sec=1) # computation with parameter error BDgen <- BuildBubleyDyerEvaluationGenerator(poset = pos, seed = NULL, median_distr) res <- BubleyDyerEvaluation(BDgen, error=0.2, output_every_sec=1)el1 <- c("a", "b", "c", "d") el2 <- c("x", "y") el3 <- c("h", "k") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = el1, dom = dom) pos2 <- LinearPOSet(elements = el2) pos3 <- LinearPOSet(elements = el3) pos <- ProductPOSet(pos1, pos2, pos3) # median_distr computes the frequency distribution of median profile elements <- POSetElements(pos) median_distr <- function(le) { n <- length(elements) if (n %% 2 != 0) { res <- (elements == le[(n + 1) / 2]) } else { res <- (elements == le[n / 2]) } res <- as.matrix(res) rownames(res) <- elements colnames(res) <- "median_distr" return (as.matrix(res)) } # computation with parameter n BDgen <- BuildBubleyDyerEvaluationGenerator(poset = pos, seed = NULL, median_distr) res <- BubleyDyerEvaluation(BDgen, n=40000, output_every_sec=1) #refinement results with parameter n res <- BubleyDyerEvaluation(BDgen, n=10000, output_every_sec=1) #refinement results with parameter error res <- BubleyDyerEvaluation(BDgen, error=0.2, output_every_sec=1) #Attempt to further refine results with parameter `error=0.2` does not modify previous result res <- BubleyDyerEvaluation(BDgen, error=0.2, output_every_sec=1) # computation with parameter error BDgen <- BuildBubleyDyerEvaluationGenerator(poset = pos, seed = NULL, median_distr) res <- BubleyDyerEvaluation(BDgen, error=0.2, output_every_sec=1)
An S4 class to represent function evaluation based on the Bubley-Dyer procedure.
ptran external pointer to a C++ data
An S4 class to represent the linear extension generator based on the Bubley-Dyer procedure.
ptran external pointer to C++ data
Computes an approximated MRP matrix, starting from a set of linear extensions sampled according to the Bubley-Dyer procedure.
BubleyDyerMRP(generator, n = NULL, error = NULL, output_every_sec = NULL)BubleyDyerMRP(generator, n = NULL, error = NULL, output_every_sec = NULL)
generator |
The approximated MRP matrix generator created by function [BubleyDyerMRPGenerator()]. |
n |
Number of linear extensions generated to compute the approximated MRP matrix. See 'Details' for further information on this argument. |
error |
A real number in
If both arguments 'n' and 'error' are specified by the user, the number of linear extensions actually generated is 'n'. |
output_every_sec |
Integer specifying a time interval (in seconds). By specifying this argument, during the execution of 'BubleyDyerMRP', a message reporting the number of linear extensions progressively generated is printed on the R-Console, every 'output_every_sec' seconds. |
The function 'BubleyDyerMRP' allows the user to update a previously computed approximated
MRP matrix, so as to improve estimation accuracy.
Specifically, the argument 'generator' internally stores the approximated MRP matrix
computed at each execution of 'BubleyDyerMRP'.
At the subsequent call (with the same 'generator' argument), the previously computed MRP
are updated, based on the newly sampled linear extensions.
In this case, the number of additional linear extensions is determined either directly, by parameter 'n',
or indirectly, by specifying parameter 'error', which sets the desired
"distance" from uniformity of the sampling distribution of linear extensions, in the Bubley-Dyer procedure.
In the latter case, the number of additional linear extensions is computed as
, where is the number of linear extensions necessary to achive the desired "distance"
and is the total number of linear extensions generated in the previous calls of 'BubleyDyerEvaluation'.
If , no further linear extensions are generated and a warning message is displayed.
In case a newly computed approximated MRP matrix is desired, run 'BubleyDyerMRP' with a 'generator' argument newly generated by function [BubleyDyerMRPGenerator()].
A list of two elements: 1) the matrix of approximated MRP and 2) the number of linear extensions generated to compute it.
Bubley, R., Dyer, M. (1999). Faster random generation of linear extensions. Discrete Mathematics, 201, 81-88. https://doi.org/10.1016/S0012-365X(98)00333-1
el1 <- c("a", "b", "c") el2 <- c("x", "y", "z") el3 <- c("h", "k") dom <- matrix(c( "a", "b", "c", "b" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = el1, dom = dom) pos2 <- LinearPOSet(elements = el2) pos3 <- LinearPOSet(elements = el3) pos <- ProductPOSet(pos1, pos2, pos3) BDgen <- BubleyDyerMRPGenerator(pos) #MRP computation with parameter n res <- BubleyDyerMRP(BDgen, n=700000, output_every_sec=1) #MRP refinement with parameter n res <- BubleyDyerMRP(BDgen, n=100000, output_every_sec=1) #MRP refinement with parameter error res <- BubleyDyerMRP(BDgen, error=0.05, output_every_sec=1) #Attempt to further refine MRP with parameter `error=0.05` does not modify previous result res <- BubleyDyerMRP(BDgen, error=0.05, output_every_sec=1) #new MRP computation with parameter error BDgen <- BubleyDyerMRPGenerator(pos) res <- BubleyDyerMRP(BDgen, error=0.05, output_every_sec=1)el1 <- c("a", "b", "c") el2 <- c("x", "y", "z") el3 <- c("h", "k") dom <- matrix(c( "a", "b", "c", "b" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = el1, dom = dom) pos2 <- LinearPOSet(elements = el2) pos3 <- LinearPOSet(elements = el3) pos <- ProductPOSet(pos1, pos2, pos3) BDgen <- BubleyDyerMRPGenerator(pos) #MRP computation with parameter n res <- BubleyDyerMRP(BDgen, n=700000, output_every_sec=1) #MRP refinement with parameter n res <- BubleyDyerMRP(BDgen, n=100000, output_every_sec=1) #MRP refinement with parameter error res <- BubleyDyerMRP(BDgen, error=0.05, output_every_sec=1) #Attempt to further refine MRP with parameter `error=0.05` does not modify previous result res <- BubleyDyerMRP(BDgen, error=0.05, output_every_sec=1) #new MRP computation with parameter error BDgen <- BubleyDyerMRPGenerator(pos) res <- BubleyDyerMRP(BDgen, error=0.05, output_every_sec=1)
Creates an object of S4 class 'BubleyDyerMRPGenerator' for the computation of an approximated MRP matrix, starting from a set of random linear extensions, sampled according to the Bubley-Dyer procedure. Actually, this function does not compute the MRP matrix, but just the object that will compute it, by using function 'BubleyDyerMRP'.
BubleyDyerMRPGenerator(poset = NULL, seed = NULL)BubleyDyerMRPGenerator(poset = NULL, seed = NULL)
poset |
Object of S4 class 'POSet' representing the poset whose MRP are computed. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
seed |
Positive integer to initialize the random linear extension generation. |
An object of S4 class 'BubleyDyerMRPGenerator'.
el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) BDgen <- BubleyDyerMRPGenerator(pos)el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) BDgen <- BubleyDyerMRPGenerator(pos)
An S4 class to represent the MRP generator based on the Bubley-Dyer procedure.
ptran external pointer to C++ data
Computes approximated separation matrices, starting from a set of linear extensions sampled according to the Bubley-Dyer procedure.
BubleyDyerSeparation( generator, n = NULL, error = NULL, output_every_sec = NULL )BubleyDyerSeparation( generator, n = NULL, error = NULL, output_every_sec = NULL )
generator |
The approximated separation matrices generator created by function [BuildBubleyDyerSeparationGenerator()]. |
n |
number of linear extensions generated to compute the approximated MRP matrix. See documentation for function [BubleyDyerMRP()] for further information on this argument. |
error |
A real number in |
output_every_sec |
Integer specifying a time interval (in seconds). By specifying this argument, during the execution of 'BubleyDyerSeparation', a message reporting the number of linear extensions progressively generated is printed on the R-Console, every 'output_every_sec' seconds. |
See the documentation of [BuildBubleyDyerSeparationGenerator()] for details on how the different types of separations are defined and computed.
A list containing: 1) the required type of approximated separation matrices, according to the parameter 'type' used to build the 'generator' ( see[BuildBubleyDyerSeparationGenerator()]); 2) the number of generated linear extensions.
Bubley, R., Dyer, M. (1999). Faster random generation of linear extensions. Discrete Mathematics, 201, 81-88. https://doi.org/10.1016/S0012-365X(98)00333-1
el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) BDgen <- BuildBubleyDyerSeparationGenerator(pos, seed = NULL, type="symmetric", "asymmetricUpper", "vertical") SEP_matrices <- BubleyDyerSeparation(BDgen, n=10000, output_every_sec=5)el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) BDgen <- BuildBubleyDyerSeparationGenerator(pos, seed = NULL, type="symmetric", "asymmetricUpper", "vertical") SEP_matrices <- BubleyDyerSeparation(BDgen, n=10000, output_every_sec=5)
An S4 class to represent function separation based on the Bubley-Dyer procedure.
ptran external pointer to a C++ data
typeslist of separation to be computed
'BuildBubleyDyerEvaluationGenerator' creates an object of S4 class 'BuildBubleyDyerEvaluationGenerator', for the estimation of the mean values of the input functions, over linear extensions sampled according to the Bubley-Dyer procedure. Actually, this function does not perform the computation of mean values, but just generates the object that will compute them by using function 'BubleyDyerEvaluation'.
BuildBubleyDyerEvaluationGenerator(poset, seed, f1, ...)BuildBubleyDyerEvaluationGenerator(poset, seed, f1, ...)
poset |
An object of S4 class 'POSet' representing the poset from which linear extensions are generated. Object 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
seed |
Positive integer to initialize random linear extension generation. Set 'seed=NULL' for random initialization. |
f1 |
The function whose mean value is to be computed. 'f1' must be an R-function having as a single parameter a linear extension of 'poset' and returning a numerical matrix. |
... |
Further functions whose mean values are to be computed. |
An object of S4-class 'BuildBubleyDyerEvaluationGenerator'.
el1 <- c("a", "b", "c", "d") el2 <- c("x", "y") el3 <- c("h", "k") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = el1, dom = dom) pos2 <- LinearPOSet(elements = el2) pos3 <- LinearPOSet(elements = el3) pos <- ProductPOSet(pos1, pos2, pos3) # median_distr computes the frequency distribution of median profile elements <- POSetElements(pos) median_distr <- function(le) { n <- length(elements) if (n %% 2 != 0) { res <- (elements == le[(n + 1) / 2]) } else { res <- (elements == le[n / 2]) } res <- as.matrix(res) rownames(res) <- elements colnames(res) <- "median_distr" return (as.matrix(res)) } BDgen <- BuildBubleyDyerEvaluationGenerator(poset = pos, seed = NULL, median_distr)el1 <- c("a", "b", "c", "d") el2 <- c("x", "y") el3 <- c("h", "k") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = el1, dom = dom) pos2 <- LinearPOSet(elements = el2) pos3 <- LinearPOSet(elements = el3) pos <- ProductPOSet(pos1, pos2, pos3) # median_distr computes the frequency distribution of median profile elements <- POSetElements(pos) median_distr <- function(le) { n <- length(elements) if (n %% 2 != 0) { res <- (elements == le[(n + 1) / 2]) } else { res <- (elements == le[n / 2]) } res <- as.matrix(res) rownames(res) <- elements colnames(res) <- "median_distr" return (as.matrix(res)) } BDgen <- BuildBubleyDyerEvaluationGenerator(poset = pos, seed = NULL, median_distr)
Creates an object of S4 class 'BubleyDyerSeparationGenerator' for the computation of approximated separation matrices, starting from a set of random linear extensions, sampled according to the Bubley-Dyer procedure (see Bubley and Dyer, 1999) Actually, this function does not compute the separation matrices, but just the object that will compute them, by using function 'BubleyDyerSeparation'.
BuildBubleyDyerSeparationGenerator(poset, seed, type, ...)BuildBubleyDyerSeparationGenerator(poset, seed, type, ...)
poset |
Object of S4 class 'POSet' representing the poset whose separation matrices are to be computed. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
seed |
Positive integer to initialize the random linear extension generation. |
type |
type of separation to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper", "vertical", "horizontal". |
... |
additional types of separations to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper", "vertical", "horizontal". |
The symmetric separation associated to elements and in the input poset is the average
absolute difference between the positions of and observed in the sampled linear extensions (whose elements are arranged in ascending order):
,
where is the numbers of sampled linear extensions;
represents a sampled linear extension and stands for the position of element
into the sequence of poset elements arranged in increasing order according to .
Asymmetric lower and upper separations are defined as:
,
,
where means that is lower or equal to in the linear order defined by linear
extension and is the indicator function. Note that .
Vertical and horizontal separations ( and , respectively) are defined as
and #' .
For a detailed explanation on why and can be interpreted as vertical and horizontal components
of the separation between two poset elements, see Fattore et. al (2024).
An object of S4 class 'BubleyDyerSeparationGenerator'.
Bubley, R., Dyer, M. (1999). Faster random generation of linear extensions. Discrete Mathematics, 201, 81-88. https://doi.org/10.1016/S0012-365X(98)00333-1
Fattore, M., De Capitani, L., Avellone, A., and Suardi, A. (2024). A fuzzy posetic toolbox for multi-criteria evaluation on ordinal data systems. Annals of Operations Research, https://doi.org/10.1007/s10479-024-06352-3.
el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) BDgen <- BuildBubleyDyerSeparationGenerator(pos, seed = NULL, type="symmetric", "asymmetricUpper", "vertical")el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) BDgen <- BuildBubleyDyerSeparationGenerator(pos, seed = NULL, type="symmetric", "asymmetricUpper", "vertical")
Extracts the elements comparable with the input element, in the poset.
ComparabilitySetOf(poset, element)ComparabilitySetOf(poset, element)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
element |
A character string (the name of the input poset element). |
A vector of character strings (the names of the poset elements comparable to the input element).
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) cmp <- ComparabilitySetOf(pos, "a")elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) cmp <- ComparabilitySetOf(pos, "a")
Computes the cover matrix of the input poset.
CoverMatrix(poset)CoverMatrix(poset)
poset |
An object of S4 class POSet. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
A square boolean matrix ( if and only if the -th element of the input poset covers the -th).
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) C <- CoverMatrix(pos)elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) C <- CoverMatrix(pos)
Computes the cover relation of the input poset.
CoverRelation(poset)CoverRelation(poset)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
A two-column matrix of character strings (element covers element ).
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) M <- CoverRelation(pos)elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) M <- CoverRelation(pos)
Builds a crown from two unordered collections of elements, with the same size.
CrownPOSet(elements_1, elements_2)CrownPOSet(elements_1, elements_2)
elements_1 |
A list of character strings. |
elements_2 |
A list of character strings. |
Let and be two disjoint collections of elements.
The "crown" over them is the poset having
as ground set and where , , and ,
for each ( stands for "incomparable to").
A crown, an object of S4 class 'POSet'.
elems1<-c("a1", "a2", "a3", "a4", "a5") elems2<-c("b1", "b2", "b3", "b4", "b5") crown<-CrownPOSet(elems1, elems2)elems1<-c("a1", "a2", "a3", "a4", "a5") elems2<-c("b1", "b2", "b3", "b4", "b5") crown<-CrownPOSet(elems1, elems2)
Computes the disjoint sum of the input posets.
DisjointSumPOSet(poset1, poset2, ...)DisjointSumPOSet(poset1, poset2, ...)
poset1 |
An object of S4 class 'POSet'. Argument 'poset1' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
poset2 |
An object of S4 class 'POSet'. Argument 'poset2' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
... |
Optional additional objects of S4 class 'POSet'. Optional arguments must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
Let be
posets on disjoint ground sets.
Their disjoint sum is the poset having as ground
set the union of the input ground sets, with if
and only if and for some .
The disjoint sum poset, an object of S4 class 'POSet'.
elems1 <- c("a", "b", "c", "d") elems2 <- c("e", "f", "g", "h") dom1 <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) dom2 <- matrix(c( "e", "f", "g", "h", "h", "f" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = elems1, dom = dom1) pos2 <- POSet(elements = elems2, dom = dom2) dsj.sum <- DisjointSumPOSet(pos1, pos2)elems1 <- c("a", "b", "c", "d") elems2 <- c("e", "f", "g", "h") dom1 <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) dom2 <- matrix(c( "e", "f", "g", "h", "h", "f" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = elems1, dom = dom1) pos2 <- POSet(elements = elems2, dom = dom2) dsj.sum <- DisjointSumPOSet(pos1, pos2)
Computes the dominance matrix of the input poset.
DominanceMatrix(poset)DominanceMatrix(poset)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
An boolean matrix , where is the number of poset elements, with ,
if and only if the j-th poset element weakly dominates () the i-th element, in the input order relation.
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) Z <- DominanceMatrix(pos)elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) Z <- DominanceMatrix(pos)
Given two elements and of , checks whether in poset .
Dominates(poset, element1, element2)Dominates(poset, element1, element2)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
element1 |
A character string (the name of a poset element). |
element2 |
A character string (the name of a poset element). |
A boolean value.
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- Dominates(pos, "a", "d")elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- Dominates(pos, "a", "d")
Computes the downset of a set of elements of the input poset.
DownsetOf(poset, elements)DownsetOf(poset, elements)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
elements |
A vector of character strings (the names of the input elements). |
A vector of character strings (the names of the elements of the downset).
elems<- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "a", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) dwn <- DownsetOf(pos, c("b","d"))elems<- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "a", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) dwn <- DownsetOf(pos, c("b","d"))
Computes the dual of the input poset.
DualPOSet(poset)DualPOSet(poset)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
Let be a poset. Then its dual is defined
by if and only if in .
In other words, the dual of is obtained by reversing its dominances.
The dual of the input poset, an object of S4 class 'POSet'.
elems <- c("a", "b", "c", "d") doms <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = elems, dom = doms) dual <- DualPOSet(pos1)elems <- c("a", "b", "c", "d") doms <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = elems, dom = doms) dual <- DualPOSet(pos1)
'ExactEvaluation' computes the mean values of the input functions (defined on linear orders) over the set of linear extensions of the input poset. The linear extensions are generated according to the algorithm given in Habib M, Medina R, Nourine L and Steiner G (2001).
ExactEvaluation(poset, output_every_sec = NULL, f1, ...)ExactEvaluation(poset, output_every_sec = NULL, f1, ...)
poset |
An object of S4 class 'POSet' representing the poset from which linear extensions are generated. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
output_every_sec |
integer specifying a time interval (in seconds). By specifying this argument, during the execution of 'BubleyDyerEvaluation', the number of linear extensions progressively generated is printed on the R-Console, every 'output_every_sec'seconds. |
f1 |
the function whose average value has to be computed. 'f1' can be an R-function having as a single argument a linear extension of 'poset' and returning a numerical matrix. |
... |
Further functions whose averages are to be computed. |
A list of the computed averages, along with the number of linear extensions generated to compute them.
Habib M, Medina R, Nourine L and Steiner G (2001). Efficient algorithms on distributive lattices. Discrete Applied Mathematics, 110, 169-187. https://doi.org/10.1016/S0166-218X(00)00258-4.
el1 <- c("a", "b", "c", "d") el2 <- c("x", "y") el3 <- c("h", "k") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = el1, dom = dom) pos2 <- LinearPOSet(elements = el2) pos3 <- LinearPOSet(elements = el3) pos <- ProductPOSet(pos1, pos2, pos3) # median_distr computes the frequency distribution of median profile elements <- POSetElements(pos) median_distr <- function(le) { n <- length(elements) if (n %% 2 != 0) { res <- (elements == le[(n + 1) / 2]) } else { res <- (elements == le[n / 2]) } res <- as.matrix(res) rownames(res) <- elements colnames(res) <- "median_distr" return (as.matrix(res)) } res <- ExactEvaluation(pos, output_every_sec=1, median_distr)el1 <- c("a", "b", "c", "d") el2 <- c("x", "y") el3 <- c("h", "k") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = el1, dom = dom) pos2 <- LinearPOSet(elements = el2) pos3 <- LinearPOSet(elements = el3) pos <- ProductPOSet(pos1, pos2, pos3) # median_distr computes the frequency distribution of median profile elements <- POSetElements(pos) median_distr <- function(le) { n <- length(elements) if (n %% 2 != 0) { res <- (elements == le[(n + 1) / 2]) } else { res <- (elements == le[n / 2]) } res <- as.matrix(res) rownames(res) <- elements colnames(res) <- "median_distr" return (as.matrix(res)) } res <- ExactEvaluation(pos, output_every_sec=1, median_distr)
Computes the MRP matrix of a poset. The MRP associated to , with and two elements of the input poset, is the share of linear extensions of it where dominates . The linear extensions are computed according to the algorithm given in Habib M, Medina R, Nourine L and Steiner G (2001).
ExactMRP(poset, output_every_sec = NULL)ExactMRP(poset, output_every_sec = NULL)
poset |
An object of S4 class 'POSet' representing the poset whose MRP are computed. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
output_every_sec |
Integer specifying a time interval (in seconds). By specifying this argument, during the execution of 'ExactMRP' a message reporting the number of linear extensions progressively generated is printed on the R-Console, every 'output_every_sec' seconds. |
A list of two elements: 1) the MRP matrix and 2) the number of linear extensions generated to compute it.
Habib M, Medina R, Nourine L and Steiner G (2001). Efficient algorithms on distributive lattices. Discrete Applied Mathematics, 110, 169-187. https://doi.org/10.1016/S0166-218X(00)00258-4.
el1 <- c("a", "b", "c", "d") el2 <- c("x", "y") el3 <- c("h", "k") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = el1, dom = dom) pos2 <- LinearPOSet(elements = el2) pos3 <- LinearPOSet(elements = el3) pos <- ProductPOSet(pos1, pos2, pos3) MRP <- ExactMRP(pos, output_every_sec=1)el1 <- c("a", "b", "c", "d") el2 <- c("x", "y") el3 <- c("h", "k") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = el1, dom = dom) pos2 <- LinearPOSet(elements = el2) pos3 <- LinearPOSet(elements = el3) pos <- ProductPOSet(pos1, pos2, pos3) MRP <- ExactMRP(pos, output_every_sec=1)
An S4 class to represent the exact MRP generator.
ptran external pointer to C++ data
Computes exact separation matrices by evaluating the average separation over all the linear extensions of the input poset. The linear extensions are generated according to the algorithm given in Habib M, Medina R, Nourine L and Steiner G (2001).
ExactSeparation(poset, output_every_sec = NULL, type, ...)ExactSeparation(poset, output_every_sec = NULL, type, ...)
poset |
Object of S4 class 'POSet' representing the poset whose separation matrix is computed. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
output_every_sec |
Integer specifying a time interval (in seconds). By specifying this argument, during the execution of 'BubleyDyerSeparation', a message reporting the number of linear extensions progressively generated is printed on the R-Console, every 'output_every_sec' seconds. |
type |
type of separation to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper", "vertical", "horizontal". |
... |
additional types of Separations to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper", "vertical", "horizontal". |
The symmetric separation associated to two elements and of the input poset, is the average
absolute difference between the positions of and observed over all linear extensions (whose elements are arranged in ascending order):
,
where is the numbers of linear extensions of the input poset;
represents a single linear extension and stands for the position of element
into the sequence of poset elements arranged in increasing order according to .
Asymmetric lower and upper separations are defined as:
,
,
where means that is lower or equal to in the linear order defined by linear
extension and is the indicator function. Note that .
Vertical and horizontal separations ( and , respectively) are defined as
and #' .
For a detailed explanation on why and can be interpreted as vertical and horizontal components
of the separation between poset elements, see Fattore et. al (2024).
A list containing: 1) the required type of approximated separation matrices, according to the parameter 'type' used to build the 'generator' (see function 'BuildBubleyDyerSeparationGenerator'); 2) the number of generated linear extensions.
Habib M, Medina R, Nourine L and Steiner G (2001). Efficient algorithms on distributive lattices. Discrete Applied Mathematics, 110, 169-187. https://doi.org/10.1016/S0166-218X(00)00258-4.
Fattore, M., De Capitani, L., Avellone, A., and Suardi, A. (2024). A fuzzy posetic toolbox for multi-criteria evaluation on ordinal data systems. Annals of Operations Research, https://doi.org/10.1007/s10479-024-06352-3.
el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) SEP_matrices <- ExactSeparation(pos, output_every_sec=5, "symmetric","asymmetricUpper", "vertical")el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) SEP_matrices <- ExactSeparation(pos, output_every_sec=5, "symmetric","asymmetricUpper", "vertical")
Builds a fence, from an unordered collection of elements.
FencePOSet(elements, orientation = "upFirst")FencePOSet(elements, orientation = "upFirst")
elements |
A list of character strings (the names of the fence elements). |
orientation |
Either "upFirst" (the first element dominates the second) or "downFirst" (the first element is dominated by the second). |
A fence, an object of S4 class 'POSet'.
elems <- c("a", "b", "c", "d", "e") fence <- FencePOSet(elems, orientation="upFirst")elems <- c("a", "b", "c", "d", "e") fence <- FencePOSet(elems, orientation="upFirst")
An S4 class to represent a virtual class for POSet extention.
ptran external pointer to C++ data
Starting from a poset dominance matrix, computes in-betweenness arrays by using a user supplied t-norm and t-conorm.
FuzzyInBetweenness(dom, norm, conorm, type, ...)FuzzyInBetweenness(dom, norm, conorm, type, ...)
dom |
square matrix representing the dominance degree between pairs of poset elements. Columns and rows names of 'dom' are interpreted as the labels of the poset elements. 'dom' can be computed by using functions such as 'BLSDominance', 'BubleyByesMRP' and 'ExactMRP'. |
norm |
R-function defining the t-norm |
conorm |
R-function defining the t-conorm |
type |
type of in-betweenness to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper". For details on the definition of symmetric and asymmetric in-betweenness see Fattore et al. (2024). |
... |
additional types of in-betweenness to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper". |
a list of three-dimensional arrays, one array for each type of in-betweenness selected by parameter 'type'.
The array element of position represents for symmetric in-betweenness,
for asymmetricLower in-betweenness, and for asymmetricUpper in-betweenness.
Fattore, M., De Capitani, L., Avellone, A., and Suardi, A. (2024). A fuzzy posetic toolbox for multi-criteria evaluation on ordinal data systems. Annals of Operations Research, https://doi.org/10.1007/s10479-024-06352-3.
el <- c("a", "b", "c", "d") dom_list <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom_list) BLS <- BLSDominance(pos) tnorm <- function(x,y){x*y} tconorm <- function(x,y){x+y-x*y} FinB <- FuzzyInBetweenness(BLS, norm=tnorm, conorm=tconorm, type="symmetric", "asymmetricLower")el <- c("a", "b", "c", "d") dom_list <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom_list) BLS <- BLSDominance(pos) tnorm <- function(x,y){x*y} tconorm <- function(x,y){x+y-x*y} FinB <- FuzzyInBetweenness(BLS, norm=tnorm, conorm=tconorm, type="symmetric", "asymmetricLower")
Starting from a poset dominance matrix, computes in-betweenness arrays by using minimum t-norm and maximum t-conorm.
FuzzyInBetweennessMinMax(dom, type, ...)FuzzyInBetweennessMinMax(dom, type, ...)
dom |
square matrix representing the dominance degree between pairs of poset elements. Columns and rows names of 'dom' are interpreted as the labels of poset elements. 'dom' can be computed by using functions such as 'BLSDominance', 'BubleyByesMRP' and 'ExactMRP'. |
type |
type of in-betweenness to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper". For details on the definition of symmetric and asymmetric in-betweenness see Fattore et al. (2024). |
... |
additional types of in-betweenness to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper". |
a list of three-dimensional arrays, one array for each type of in-betweenness selected by parameter 'type'.
The array element of position represents for symmetric in-betweenness,
for asymmetricLower in-betweenness, and for asymmetricUpper in-betweenness.
Fattore, M., De Capitani, L., Avellone, A., and Suardi, A. (2024). A fuzzy posetic toolbox for multi-criteria evaluation on ordinal data systems. Annals of Operations Research, https://doi.org/10.1007/s10479-024-06352-3.
el <- c("a", "b", "c", "d") dom_list <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom_list) BLS <- BLSDominance(pos) FinB <- FuzzyInBetweennessMinMax(BLS, type="symmetric", "asymmetricLower")el <- c("a", "b", "c", "d") dom_list <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom_list) BLS <- BLSDominance(pos) FinB <- FuzzyInBetweennessMinMax(BLS, type="symmetric", "asymmetricLower")
Starting from a poset dominance matrix, computes in-betweenness arrays by using Product t-norm and Probabilistic-sum t-conorm
FuzzyInBetweennessProbabilistic(dom, type, ...)FuzzyInBetweennessProbabilistic(dom, type, ...)
dom |
square matrix representing the dominance degree between pairs of poset elements. Columns and rows names of 'dom' are interpreted as the labels of the poset elements. 'dom' can be computed by using functions such as 'BLSDominance', 'BubleyByesMRP' and 'ExactMRP'. |
type |
type of in-betweenness to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper". For details on the definition of symmetric and asymmetric in-betweenness see Fattore et al. (2024). |
... |
additional types of in-betweenness to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper". |
a list of three-dimensional arrays, one array for each type of in-betweenness selected by parameter 'type'.
The array element of position represents for symmetric in-betweenness,
for asymmetricLower in-betweenness, and for asymmetricUpper in-betweenness.
Fattore, M., De Capitani, L., Avellone, A., and Suardi, A. (2024). A fuzzy posetic toolbox for multi-criteria evaluation on ordinal data systems. Annals of Operations Research, https://doi.org/10.1007/s10479-024-06352-3.
el <- c("a", "b", "c", "d") dom_list <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom_list) BLS <- BLSDominance(pos) FinB <- FuzzyInBetweennessProbabilistic(BLS, type="symmetric", "asymmetricLower")el <- c("a", "b", "c", "d") dom_list <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom_list) BLS <- BLSDominance(pos) FinB <- FuzzyInBetweennessProbabilistic(BLS, type="symmetric", "asymmetricLower")
Starting from a poset dominance matrix, computes fuzzy separation matrices by using the t-norm and t-conorm supplied by the user.
FuzzySeparation(dom, norm, conorm, type, ...)FuzzySeparation(dom, norm, conorm, type, ...)
dom |
square matrix representing the dominance degree between pairs of poset elements. Columns and rows names of 'dom' are interpreted as the labels of the poset elements. 'dom' can be computed by using functions such as 'BLSDominance', 'BubleyByesMRP' and 'ExactMRP'. |
norm |
R-function defining the t-norm |
conorm |
R-function defining the t-conorm |
type |
type of fuzzy Separation to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper", "vertical", "horizontal". For details on the definition of symmetric, asymmetric, vertical and horizontal separations see Fattore et al. (2024). |
... |
additional types of fuzzy separations to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper", "vertical", "horizontal". |
list of required fuzzy separation matrices.
Fattore, M., De Capitani, L., Avellone, A., and Suardi, A. (2024). A fuzzy posetic toolbox for multi-criteria evaluation on ordinal data systems. Annals of Operations Research, https://doi.org/10.1007/s10479-024-06352-3.
el <- c("a", "b", "c", "d") dom_list <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom_list) BLS <- BLSDominance(pos) tnorm <- function(x,y){x*y} tconorm <- function(x,y){x+y-x*y} FSep <- FuzzySeparation(BLS, norm=tnorm, conorm=tconorm, type="symmetric", "asymmetricLower", "vertical")el <- c("a", "b", "c", "d") dom_list <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom_list) BLS <- BLSDominance(pos) tnorm <- function(x,y){x*y} tconorm <- function(x,y){x+y-x*y} FSep <- FuzzySeparation(BLS, norm=tnorm, conorm=tconorm, type="symmetric", "asymmetricLower", "vertical")
Starting from a poset dominance matrix, computes fuzzy Separation matrices by using minimum t-norm and maximum t-conorm.
FuzzySeparationMinMax(dom, type, ...)FuzzySeparationMinMax(dom, type, ...)
dom |
square matrix representing the dominance degree between pairs of poset elements. Columns and rows names of 'dom' are interpreted as the labels of the poset elements. 'dom' can be computed by using functions such as 'BLSDominance', 'BubleyByesMRP' and 'ExactMRP'. |
type |
type of fuzzy separation to be computed. Possible Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper", "vertical", "horizontal". For details on the definition of symmetric, asymmetric, vertical and horizontal separations see Fattore et al. (2024). |
... |
additional types of fuzzy separations to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper", "vertical", "horizontal". |
list of required fuzzy separation matrices.
Fattore, M., De Capitani, L., Avellone, A., and Suardi, A. (2024). A fuzzy posetic toolbox for multi-criteria evaluation on ordinal data systems. Annals of Operations Research, https://doi.org/10.1007/s10479-024-06352-3.
el <- c("a", "b", "c", "d") dom_list <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom_list) BLS <- BLSDominance(pos) FSep <- FuzzySeparationMinMax(BLS, type="symmetric", "asymmetricLower", "vertical")el <- c("a", "b", "c", "d") dom_list <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom_list) BLS <- BLSDominance(pos) FSep <- FuzzySeparationMinMax(BLS, type="symmetric", "asymmetricLower", "vertical")
Starting from a poset dominance matrix, computes fuzzy Separation matrices by using Product t-norm and Probabilistic-sum t-conorm
FuzzySeparationProbabilistic(dom, type, ...)FuzzySeparationProbabilistic(dom, type, ...)
dom |
square matrix representing the dominance degrees between pairs of poset elements. Columns and rows names of 'dom' are interpreted as the labels of the poset elements. 'dom' can be computed by using functions such as 'BLSDominance', 'BubleyByesMRP' and 'ExactMRP'. |
type |
type of fuzzy separation to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper", "vertical", "horizontal". For details on the definition of symmetric, asymmetric, vertical and horizontal separations see Fattore et al. (2024). |
... |
additional types of fuzzy separations to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper", "vertical", "horizontal". |
list of required fuzzy separation matrices.
Fattore, M., De Capitani, L., Avellone, A., and Suardi, A. (2024). A fuzzy posetic toolbox for multi-criteria evaluation on ordinal data systems. Annals of Operations Research, https://doi.org/10.1007/s10479-024-06352-3.
el <- c("a", "b", "c", "d") dom_list <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom_list) BLS <- BLSDominance(pos) FSep <- FuzzySeparationProbabilistic(BLS, type="symmetric", "asymmetricLower", "vertical")el <- c("a", "b", "c", "d") dom_list <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom_list) BLS <- BLSDominance(pos) FSep <- FuzzySeparationProbabilistic(BLS, type="symmetric", "asymmetricLower", "vertical")
Computes the incomparability relation of the input poset.
IncomparabilityRelation(poset)IncomparabilityRelation(poset)
poset |
An object of S4 class POSet. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
A two-column matrix (element is incomparable with element ).
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) M <- IncomparabilityRelation(pos)elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) M <- IncomparabilityRelation(pos)
Extracts the elements incomparable with the input element, in the poset.
IncomparabilitySetOf(poset, element)IncomparabilitySetOf(poset, element)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
element |
A character string (the names of a single poset element). |
A vector of character strings (the names of the poset elements incomparable with the input element).
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) incmp <- IncomparabilitySetOf(pos, "a")elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) incmp <- IncomparabilitySetOf(pos, "a")
Computes the poset .
IntersectionPOSet(poset1, poset2, ...)IntersectionPOSet(poset1, poset2, ...)
poset1 |
An object of S4 class 'POSet'. Argument 'poset1' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
poset2 |
An object of S4 class 'POSet'. Argument 'poset2' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
... |
Optional additional objects of S4 class 'POSet'. Optional arguments must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
Let be posets on the same set .
The intersection poset is the poset where
if and only if for all .
The intersection poset, an object of S4 class 'POSet'.
elems <- c("a", "b", "c", "d") dom1 <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) dom2 <- matrix(c( "a", "b", "b", "c", "b", "d" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = elems, dom = dom1) pos2 <- POSet(elements = elems, dom = dom2) pos_int <- IntersectionPOSet(pos1, pos2)elems <- c("a", "b", "c", "d") dom1 <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) dom2 <- matrix(c( "a", "b", "b", "c", "b", "d" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = elems, dom = dom1) pos2 <- POSet(elements = elems, dom = dom2) pos_int <- IntersectionPOSet(pos1, pos2)
Checks whether the input binary relation is antisymmetric.
IsAntisymmetric(rel)IsAntisymmetric(rel)
rel |
A two-columns character matrix, each row comprising an element (pair) of the binary relation, |
A boolean value.
rel <- matrix(c( "a", "b", "c", "b", "b", "d", "a", "a" ), ncol = 2, byrow = TRUE) chk <- IsAntisymmetric(rel)rel <- matrix(c( "a", "b", "c", "b", "b", "d", "a", "a" ), ncol = 2, byrow = TRUE) chk <- IsAntisymmetric(rel)
Checks whether two elements and of are comparable in the input poset .
IsComparableWith(poset, element1, element2)IsComparableWith(poset, element1, element2)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
element1 |
A character string (the name of a poset element). |
element2 |
A character string (the name of a poset element). |
A boolean value.
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- IsComparableWith(pos, "a", "d")elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- IsComparableWith(pos, "a", "d")
Given two elements and of , checks whether in poset .
IsDominatedBy(poset, element1, element2)IsDominatedBy(poset, element1, element2)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
element1 |
A character string (the name of a poset element). |
element2 |
A character string (the name of a poset element). |
A boolean value.
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- IsDominatedBy(pos, "a", "d")elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- IsDominatedBy(pos, "a", "d")
Checks whether the input elements form a downset, in the input poset.
IsDownset(poset, elements)IsDownset(poset, elements)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
elements |
A vector of character strings (the names of the input) elements). |
A boolean value.
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- IsDownset(pos, c("a", "b", "c"))elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- IsDownset(pos, c("a", "b", "c"))
Checks whether poset1 is an extension of poset2.
IsExtensionOf(poset1, poset2)IsExtensionOf(poset1, poset2)
poset1 |
An object of S4 class 'POSet'. Argument 'poset1' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
poset2 |
An object of S4 class 'POSet'. Argument 'poset2' must be created by using any function contained in the package aimed at building object of S4cl ass 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
A boolean value.
elems <- c("a", "b", "c", "d") dom1 <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) dom2 <- matrix(c( "a", "b", "c", "b", "b", "d", "a", "c" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = elems, dom = dom1) pos2 <- POSet(elements = elems, dom = dom2) chk <- IsExtensionOf(pos1, pos2)elems <- c("a", "b", "c", "d") dom1 <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) dom2 <- matrix(c( "a", "b", "c", "b", "b", "d", "a", "c" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = elems, dom = dom1) pos2 <- POSet(elements = elems, dom = dom2) chk <- IsExtensionOf(pos1, pos2)
Checks whether two elements and of are incomparable, in the input poset .
IsIncomparableWith(poset, element1, element2)IsIncomparableWith(poset, element1, element2)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
element1 |
A character string (the name of a poset element). |
element2 |
A character string (the name of a poset element). |
A boolean value.
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- IsIncomparableWith(pos, "a", "d")elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- IsIncomparableWith(pos, "a", "d")
Checks whether the input element is maximal in the input poset.
IsMaximal(poset, element)IsMaximal(poset, element)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
element |
A character string (the name of the input element). |
A boolean value.
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk<-IsMaximal(pos, "b")elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk<-IsMaximal(pos, "b")
Checks whether the input element is minimal in the input poset.
IsMinimal(poset, element)IsMinimal(poset, element)
poset |
An object of S4-class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
element |
A character string (the name of the input element). |
A boolean value.
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- IsMinimal(pos, "a")elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- IsMinimal(pos, "a")
Checks whether the input binary relation is a partial order.
IsPartialOrder(set, rel)IsPartialOrder(set, rel)
set |
A list of character strings (the names of the elements of the set, on which the binary relation is defined). |
rel |
A two-columns character matrix, each row comprising an element (pair) of the binary relation. |
A boolean value.
set<-c("a", "b", "c", "d") rel <- matrix(c( "a", "b", "c", "b", "d", "a", "c", "a", "d", "b", "a", "a", "b", "b", "c", "c", "d", "d" ), ncol = 2, byrow = TRUE) chk <- IsPartialOrder(set, rel)set<-c("a", "b", "c", "d") rel <- matrix(c( "a", "b", "c", "b", "d", "a", "c", "a", "d", "b", "a", "a", "b", "b", "c", "c", "d", "d" ), ncol = 2, byrow = TRUE) chk <- IsPartialOrder(set, rel)
Checks whether the input relation is a pre-order (aka, a quasi-order), i.e. if it is reflexive and transitive.
IsPreorder(set, rel)IsPreorder(set, rel)
set |
A list of character strings (the names of the elements of the set, on which the binary relation is defined). |
rel |
A two-columns character matrix, each row comprising an element (pair) of the binary relation. |
A boolean value.
set<-c("a", "b", "c", "d") rel <- matrix(c( "a", "b", "c", "b", "b", "a", "d", "a", "c", "a", "d", "b", "a", "a", "b", "b", "c", "c", "d", "d" ), ncol = 2, byrow = TRUE) chk<-IsPreorder(set, rel)set<-c("a", "b", "c", "d") rel <- matrix(c( "a", "b", "c", "b", "b", "a", "d", "a", "c", "a", "d", "b", "a", "a", "b", "b", "c", "c", "d", "d" ), ncol = 2, byrow = TRUE) chk<-IsPreorder(set, rel)
Checks whether the input binary relation is reflexive.
IsReflexive(set, rel)IsReflexive(set, rel)
set |
A list of strings (the names of the elements of the set, on which the binary relation is defined). |
rel |
A two-columns character matrix, each row comprising an element (pair) of the binary relation. |
A boolean value.
set<-c("a", "b", "c", "d", "e") rel <- matrix(c( "a", "b", "c", "b", "b", "d", "a", "a", "b", "b", "c", "c" ), ncol = 2, byrow = TRUE) chk <- IsReflexive(set, rel)set<-c("a", "b", "c", "d", "e") rel <- matrix(c( "a", "b", "c", "b", "b", "d", "a", "a", "b", "b", "c", "c" ), ncol = 2, byrow = TRUE) chk <- IsReflexive(set, rel)
Checks whether the input binary relation is symmetric.
IsSymmetric(rel)IsSymmetric(rel)
rel |
A two-columns character matrix, each row comprising an element (pair) of the binary relation. |
A boolean value.
rel <- matrix(c( "a", "b", "c", "b", "b", "d", "b", "a", "b", "c", "d", "b" ), ncol = 2, byrow = TRUE) chk<-isSymmetric(rel)rel <- matrix(c( "a", "b", "c", "b", "b", "d", "b", "a", "b", "c", "d", "b" ), ncol = 2, byrow = TRUE) chk<-isSymmetric(rel)
Checks whether the input relation is transitive.
IsTransitive(rel)IsTransitive(rel)
rel |
A two-columns character matrix, each row comprising an element (pair) of the binary relation. |
A boolean value.
rel <- matrix(c( "a", "b", "c", "b", "b", "d", "a", "d", "c", "d" ), ncol = 2, byrow = TRUE) chk<-IsTransitive(rel)rel <- matrix(c( "a", "b", "c", "b", "b", "d", "a", "d", "c", "d" ), ncol = 2, byrow = TRUE) chk<-IsTransitive(rel)
Checks whether the input elements form an upset, in the input poset.
IsUpset(poset, elements)IsUpset(poset, elements)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
elements |
A vector of character strings (the names of the input elements). |
A boolean value.
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- IsUpset(pos, c("a", "b", "c"))elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) chk <- IsUpset(pos, c("a", "b", "c"))
Creates an object of S4 class 'LEBubleyDyer', needed to sample the linear extensions of a given poset according to the Bubley-Dyer procedure. Actually, this function does not sample the linear extensions, but just generates the object that will sample them by using function 'LEGet'.
LEBubleyDyer(poset, seed = NULL)LEBubleyDyer(poset, seed = NULL)
poset |
An object of S4 class 'POSet' representing the poset whose linear extensions are generated. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
seed |
Positive integer to initialize the random linear extension generation. |
An object of class 'LEBubleyDyer'.
el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) LEgenBD <- LEBubleyDyer(pos)el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) LEgenBD <- LEBubleyDyer(pos)
Creates an object of S4 class 'LEGenerator' to generate all of the linear extensions of a given poset. Actually, this function does not generate the linear extensions, but just the object that will generate them by using function 'LEGet'.
LEGenerator(poset)LEGenerator(poset)
poset |
An object of S4 class 'POSet' representing the poset whose linear extensions are generated. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
An S4 class object 'LEGenerator'.
el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) LEgen <- LEGenerator(pos)el <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) LEgen <- LEGenerator(pos)
An S4 class to represent the exact linear extension generator.
ptran external pointer to C++ data
Generates the linear extensions of a poset, by using a linear extension generator built by functions 'LEGenerator' and 'LEBubleyDyer'.
LEGet( generator, from_start = TRUE, n = NULL, error = NULL, output_every_sec = NULL )LEGet( generator, from_start = TRUE, n = NULL, error = NULL, output_every_sec = NULL )
generator |
The linear extension generator built by function [LEGenerator()] or [LEBubleyDyer()]. If 'LEGenerator' is used, 'n' linear extensions of the poset are generated, according to a deterministic generation order, consistent with the algorithm given in Habib M, Medina R, Nourine L and Steiner G (2001). If 'LEBubleyDyer' is used, the proper number of linear extensions is randomly sampled by using the Bubley and Dyer (1999) procedure, based on parameter 'n' and 'error'. |
from_start |
Logical value indicating whether the linear extensions generator should be reset or not. If 'from_start=FALSE', linear extensions generation starts from the last linear extension generated in the previous 'LEGet' call. If 'from_start=TRUE', previous 'LEGet' calls do not impact on the new linear extensions generation. In more details, when 'generator' is created via [LEGenerator()], linear extensions are built after a deterministic rule that fixes the generation order. In this case, if 'from_start=TRUE' the generation starts from the first linear extension in the generation order; if 'from_start=FALSE', the first linear extension generated is the successor, in the prefixed generation order, to the last one generated by the previous 'LEGet' call. This allows the user to generate the set of all linear extensions of a poset in subsequent 'LEGet' calls, so as to keep control on computational times and memory space. When 'generator' is created via [LEBubleyDyer()], linear extensions are generated according
to the Bubley-Dyer sampling procedure that, starting from a randomly generated linear extension,
produces a sequence of linear orders in which the |
n |
number of linear extensions to be generated. |
error |
A real number in the interval
If both arguments 'n' and 'error' are specified by the user, the number of linear extensions actually generated is 'n'. |
output_every_sec |
integer specifying a time interval (in seconds). By specifying this argument, during the execution of 'LEGet', the number of linear extensions actually generated is printed on the R-Console, every 'output_every_sec'seconds. |
A matrix whose columns reports the generated linear extensions
Bubley, R., Dyer, M. (1999). Faster random generation of linear extensions. Discrete Mathematics, 201, 81-88. https://doi.org/10.1016/S0012-365X(98)00333-1
Habib M, Medina R, Nourine L and Steiner G (2001). Efficient algorithms on distributive lattices. Discrete Applied Mathematics, 110, 169-187. https://doi.org/10.1016/S0166-218X(00)00258-4.
el <- c("a", "b", "c", "d", "e") dom <- matrix(c( "a", "b", "c", "b", "c", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) LEgen <- LEGenerator(pos) LEmatrix <- LEGet(LEgen) LEgen <- LEGenerator(pos) LEmatrix_first <- LEGet(LEgen, n=10) LEmatrix_second <- LEGet(LEgen, from_start=FALSE) LEmatrix <- cbind(LEmatrix_first,LEmatrix_second) #Randomly generate n=30 linear extensions from the poset LEgen <- LEBubleyDyer(pos) LEmatrix <- LEGet(LEgen, n=30) #Randomly generate n=60 linear extensions from the poset in two steps LEgen <- LEBubleyDyer(pos) LEmatrix_first <- LEGet(LEgen, n=30) LEmatrix_second <- LEGet(LEgen, n=30, from_start=FALSE) LEmatrix <- cbind(LEmatrix_first,LEmatrix_second) #Generates linear extensions from the poset with precision=1 LEgen <- LEBubleyDyer(pos) LEmatrix <- LEGet(LEgen, error=0.002)el <- c("a", "b", "c", "d", "e") dom <- matrix(c( "a", "b", "c", "b", "c", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = el, dom = dom) LEgen <- LEGenerator(pos) LEmatrix <- LEGet(LEgen) LEgen <- LEGenerator(pos) LEmatrix_first <- LEGet(LEgen, n=10) LEmatrix_second <- LEGet(LEgen, from_start=FALSE) LEmatrix <- cbind(LEmatrix_first,LEmatrix_second) #Randomly generate n=30 linear extensions from the poset LEgen <- LEBubleyDyer(pos) LEmatrix <- LEGet(LEgen, n=30) #Randomly generate n=60 linear extensions from the poset in two steps LEgen <- LEBubleyDyer(pos) LEmatrix_first <- LEGet(LEgen, n=30) LEmatrix_second <- LEGet(LEgen, n=30, from_start=FALSE) LEmatrix <- cbind(LEmatrix_first,LEmatrix_second) #Generates linear extensions from the poset with precision=1 LEgen <- LEBubleyDyer(pos) LEmatrix <- LEGet(LEgen, error=0.002)
Computes the lexicographic product order of the input partial orders.
LexicographicProductPOSet(poset1, poset2, ...)LexicographicProductPOSet(poset1, poset2, ...)
poset1 |
An object of S4 class 'POSet'. Argument 'poset1' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
poset2 |
An object of S4 class 'POSet'. Argument 'poset2' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
... |
Optional additional objects of S4 class 'POSet'. Optional arguments must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
Let be posets.
The lexicographic product poset has ground
set the Cartesian product of the input ground sets, with
if and only ,
or there exists such that for and .
The lexicographic product poset, an object of S4 class 'POSet'.
elems1 <- c("a", "b", "c", "d", "e") elems2 <- c("f", "g", "h") dom1 <- matrix(c( "a", "b", "c", "b", "d", "b" ), ncol = 2, byrow = TRUE) dom2 <- matrix(c( "g", "f", "h", "f" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = elems1, dom = dom1) pos2 <- POSet(elements = elems2, dom = dom2) #Lexicographic product of pos1 and pos2 lex.prod <- LexicographicProductPOSet(pos1, pos2)elems1 <- c("a", "b", "c", "d", "e") elems2 <- c("f", "g", "h") dom1 <- matrix(c( "a", "b", "c", "b", "d", "b" ), ncol = 2, byrow = TRUE) dom2 <- matrix(c( "g", "f", "h", "f" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = elems1, dom = dom1) pos2 <- POSet(elements = elems2, dom = dom2) #Lexicographic product of pos1 and pos2 lex.prod <- LexicographicProductPOSet(pos1, pos2)
An S4 class to represent a Lexicographic Product POSet.
ptran external pointer to C++ data
Considering the component-wise poset built stating from ordinal variables,
computes MRP matrix by analyzing all poset lexicographic linear extensions.
LexMRP(nvar, deg)LexMRP(nvar, deg)
nvar |
positive integer specifying the number |
deg |
parameter specifying the number of degrees of each variable. If all If the |
the MRP matrix computed over the set of lexicographic linear extensions.
#variables with common number of degrees # default labels for variable degrees nvar <- 3 deg <- 4 lMRP <- LexMRP(nvar=nvar, deg=deg) #user supplied variable degree labels nvar <- 3 deg <- c("a","b","c","d") lMRP <- LexMRP(nvar=nvar, deg=deg) #variables with different numbers of degrees # default labels for variable degrees nvar <- 3 deg <- c(4,2,3) lMRP <- LexMRP(nvar=nvar, deg=deg) #user supplied variable degree labels nvar <- 3 deg <- list(c("a","b","c","d"),c("0","1"),c("x","y","z")) lMRP <- LexMRP(nvar=nvar, deg=deg)#variables with common number of degrees # default labels for variable degrees nvar <- 3 deg <- 4 lMRP <- LexMRP(nvar=nvar, deg=deg) #user supplied variable degree labels nvar <- 3 deg <- c("a","b","c","d") lMRP <- LexMRP(nvar=nvar, deg=deg) #variables with different numbers of degrees # default labels for variable degrees nvar <- 3 deg <- c(4,2,3) lMRP <- LexMRP(nvar=nvar, deg=deg) #user supplied variable degree labels nvar <- 3 deg <- list(c("a","b","c","d"),c("0","1"),c("x","y","z")) lMRP <- LexMRP(nvar=nvar, deg=deg)
Considering the component-wise poset built stating from ordinal variables,
computes separation matrices by analyzing all poset lexicographic linear extensions.
LexSeparation(nvar, deg, type, ...)LexSeparation(nvar, deg, type, ...)
nvar |
positive integer specifying the number |
deg |
parameter specifying the number of degrees of each variable. If all If the |
type |
type of separation matrix to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper", "vertical", "horizontal". |
... |
additional types of separations to be computed. Possible choices are: "symmetric", "asymmetricLower", "asymmetricUpper", "vertical", "horizontal". |
list of required separation matrices.
#variables with common number of degrees # default labels for variable degrees nvar <- 3 deg <- 4 LexSep <- LexSeparation(nvar=nvar, deg=deg, type= "symmetric", "asymmetricLower") #user supplied variable degree labels nvar <- 3 deg <- c("a","b","c","d") LexSep <- LexSeparation(nvar=nvar, deg=deg, type= "symmetric", "asymmetricLower") #variables with different numbers of degrees # default labels for variable degrees nvar <- 3 deg <- c(4,2,3) LexSep <- LexSeparation(nvar=nvar, deg=deg, type= "symmetric", "asymmetricLower") #user supplied variable degree labels nvar <- 3 deg <- list(c("a","b","c","d"),c("0","1"),c("x","y","z")) LexSep <- LexSeparation(nvar=nvar, deg=deg, type= "symmetric", "asymmetricLower")#variables with common number of degrees # default labels for variable degrees nvar <- 3 deg <- 4 LexSep <- LexSeparation(nvar=nvar, deg=deg, type= "symmetric", "asymmetricLower") #user supplied variable degree labels nvar <- 3 deg <- c("a","b","c","d") LexSep <- LexSeparation(nvar=nvar, deg=deg, type= "symmetric", "asymmetricLower") #variables with different numbers of degrees # default labels for variable degrees nvar <- 3 deg <- c(4,2,3) LexSep <- LexSeparation(nvar=nvar, deg=deg, type= "symmetric", "asymmetricLower") #user supplied variable degree labels nvar <- 3 deg <- list(c("a","b","c","d"),c("0","1"),c("x","y","z")) LexSep <- LexSeparation(nvar=nvar, deg=deg, type= "symmetric", "asymmetricLower")
Lifts the input poset, i.e. adds a (possibly new) bottom element to it.
LiftingPOSet(poset, element)LiftingPOSet(poset, element)
poset |
An object of S4 class 'POSet'. Argument 'poset1' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
element |
A character string (the name of the added bottom). |
The lifted poset, an object of S4 class 'POSet'.
elems <- c("a", "b", "c", "d") doms <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = doms) #Lifting lifted.pos <- LiftingPOSet(pos, "bot")elems <- c("a", "b", "c", "d") doms <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = doms) #Lifting lifted.pos <- LiftingPOSet(pos, "bot")
Constructs a linearly (or completely, or totally) ordered set (V,, starting from set ,
LinearPOSet(elements)LinearPOSet(elements)
elements |
A character string vector containing the labels of the elements of |
An object of S4 class 'LinearPOSet' (subclass of 'POSet')
elems <- c("a", "b", "c", "d") linpos <- LinearPOSet(elements = elems)elems <- c("a", "b", "c", "d") linpos <- LinearPOSet(elements = elems)
An S4 class to represent a Linear POSet.
ptran external pointer to C++ data
Computes the linear sum of the input posets.
LinearSumPOSet(poset1, poset2, ...)LinearSumPOSet(poset1, poset2, ...)
poset1 |
An object of S4 class 'POSet'. Argument 'poset1' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
poset2 |
An object of S4 class 'POSet'. Argument 'poset2' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
... |
Optional additional objects of S4 class 'POSet'. Optional arguments must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
Let be posets on disjoint ground sets.
Their linear sum is the poset having as ground set the union of the input ground sets,
with if and only if for some , or and ,
with . In other words, the linear sum is obtained by stacking the input posets from bottom,
and making all of the minimal elements of covering all of the maximal elements of ().
The linear sum poset, an object of S4 class 'POSet'.
elems1 <- c("a", "b", "c", "d") elems2 <- c("e", "f", "g", "h") dom1 <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) dom2 <- matrix(c( "e", "f", "g", "h", "h", "f" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = elems1, dom = dom1) pos2 <- POSet(elements = elems2, dom = dom2) #Linear sum of pos1 and pos2 lin.sum <- LinearSumPOSet(pos1, pos2)elems1 <- c("a", "b", "c", "d") elems2 <- c("e", "f", "g", "h") dom1 <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) dom2 <- matrix(c( "e", "f", "g", "h", "h", "f" ), ncol = 2, byrow = TRUE) pos1 <- POSet(elements = elems1, dom = dom1) pos2 <- POSet(elements = elems2, dom = dom2) #Linear sum of pos1 and pos2 lin.sum <- LinearSumPOSet(pos1, pos2)
Starting from a dataset with statistical units, scored against
ordinal 0/1-indicators and partially ordered component-wise into a Boolean lattice ,
it finds the bidimensional data representation that optimally preserves the input order relation.
The algorithm finding the best bidimensional representation is optimized by using a parallel C++ implementation.
OptimalBidimensionalEmbedding( profile, weights, output_every_sec = NULL, thread_share = 1 )OptimalBidimensionalEmbedding( profile, weights, output_every_sec = NULL, thread_share = 1 )
profile |
Boolean matrix of dimension |
weights |
real vector of length |
output_every_sec |
Integer specifying a time interval (in seconds).
By specifying this argument, during the execution of 'OptimalBidimensionalEmbedding', a message reporting the number of reversed pairs
of lexicographic linear extensions analyzed is printed on the R-Console, every 'output_every_sec' seconds. Note that the number
of reversed pairs of lexicographic linear extensions to be analyzed is |
thread_share |
real number in the interval |
a list of 5 elements named 'allLoss', 'variablesPriority', 'bestLossVAlue', 'bestVariablePriority', and 'bestRepresentation'.
'allLoss' is a vector of dimension reporting the value of the loss function
corresponding to the representation induced by each reversed pairs of lexicographic linear extensions. This loss function measures the global errors
made in approximating the order structure of the input Boolean Lattice with its bidimensional representations.
'variablesPriority' is a matrix with rows and columns. Each row is an integer vector of dimension containing a
permutation of .
This vector specifies the criterion to build the reversed pair of lexicographic linear extensions used to
approximate . The first linear extension is built by ordering profiles first according to their
scores on , then to the scores on and so on, until ; the second linear extension
is built by ordering profiles first according to their scores on , then to the scores on and so on, until .
The -th row of 'variablesPriority' identifies the reversed pair of lexicographic linear extensions inducing the bidimensional representation
associated to the -th global loss in 'allLoss'.
'bestLossVAlue' real number indicating the minimum value of the global error among the global errors associated
to the different pairs of reversed lexicographic linear extensions.
'bestVariablePriority' integer vector of dimension containing the permutation of inducing the best bidimensional representation,
i.e. the bidimensional representation with associated global error 'bestLossVAlue'.
'bestRepresentation' a data frame with values (one value for each observed profile) of 5 variables named 'profiles', 'x', 'y', 'weights' and 'error'.
'$profile' is an integer vector containing the base-10 representation of the -dimensional Boolean vectors representing observed profiles.
'$x' is an integer vector containing the x-coordinates of points representing observed profiles in the optimal bidimensional representation.
'$y' is an integer vector containing the y-coordinates of points representing observed profiles in the optimal bidimensional representation.
'$weights' is a real vector with the frequencies/weights of each observed profile.
'$error' is a real vector with the values of the approximation errors associated to each observed profile
in the optimal bidimensional representation.
#SIMULATING OBSERVED BINARY DATA #number of binary variables k <- 6 #building observed profiles matrix profiles <- sapply((0:(2^k-1)) ,function(x){ as.integer(intToBits(x))}) profiles <- t(profiles[1:k, ]) #building the vector of observation frequencies weights <- sample.int(100, nrow(profiles), replace=TRUE) #FINDING THE OPTIMAL BIDIMENSIONAL REPRESENTATION result <- OptimalBidimensionalEmbedding(profiles, weights)#SIMULATING OBSERVED BINARY DATA #number of binary variables k <- 6 #building observed profiles matrix profiles <- sapply((0:(2^k-1)) ,function(x){ as.integer(intToBits(x))}) profiles <- t(profiles[1:k, ]) #building the vector of observation frequencies weights <- sample.int(100, nrow(profiles), replace=TRUE) #FINDING THE OPTIMAL BIDIMENSIONAL REPRESENTATION result <- OptimalBidimensionalEmbedding(profiles, weights)
Extracts the order relation from the input poset.
OrderRelation(poset)OrderRelation(poset)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
A two-column matrix of character strings (element dominates element ).
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) M <- OrderRelation(pos)elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) M <- OrderRelation(pos)
Constructs an object of class 'POSet', representing a partially ordered set (poset) .
POSet(elements, dom = matrix(ncol = 2, nrow = 0))POSet(elements, dom = matrix(ncol = 2, nrow = 0))
elements |
A vector of character strings (the labels of the elements of the ground set |
dom |
Two-columns matrix of element labels, representing the dominances in the order relation
|
An object of S4 class 'POSet', where is the ground set and is the partial order relation on it
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom)elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom)
An S4 class to represent a POSet.
ptran external pointer to C++ data
Gets the elements of the ground set of the input poset .
POSetElements(poset)POSetElements(poset)
poset |
An object of S4 class 'POSet' Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
A vector of labels (the names of the elements of the ground set ).
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) gset <- POSetElements(pos)elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) gset <- POSetElements(pos)
The function computes the join (if existing) of a set of elements, in the input poset.
POSetJoin(poset, elements)POSetJoin(poset, elements)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
elements |
A list of character strings (the names of some poset elements). |
A character string (the name of the join).
elems <- c("a", "b", "c", "d") doms <- matrix(c( "a", "b", "c", "b", "a", "d", "a", "a", "b", "b", "c", "c", "d", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = doms) lub<-POSetJoin(pos, c("a", "c"))elems <- c("a", "b", "c", "d") doms <- matrix(c( "a", "b", "c", "b", "a", "d", "a", "a", "b", "b", "c", "c", "d", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = doms) lub<-POSetJoin(pos, c("a", "c"))
Computes the maximal elements of the input poset, i.e. those elements being strictly dominated by no other elements.
POSetMaximals(poset)POSetMaximals(poset)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
A vector of character strings (the names of the maximal elements).
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b" , "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) mxs <- POSetMaximals(pos)elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b" , "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) mxs <- POSetMaximals(pos)
The function computes the meet (if existing) of a set of elements, in the input poset.
POSetMeet(poset, elements)POSetMeet(poset, elements)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...). |
elements |
A list of character strings (the names of some poset elements). |
A character string (the name of the meet).
elems <- c("a", "b", "c", "d", "e") doms <- matrix(c( "a", "b", "c", "b", "c", "e", "b", "d", "a", "d", "c", "d", "a", "a", "b", "b", "c", "c", "d", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = doms) glb<-POSetMeet(pos, c("b", "e"))elems <- c("a", "b", "c", "d", "e") doms <- matrix(c( "a", "b", "c", "b", "c", "e", "b", "d", "a", "d", "c", "d", "a", "a", "b", "b", "c", "c", "d", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = doms) glb<-POSetMeet(pos, c("b", "e"))
Computes the minimal elements of the input poset, i.e. those elements strictly dominating no other elements.
POSetMinimals(poset)POSetMinimals(poset)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
A vector of character strings (the names of the minimal elements).
elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) mnms <-POSetMinimals(pos)elems <- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) mnms <-POSetMinimals(pos)
Constructs the product poset , starting from a collection of posets.
ProductPOSet(poset1, poset2, ...)ProductPOSet(poset1, poset2, ...)
poset1 |
An object of S4 class 'POSet'. Argument 'poset1' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
poset2 |
An object of S4 class 'POSet'. Argument 'poset2' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
... |
Optional additional objects of S4 class 'POSet'. Optional arguments must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
Let be a collection of posets.
The product poset is the poset where
and given
and , if and only if
for all .
The product poset, an object of S4 class 'ProductPOSet' (subclass of 'POSet').
elems1 <- c("a", "b", "c", "d") elems2 <- c("x", "y", "z") elems3 <- c("q", "r") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) p1 <- POSet(elements = elems1, dom = dom) p2 <- LinearPOSet(elements = elems2) p3 <- LinearPOSet(elements = elems3) prd12 <- ProductPOSet(p1, p2) prd123 <- ProductPOSet(p1, p2, p3)elems1 <- c("a", "b", "c", "d") elems2 <- c("x", "y", "z") elems3 <- c("q", "r") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) p1 <- POSet(elements = elems1, dom = dom) p2 <- LinearPOSet(elements = elems2) p3 <- LinearPOSet(elements = elems3) prd12 <- ProductPOSet(p1, p2) prd123 <- ProductPOSet(p1, p2, p3)
An S4 class to represent a Product POSet.
ptran external pointer to C++ data
Computes the reflexive closure of the input binary relation.
ReflexiveClosure(set, rel)ReflexiveClosure(set, rel)
set |
A list of character strings (the names of the elements of the set, on which the binary relation is defined). |
rel |
A two-columns character matrix, each row comprising an element (pair) of the relation. |
A reflexive binary relation, as a two-columns character matrix (each row comprises an element (pair) of the transitivity closed relation).
set<-c("a", "b", "c", "d", "e") rel <- matrix(c( "a", "b", "c", "b", "d", "a", "c", "a", "a", "a", "d", "d" ), ncol = 2, byrow = TRUE) r.clo<-ReflexiveClosure(set, rel)set<-c("a", "b", "c", "d", "e") rel <- matrix(c( "a", "b", "c", "b", "d", "a", "c", "a", "a", "a", "d", "d" ), ncol = 2, byrow = TRUE) r.clo<-ReflexiveClosure(set, rel)
Computes the transitive closure of the input binary relation.
TransitiveClosure(rel)TransitiveClosure(rel)
rel |
A two-columns character matrix, each row comprising an element (pair) of the binary relation. |
A transitive binary relation, as a two-columns character matrix (each row comprises an element (pair) of the transitivity closed relation).
rel <- matrix(c( "a", "b", "c", "b", "d", "a", "c", "a", "a", "a", "b", "b", "c", "c", "d", "d" ), ncol = 2, byrow = TRUE) t.clo<-TransitiveClosure(rel)rel <- matrix(c( "a", "b", "c", "b", "d", "a", "c", "a", "a", "a", "b", "b", "c", "c", "d", "d" ), ncol = 2, byrow = TRUE) t.clo<-TransitiveClosure(rel)
Computes the upset of a set of elements of the input poset.
UpsetOf(poset, elements)UpsetOf(poset, elements)
poset |
An object of S4 class 'POSet'. Argument 'poset' must be created by using any function contained in the package aimed at building object of S4 class 'POSet' (e.g. [POSet()], [LinearPOSet()], [ProductPOSet()], ...) . |
elements |
a vector of character strings (the names of the input elements). |
A vector of character strings (the names of the poset elements in the upset).
elems<- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) up <- UpsetOf(pos, c("a","c"))elems<- c("a", "b", "c", "d") dom <- matrix(c( "a", "b", "c", "b", "b", "d" ), ncol = 2, byrow = TRUE) pos <- POSet(elements = elems, dom = dom) up <- UpsetOf(pos, c("a","c"))