install.packages("devtools")
library(devtools)
install_github("emiliotorres/preferelation")
Load the package.
library(preferelation)Create a matrix.
set.seed(1234)
R <- crear_matriz_aleatoria(ndimension=5L,valordiagonal=10L)
print(R)
One we have a arbitrary matrix R, we estimate the upper bound of the transitivity, U(R). The transitivity of any solution will be equal or lesser than this limit.
print(R) # Missing data
calcular_cota_maxima_transitividad(R) # Upper bound U(R)The first step is to check out if there is any row or column with no data, except in the diagonal.
R <- sacar_nueva_matriz_sin_columnas_o_filas_perdidas(R,verbose=1L)
RObtain all the solutions. Rows of mpoints are the solutions.
mpoints <- obtener_puntos_optimos(R,combinacionesmaxi=10^7,verbose=3L)
head(mpoints) # Names of the columns are the places of the missing data of RLos nombres de las columnas son los huecos de la matriz R
dim(mpoints) Check out the transitivity of this solutions.
transi <- calcular_transitividad_matriz_puntos(R,mpoints)
table(transi)