Last chance! 50% off unlimited learning
Sale ends in
Specify that the SYMPHONY software should be used to solve a
project prioritization problem
using the Rsymphony
package. This function can also be used to customize the behavior of the
solver. It requires the Rsymphony package.
add_rsymphony_solver(
x,
gap = 0,
time_limit = -1,
first_feasible = 0,
verbose = TRUE
)
ProjectProblem-class
object.
numeric
gap to optimality. This gap is relative when
solving problems using gurobi, and will cause the optimizer to
terminate when the difference between the upper and lower objective
function bounds is less than the gap times the upper bound. For example, a
value of 0.01 will result in the optimizer stopping when the difference
between the bounds is 1 percent of the upper bound. For
other solvers, this is the absolute gap, so if the optimal value for
a maximization problem is 10, a gap of 0.01 means that a solution between
10 and 10.01 is required. Defaults to 0, so that optimal solutions will be
returned.
numeric
time limit in seconds to run the optimizer.
The solver will return the current best solution when this time limit is
exceeded.
logical
should the first feasible solution be
be returned? If first_feasible
is set to TRUE
, the solver
will return the first solution it encounters that meets all the
constraints, regardless of solution quality. Note that the first feasible
solution is not an arbitrary solution, rather it is derived from the
relaxed solution, and is therefore often reasonably close to optimality.
Defaults to FALSE
.
logical
should information be printed while solving
optimization problems?
ProjectProblem-class
object with the solver added
to it.
SYMPHONY is an open-source integer programming solver that is part of the Computational Infrastructure for Operations Research (COIN-OR) project, an initiative to promote development of open-source tools for operations research (a field that includes linear programming). The Rsymphony package provides an interface to COIN-OR and is available on CRAN. This solver uses the Rsymphony package to solve problems.
# NOT RUN {
# load data
data(sim_projects, sim_features, sim_actions)
# build problem with Rsymphony solver
p <- problem(sim_projects, sim_actions, sim_features,
"name", "success", "name", "cost", "name") %>%
add_max_richness_objective(budget = 200) %>%
add_binary_decisions() %>%
add_rsymphony_solver()
# print problem
print(p)
# solve problem
s <- solve(p)
# print solution
print(s)
# plot solution
plot(p, s)
# }
Run the code above in your browser using DataLab