Commit before first release

This commit is contained in:
2019-04-14 13:39:36 +01:00
parent 1383055d3c
commit ae7af67472
9 changed files with 123 additions and 104 deletions

View File

@@ -8,7 +8,7 @@ modules::import(stats)
#Improvements needed: make the selection of first row/column of nodes programmatic
FIRST_NODE_COL <- 3
mappings <- c("TestScenario", "Map_P_BA", "Map_BA_OP", "Map_OP_ES")
mappings <- c("TestScenario", "Map_P_BA", "Map_BA_OP", "Map_OP_ES", "Legend")
nodeTypes <- c("Input.Nodes", "Internal.Nodes", "Published.Nodes")
states <- c("impact", "confidence", "growth", "recovery", "layer")
refs <- c(1:length(mappings))
@@ -151,9 +151,9 @@ buildGraph <- function(model, desc) {
}
print("about to build network")
print(paste0(inputText, edges))
#print(paste0(inputText, edges))
net <- model2network(paste0(inputText, edges), debug = TRUE)
net <- model2network(paste0(inputText, edges), debug = FALSE)
print("network build successful")
@@ -169,7 +169,7 @@ buildGraph <- function(model, desc) {
cfit <- custom.fit(net, allDists)
cat("about to calculate sample distributions")
print(outNodes)
#print(outNodes)
sampleDists <- cpdist(cfit, nodes = outNodes, evidence = TRUE, n = 10000, method = "lw")
summDists <- summary(sampleDists)
@@ -246,7 +246,7 @@ getValidNodes <- function(mapping, prevOutputs, prefix) {
coefs[idx,] <- as.numeric(split(mapping[1, col]))[match(c("growth", "confidence", "layer"), states)]
}
print(coefs)
#print(coefs)
return(data.frame(
code = c(prevOutputs$code, paste0(prefix, seq(1:length(outNodes)))),
@@ -263,7 +263,7 @@ getCode <- function(name, nodeDF) {
}
getValidEdges <- function(mapping, nodeDF, prevEdge = NULL, prefix) {
utils::str(nodeDF)
#utils::str(nodeDF)
edgeCols <- c("inputNode", "outputNode", "impact")
edgeM <- matrix(data = NA, nrow = 0, ncol = length(edgeCols), dimnames = list(NULL, edgeCols))
@@ -338,7 +338,8 @@ parseSheet <- function(fName) {
p_ba <- parseMapping(readXL(fName,mappings[2], startRow = 1), scenario, prefix = "ba")
p_op <- parseMapping(readXL(fName,mappings[3], startRow = 1), p_ba, prefix = "op")
p_es <- parseMapping(readXL(fName,mappings[4], startRow = 1), p_op, prefix = "es")
legend <- readXL(fName,mappings[5], startRow = 1)
#print("building graphs")
#p_baNet <- buildGraph(p_ba, desc = list(inputCode = "p", outputCodes = "ba"))
@@ -347,12 +348,10 @@ parseSheet <- function(fName) {
print("sheet load completed")
return(
#list(
#pressBioAss = p_baNet,
#pressOpProc = p_opNet,
#pressEcoServ = p_esNet,
p_esMap = p_es
#)
list(
p_esMap = p_es,
legend = legend
)
)
} else {