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

Description

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.

Usage

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

Arguments

x

ProjectProblem object.

gap

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).

presolve

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

verbose

logical should information be printed while solving optimization problems?

Details

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().

Value

ProjectProblem object with the solver added to it.

See Also

solvers.

Examples

# 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() %>%
     add_lpsolveapi_solver()

# print problem
print(p)

# solve problem
s <- solve(p)

# print solution
print(s)

# plot solution
plot(p, s)

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