rm(list=ls())
setwd("/yourpath/codes")

source("./dec2bin.r")
source("./bin2dec.r")
options(warn=-1)

sizeDS <- 3
F1 <- c(1,4,7)
F2 <- c(4,5)
M1 <- c(0.5,0.4,0.1)
M2 <-c(0.4,0.6)

FRes=c()
MRes=c()
for (i in 1:length(F1)){
  for (j in 1:length(F2)){
    FRes <- cbind(FRes,bin2dec(dec2bin(F1[i],sizeDS)&dec2bin(F2[j],sizeDS)))
    MRes <- cbind(MRes, M1[i]*M2[j])
  }
}



source("./DST_fmt_functions.r")

m1 <- c(0,0.4,0.1,0.2,0.2,0,0,0.1)
mtobel(m1)

m1 <- c(0,0.4,0.1,0.2,0.2,0,0,0.1)
m2 <- c(0,0.2,0.3,0.1,0.1,0,0.2,0.1)
q1 <- mtoq(m1)
q2 <- mtoq(m2)
qConj <- q1*q2
mConj<-qtom(qConj)

m1 <- c(0,0.4,0.1,0.2,0.2,0,0,0.1)
m2 <- c(0,0.2,0.3,0.1,0.1,0,0.2,0.1)
b1 <- mtob(m1)
b2 <- mtob(m2)
bDis <- b1*b2
mDis<-btom(bDis)


source("./discounting.r")
source("./DST.r")
m1 <- c(0,0.4,0.1,0.2,0.2,0,0,0.1)
m2 <- c(0,0.2,0.3,0.1,0.1,0,0.2,0.1)
m3 <- c(0.1,0.2,0,0.4,0.1,0.1,0,0.1)
m3d <- discounting(m3,0.95)


M_comb_Smets<-DST(cbind(m1,m2,m3d),1)
M_comb_Conj<-DST(cbind(m1,m2,m3d),2)
M_comb_PCR6 <- DST(cbind(m1,m2),8)

source("./decisionDST.r")
class_fusion <- decisionDST(M_comb_Smets,1)
class_fusion <- decisionDST(M_comb_Conj,4)
class_fusion <- decisionDST(M_comb_Smets,1)





# RandomMass
OmegaSize <- 3
nbFocalElement <- 4
ind <- sample(1:2^OmegaSize)
indFocalElement <- ind[1:nbFocalElement]
randMass <- diff(c(0, sort(runif(nbFocalElement - 1)), 1))

MassOut = matrix(0, 2^OmegaSize)
MassOut[indFocalElement] = randMass
