| useSolver | R Documentation | 
Use a mathematical programming solver to solve a list for constrains.
useSolver(
  allConstraints,
  solver = c("GLPK", "lpSolve", "Gurobi", "Symphony"),
  timeLimit = Inf,
  formNames = NULL,
  ...
)
allConstraints | 
 List of constraints.  | 
solver | 
 A character string indicating the solver to use.  | 
timeLimit | 
 The maximal runtime in seconds.  | 
formNames | 
 A character vector with names to give to the forms.  | 
... | 
 Additional arguments for the solver.  | 
Wrapper around the functions of different solvers (gurobi::gurobi(),
lpSolve::lp(), ... for a list of constraints set up via eatATA.
Rglpk is used per default.
Additional arguments can be passed through
... and vary from solver to solver (see their respective help pages,
lp or Rglpk_solve_LP); for example
time limits can not be set for lpSolve.
A list with the following elements:
solution_foundWas a solution found?
solutionNumeric vector containing the found solution.
solution_statusWas the solution optimal?
nForms <- 2
nItems <- 4
# create constraits
target <- minimaxObjective(nForms = nForms, c(1, 0.5, 1.5, 2),
                       targetValue = 2, itemIDs = 1:nItems)
noItemOverlap <- itemUsageConstraint(nForms, operator = "=", itemIDs = 1:nItems)
testLength <- itemsPerFormConstraint(nForms = nForms,
                           operator = "<=", targetValue = 2, itemIDs = 1:nItems)
# use a solver
result <- useSolver(list(target, noItemOverlap, testLength),
  itemIDs = paste0("Item_", 1:4),
  solver = "GLPK")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.