# load data
data(sim_projects, sim_features, sim_actions)
# build problem
p1 <- problem(sim_projects, sim_actions, sim_features,
             "name", "success", "name", "cost", "name") %>%
     add_max_richness_objective(budget = 200) %>%
     add_binary_decisions()
# build another problem, with the default solver
p2 <- p1 %>%
      add_default_solver()
# build another problem, with the gurobi solver
if (FALSE) {
p3 <- p1 %>%
      add_gurobi_solver()
}
# build another problem, with the Rsympony solver
if (FALSE) {
p4 <- p1 %>%
      add_rsymphony_solver()
}
# build another problem, with the lpsymphony solver
if (FALSE) {
p5 <- p1 %>%
      add_lpsymphony_solver()
}
# build another problem, with the lpSolveAPI solver
p6 <- p1 %>%
      add_lpsolveapi_solver()
# build another problem, with the heuristic solver
p7 <- p1 %>%
      add_heuristic_solver()
# build another problem, with the random solver
p8 <- p1 %>%
      add_random_solver()
if (FALSE) {
# generate solutions using each of the solvers
s <- rbind(solve(p2), solve(p3), solve(p4), solve(p5), solve(p6), solve(p7),
           solve(p8))
s$solver <- c("default", "gurobi", "Rsymphony", "lpsymphony", "lpSolveAPI",
              "heuristic", "random")
# print solutions
print(as.data.frame(s))
}
Run the code above in your browser using DataLab