add_lpsolveapi_solver: Add a lp_solve solver with 'lpSolveAPI'

View source: R/add_lpsolveapi_solver.R

add_lpsolveapi_solverR Documentation

Add a lp_solve solver with lpSolveAPI


Specify that the lp_solve software should be used to solve a project prioritization problem() using the lpSolveAPI package. This function can also be used to customize the behavior of the solver. It requires the lpSolveAPI package.


add_lpsolveapi_solver(x, gap = 0, presolve = FALSE, verbose = TRUE)



ProjectProblem object.


numeric gap to optimality. This gap is relative and expresses the acceptable deviance from the optimal objective. For example, a value of 0.01 will result in the solver stopping when it has found a solution within 1% of optimality. Additionally, a value of 0 will result in the solver stopping when it has found an optimal solution. The default value is 0.1 (i.e. 10% from optimality).


logical indicating if attempts to should be made to simplify the optimization problem (TRUE) or not (FALSE). Defaults to TRUE.


logical should information be printed while solving optimization problems?


lp_solve is an open-source integer programming solver. Although this solver is the slowest currently supported solver, it is also the only exact algorithm solver that can be installed on all operating systems without any manual installation steps. This solver is provided so that users can try solving small project prioritization problems, without needing to install additional software. When solve moderate or large project prioritization problems, consider using add_gurobi_solver().


ProjectProblem object with the solver added to it.

See Also



# load data
data(sim_projects, sim_features, sim_actions)

# build problem with lpSolveAPI solver
p <- problem(sim_projects, sim_actions, sim_features,
             "name", "success", "name", "cost", "name") %>%
     add_max_richness_objective(budget = 200) %>%
     add_binary_decisions() %>%

# print problem

# solve problem
s <- solve(p)

# print solution

# plot solution
plot(p, s)

oppr documentation built on Sept. 8, 2022, 5:07 p.m.