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
  
  > test_check("ompr")
  Loading required package: ompr
  ── 1. Error: add_constraint can handle a for all quantifier (@test-add-constrain
  object of type 'symbol' is not subsettable
  1: MIPModel() %>% add_variable(x[i, j], i = 1:3, j = 1:3) %>% add_constraint(sum_expr(x[i, 
         j], j = 1:3) == 1, i = 1:3) at testthat/test-add-constraint.R:31
  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: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: add_constraint(., sum_expr(x[i, j], j = 1:3) == 1, i = 1:3)
  10: add_constraint_(.model, lazyeval::as.lazy(substitute(.constraint_expr), parent.frame()), 
         .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  11: add_constraint_.optimization_model(.model, lazyeval::as.lazy(substitute(.constraint_expr), 
         parent.frame()), .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  12: 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
     })
  13: FUN(newX[, i], ...)
  14: add_constraint_internal(calling_env)
  15: normalize_expression(model, lhs_ast, envir)
  16: bind_variables(model, expression, envir)
  17: try_eval_exp_rec(ast, calling_env)
  18: ast_walker(base_ast, on_element)
  19: on_element(push, inplace_update_ast, get_ast_value, element)
  20: inplace_update_ast(path, new_ast_eval)
  
  ── 2. Failure: bug 20161107 #103: bug in extract coefficient (1) (@test-helpers.
  -12 not equal to result$coefficients[["x"]]$coef.
  1/1 mismatches
  [1] -12 - 12 == -24
  
  ── 3. Error: bug 20161107 #103: bug in extract coefficient (2) (@test-helpers.R#
  The expression contains a variable that is not part of the model.
  1: MIPModel() %>% add_variable(x[i], i = 1:2) %>% add_variable(y) %>% add_constraint(y - 
         a * x[i] <= 1, i = 1:2) at testthat/test-helpers.R:73
  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: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: add_constraint(., y - a * x[i] <= 1, i = 1:2)
  10: add_constraint_(.model, lazyeval::as.lazy(substitute(.constraint_expr), parent.frame()), 
         .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  11: add_constraint_.optimization_model(.model, lazyeval::as.lazy(substitute(.constraint_expr), 
         parent.frame()), .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  12: 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
     })
  13: FUN(newX[, i], ...)
  14: add_constraint_internal(calling_env)
  15: normalize_expression(model, lhs_ast, envir)
  16: check_expression(model, ast)
  17: check_for_unknown_vars_impl(model, the_ast)
  
  ── 4. Error: objective_function(): returns a list with a vector and a constant b
  recursive indexing failed at level 5
  1: MIPModel() %>% add_variable(x[i], i = 1:9) %>% set_objective(sum_expr(i * x[i], i = 1:9) + 
         10) at testthat/test-model-api.R:28
  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: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: set_objective(., sum_expr(i * x[i], i = 1:9) + 10)
  10: set_objective_(model, expression = lazyeval::as.lazy(substitute(expression), parent.frame()), 
         sense = sense)
  11: set_objective_.optimization_model(model, expression = lazyeval::as.lazy(substitute(expression), 
         parent.frame()), sense = sense)
  12: normalize_expression(model, obj_ast, expression$env)
  13: standardize_ast(ast)
  14: ast_walker(ast, on_element)
  15: on_element(push, inplace_update_ast, get_ast_value, element)
  16: inplace_update_ast(path, new_ast)
  
  ── 5. Error: variable_bounds(): returns the bounds in the order of the constrain
  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) at testthat/test-model-api.R:201
  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: withVisible(function_list[[k]](value))
  8: function_list[[k]](value)
  9: add_constraint(., u[i] + 1 <= u[j] + n * (1 - x[i, j]), i = 1:n, j = 1:n)
  10: add_constraint_(.model, lazyeval::as.lazy(substitute(.constraint_expr), parent.frame()), 
         .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  11: add_constraint_.optimization_model(.model, lazyeval::as.lazy(substitute(.constraint_expr), 
         parent.frame()), .dots = lazyeval::lazy_dots(...), .show_progress_bar = .show_progress_bar)
  12: 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
     })
  13: FUN(newX[, i], ...)
  14: add_constraint_internal(calling_env)
  15: normalize_expression(model, rhs_ast, envir)
  16: bind_variables(model, expression, envir)
  17: try_eval_exp_rec(ast, calling_env)
  18: ast_walker(base_ast, on_element)
  19: on_element(push, inplace_update_ast, get_ast_value, element)
  20: inplace_update_ast(path, new_ast_eval)
  
  ── 6. Error: we can model a tsp (@test-model.R#65)  ────────────────────────────
  recursive indexing failed at level 3
  1: MIPModel() %>% add_variable(x[i, j], i = 1:cities, j = 1:cities, type = "binary") %>% 
         set_objective(sum_expr(distance_matrix[i, j] * x[i, j], i = 1:cities, j = 1:cities), 
             sense = "min") %>% add_constraint(x[i, i] == 0, i = 1:cities) %>% add_constraint(x[i, 
         j] == x[j, i], i = 1:cities, j = 1:cities) %>% add_constraint(sum_expr(x[i, j], 
         i = sub_tours[[s]], j = sub_tours[[s]]) <= length(sub_tours[s]) - 1, s = 1:length(sub_tours)) at testthat/test-model.R:65
  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(distance_matrix[i, j] * x[i, j], i = 1:cities, j = 1:cities), 
         sense = "min")
  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)
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 205 SKIPPED: 9 FAILED: 6
  1. Error: add_constraint can handle a for all quantifier (@test-add-constraint.R#31) 
  2. Failure: bug 20161107 #103: bug in extract coefficient (1) (@test-helpers.R#67) 
  3. Error: bug 20161107 #103: bug in extract coefficient (2) (@test-helpers.R#73) 
  4. Error: objective_function(): returns a list with a vector and a constant by default (@test-model-api.R#28) 
  5. Error: variable_bounds(): returns the bounds in the order of the constraint matrix (@test-model-api.R#201) 
  6. Error: we can model a tsp (@test-model.R#65) 
  
  Error: testthat unit tests failed
  Execution halted