Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add param to do out of bounds check for morris #442

Merged
merged 1 commit into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions docker/R/lib/morris.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ print(paste("levels:",levels))
print(paste("r:",r))
print(paste("r2:",r2))
print(paste("grid_jump:",grid_jump))
print(paste("type:",type))
print(paste("type:",type))
print(paste("check_boundary:",check_boundary))

if (r2 > r) {
r <- c(r,r2)
Expand All @@ -152,17 +153,18 @@ m1 <- as.list(data.frame(t(m$X)))
if (debug_messages == 1) {
print(paste("m1:",m1))
}
print("check bounds")
boundary_check <- logical(ncol(vars))
for (i in 1:ncol(vars)){
boundary_check[i] <- all((m$X[,i] <= maxes[i]) && (m$X[,i] >= mins[i]))
}
if(!all(boundary_check)){
print('SOLUTION SPACE OUT OF BOUNDS, CHECK Grid Jump and Level Values and/or re-run')
stop(options("show.error.messages"=TRUE),"SOLUTION SPACE OUT OF BOUNDS, CHECK Grid Jump and Level Values and/or re-run")
}
print("bounds are satisfied, continuing...")

if (check_boundary == 1) {
print("check bounds")
boundary_check <- logical(ncol(vars))
for (i in 1:ncol(vars)){
boundary_check[i] <- all((m$X[,i] <= maxes[i]) && (m$X[,i] >= mins[i]))
}
if(!all(boundary_check)){
print('SOLUTION SPACE OUT OF BOUNDS, CHECK Grid Jump and Level Values and/or re-run')
stop(options("show.error.messages"=TRUE),"SOLUTION SPACE OUT OF BOUNDS, CHECK Grid Jump and Level Values and/or re-run")
}
print("bounds are satisfied, continuing...")
}
try(results <- clusterApplyLB(cl, m1, f),silent=FALSE)
if (debug_messages == 1) {
print(paste("nrow(results):",nrow(results)))
Expand Down
2 changes: 2 additions & 0 deletions server/app/lib/analysis_library/morris.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def initialize(analysis_id, analysis_job_id, options = {})
r2: 20,
levels: 4,
grid_jump: 2,
check_boundary: 0,
type: 'oat',
norm_type: 'minkowski',
p_power: 2,
Expand Down Expand Up @@ -199,6 +200,7 @@ def perform
r2: @analysis.problem['algorithm']['r2'],
type: @analysis.problem['algorithm']['type'],
grid_jump: @analysis.problem['algorithm']['grid_jump'],
check_boundary: @analysis.problem['algorithm']['check_boundary'],
normtype: @analysis.problem['algorithm']['norm_type'],
ppower: @analysis.problem['algorithm']['p_power'],
objfun: @analysis.problem['algorithm']['objective_functions'],
Expand Down