Running ‘testthat.R’ [5s/6s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(magrittr)
  
  Attaching package: 'magrittr'
  
  The following objects are masked from 'package:testthat':
  
      equals, is_less_than, not
  
  > library(ROI)
  ROI.plugin.symphony: R Optimization Infrastructure
  Registered solver plugins: nlminb, glpk.
  Default solver: auto.
  > library(ROI.plugin.glpk)
  > library(ompr)
  > library(ompr.roi)
  > test_check("ompr.roi")
  ── 1. Error: symphony can solve a model (@test-solver-roi.R#58)  ───────────────
  recursive indexing failed at level 2
  1: add_variable(MIPModel(), x[i], i = 1:3, type = "binary") %>% add_constraint(sum_expr(x[i], 
         i = 1:3) == 1) %>% set_objective(sum_expr(x[i] * weights[i], i = 1:3) + 5) %>% 
         solve_model(with_ROI(solver = "glpk")) at testthat/test-solver-roi.R:58
  2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3: eval(quote(`_fseq`(`_lhs`)), env, env)
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: `_fseq`(`_lhs`)
  6: freduce(value, `_function_list`)
  7: function_list[[i]](value)
  8: set_objective(., sum_expr(x[i] * weights[i], i = 1:3) + 5)
  9: set_objective_(model, expression = lazyeval::as.lazy(substitute(expression), parent.frame()), 
         sense = sense)
  10: set_objective_.optimization_model(model, expression = lazyeval::as.lazy(substitute(expression), 
         parent.frame()), sense = sense)
  11: normalize_expression(model, obj_ast, expression$env)
  12: bind_variables(model, expression, envir)
  13: try_eval_exp_rec(ast, calling_env)
  14: ast_walker(base_ast, on_element)
  15: on_element(push, inplace_update_ast, get_ast_value, element)
  16: inplace_update_ast(path, new_ast_eval)
  
  ── 2. Error: ROI can solve a bin packing problem (@test-solver-roi.R#76)  ──────
  object of type 'symbol' is not subsettable
  1: add_constraint(m, sum_expr(weights[j] * x[i, j], j = 1:n) <= y[i] * bin_size) at testthat/test-solver-roi.R:76
  2: add_constraint_(.model, lazyeval::as.lazy(substitute(.constraint_expr), parent.frame()), 
         .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  3: add_constraint_.optimization_model(.model, lazyeval::as.lazy(substitute(.constraint_expr), 
         parent.frame()), .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  4: add_constraint_internal()
  5: normalize_expression(model, lhs_ast, envir)
  6: bind_variables(model, expression, envir)
  7: try_eval_exp_rec(ast, calling_env)
  8: ast_walker(base_ast, on_element)
  9: on_element(push, inplace_update_ast, get_ast_value, element)
  10: inplace_update_ast(path, new_ast_eval)
  
  ── 3. Error: quantified constraints work (@test-solver-roi.R#95)  ──────────────
  object of type 'symbol' is not subsettable
  1: add_constraint(m, sum_expr(weights[j] * x[i, j], j = 1:n) <= y[i] * bin_size, i = 1:max_bins) at testthat/test-solver-roi.R:95
  2: add_constraint_(.model, lazyeval::as.lazy(substitute(.constraint_expr), parent.frame()), 
         .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  3: add_constraint_.optimization_model(.model, lazyeval::as.lazy(substitute(.constraint_expr), 
         parent.frame()), .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  4: apply(var_combinations, 1, function(row) {
         calling_env <- as.environment(as.list(row))
         parent.env(calling_env) <- parent_env
         constraint <- add_constraint_internal(calling_env)
         if (.show_progress_bar) {
             p$tick()
         }
         constraint
     })
  5: FUN(newX[, i], ...)
  6: add_constraint_internal(calling_env)
  7: normalize_expression(model, lhs_ast, envir)
  8: bind_variables(model, expression, envir)
  9: try_eval_exp_rec(ast, calling_env)
  10: ast_walker(base_ast, on_element)
  11: on_element(push, inplace_update_ast, get_ast_value, element)
  12: inplace_update_ast(path, new_ast_eval)
  
  ── 4. Error: bug 20160704: did not correctly convert constraint (@test-solver-ro
  recursive indexing failed at level 3
  1: MIPModel() %>% add_variable(x[i, j], i = 1:n, j = 1:n, type = "binary") %>% add_variable(u[i], 
         i = 1:n, lb = 1, ub = n) %>% set_objective(0) %>% add_constraint(u[i] + 1 <= 
         u[j] + n * (1 - x[i, j]), i = 1:n, j = 1:n) %>% solve_model(with_ROI(solver = "glpk")) at testthat/test-solver-roi.R:105
  2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3: eval(quote(`_fseq`(`_lhs`)), env, env)
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: `_fseq`(`_lhs`)
  6: freduce(value, `_function_list`)
  7: function_list[[i]](value)
  8: add_constraint(., u[i] + 1 <= u[j] + n * (1 - x[i, j]), i = 1:n, j = 1:n)
  9: add_constraint_(.model, lazyeval::as.lazy(substitute(.constraint_expr), parent.frame()), 
         .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  10: add_constraint_.optimization_model(.model, lazyeval::as.lazy(substitute(.constraint_expr), 
         parent.frame()), .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  11: apply(var_combinations, 1, function(row) {
         calling_env <- as.environment(as.list(row))
         parent.env(calling_env) <- parent_env
         constraint <- add_constraint_internal(calling_env)
         if (.show_progress_bar) {
             p$tick()
         }
         constraint
     })
  12: FUN(newX[, i], ...)
  13: add_constraint_internal(calling_env)
  14: normalize_expression(model, rhs_ast, envir)
  15: bind_variables(model, expression, envir)
  16: try_eval_exp_rec(ast, calling_env)
  17: ast_walker(base_ast, on_element)
  18: on_element(push, inplace_update_ast, get_ast_value, element)
  19: inplace_update_ast(path, new_ast_eval)
  
  ── 5. Error: you can export the model as an ROI::OP object (@test-solver-roi.R#1
  object of type 'symbol' is not subsettable
  1: add_constraint(m, sum_expr(weights[j] * x[i, j], j = 1:n) <= y[i] * bin_size, i = 1:max_bins) at testthat/test-solver-roi.R:176
  2: add_constraint_(.model, lazyeval::as.lazy(substitute(.constraint_expr), parent.frame()), 
         .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  3: add_constraint_.optimization_model(.model, lazyeval::as.lazy(substitute(.constraint_expr), 
         parent.frame()), .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  4: apply(var_combinations, 1, function(row) {
         calling_env <- as.environment(as.list(row))
         parent.env(calling_env) <- parent_env
         constraint <- add_constraint_internal(calling_env)
         if (.show_progress_bar) {
             p$tick()
         }
         constraint
     })
  5: FUN(newX[, i], ...)
  6: add_constraint_internal(calling_env)
  7: normalize_expression(model, lhs_ast, envir)
  8: bind_variables(model, expression, envir)
  9: try_eval_exp_rec(ast, calling_env)
  10: ast_walker(base_ast, on_element)
  11: on_element(push, inplace_update_ast, get_ast_value, element)
  12: inplace_update_ast(path, new_ast_eval)
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 15 SKIPPED: 1 FAILED: 5
  1. Error: symphony can solve a model (@test-solver-roi.R#58) 
  2. Error: ROI can solve a bin packing problem (@test-solver-roi.R#76) 
  3. Error: quantified constraints work (@test-solver-roi.R#95) 
  4. Error: bug 20160704: did not correctly convert constraint (@test-solver-roi.R#105) 
  5. Error: you can export the model as an ROI::OP object (@test-solver-roi.R#176) 
  
  Error: testthat unit tests failed
  Execution halted