Detailed description |
In frontierPoints current code is:
if(frontier == "upper"){
index = 1:length(ans[, 1])
test = c(-1, diff(ans[, 1]))
index = index[test > 0]
ans = ans[index, ]
} else if(frontier == "lower"){
index = 1:length(ans[, 1])
test = c(-1, diff(ans[, 1]))
index = index[test < 0]
if (length(index) == 1) {
ans = matrix(ans[index, ], ncol = 2)
} else {
ans = ans[index, ]
}
}
This throws an error when there there are no upper points of the frontier
I believe the correct code should be:
if(frontier == "upper"){
index = 1:length(ans[, 1])
test = c(1, diff(ans[, 1]))
index = index[test > 0]
if (length(index) == 1) {
ans = matrix(ans[index, ], ncol = 2)
} else {
ans = ans[index, ]
}
} else if(frontier == "lower"){
index = 1:length(ans[, 1])
test = c(-1, diff(ans[, 1]))
index = index[test < 0]
if (length(index) == 1) {
ans = matrix(ans[index, ], ncol = 2)
} else {
ans = ans[index, ]
}
}
Two problems were fixed.
1) When assigning the test various you had c(-1, diff(ans[, 1])) I changed to c(1, diff(ans[, 1])) (i.e. -1 was wrong)
2) when length == 1 there needed to be logic similar to the lower frontier code
|
|