useSolver: Use a solver for a list of constraints. In eatATA: Create Constraints for Small Test Assembly Problems

Description

Use a mathematical programming solver to solve a list for constrains.

Usage

 ```1 2 3 4 5 6 7``` ```useSolver( allConstraints, solver = c("GLPK", "lpSolve", "Gurobi", "Symphony"), timeLimit = Inf, formNames = NULL, ... ) ```

Arguments

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

Details

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

Value

A list with the following elements:

`solution_found`

Was a solution found?

`solution`

Numeric vector containing the found solution.

`solution_status`

Was the solution optimal?

Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```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") ```

eatATA documentation built on July 6, 2021, 5:07 p.m.