This function uses Gurobi to find prioritizations using the input parameter and data stored in a RapUnsolved() object, and returns a RapSolved() object with outputs in it.

# S4 method for RapUnsolOrSol,missing
solve(a, b, ..., verbose = FALSE)

# S4 method for RapUnsolOrSol,GurobiOpts
solve(a, b, verbose = FALSE)

# S4 method for RapUnsolOrSol,matrix
solve(a, b, verbose = FALSE)

# S4 method for RapUnsolOrSol,numeric
solve(a, b, verbose = FALSE)

# S4 method for RapUnsolOrSol,logical
solve(a, b, verbose = FALSE)

Arguments

a

RapUnsolved() or RapSolved() object.

b

missing to generate solutions using Gurobi. Prioritizations can be specified using logical, numeric, or base::matrix() objects. This may be useful for evaluating the performance of solutions obtained using other software.

...

not used.

verbose

logical should messages be printed during creation of the initial model matrix?.

Value

RapSolved() object

Note

This function is used to solve a RapUnsolved() object that has all of its inputs generated. The rap function (without lower case 'r') provides a more general interface for generating inputs and outputs.

See also

Examples

# load RapUnsolved object data(sim_ru) # \dontrun{ # solve it using Gurobi sim_rs <- solve(sim_ru)
#> Gurobi Optimizer version 9.0.1 build v9.0.1rc0 (linux64) #> Optimize a model with 30306 rows, 30100 columns and 120000 nonzeros #> Model fingerprint: 0xba2fdd45 #> Variable types: 0 continuous, 30100 integer (30100 binary) #> Coefficient statistics: #> Matrix range [7e-03, 9e+01] #> Objective range [1e+00, 1e+00] #> Bounds range [1e+00, 1e+00] #> RHS range [1e+00, 1e+02] #> Found heuristic solution: objective 99.0000000 #> Presolve removed 360 rows and 15 columns (presolve time = 5s) ... #> Presolve removed 360 rows and 15 columns #> Presolve time: 5.46s #> Presolved: 29946 rows, 30085 columns, 131504 nonzeros #> Variable types: 0 continuous, 30085 integer (30085 binary) #> Presolve removed 67 rows and 1 columns #> Presolved: 29879 rows, 30084 columns, 127194 nonzeros #> #> #> Root simplex log... #> #> Iteration Objective Primal Inf. Dual Inf. Time #> 0 1.0000000e+02 0.000000e+00 1.000000e+02 6s #> 5346 2.0000000e+01 0.000000e+00 0.000000e+00 7s #> 5346 2.0000000e+01 0.000000e+00 0.000000e+00 7s #> #> Root relaxation: objective 2.000000e+01, 5346 iterations, 1.37 seconds #> #> Nodes | Current Node | Objective Bounds | Work #> Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time #> #> 0 0 20.00000 0 21 99.00000 20.00000 79.8% - 7s #> H 0 0 21.0000000 20.00000 4.76% - 7s #> #> Explored 1 nodes (10151 simplex iterations) in 7.29 seconds #> Thread count was 1 (of 4 available processors) #> #> Solution count 2: 21 99 #> #> Optimal solution found (tolerance 1.00e-01) #> Best objective 2.100000000000e+01, best bound 2.000000000000e+01, gap 4.7619%
# evaluate manually specified solution using planning unit indices sim_rs2 <- solve(sim_ru, seq_len(10))
#> Warning: some species have space.held values less than 0, and thus are poorly represented
# evaluate manually specifed solution using binary selections sim_rs3 <- solve(sim_ru, c(rep(TRUE, 10), rep(FALSE, 90)))
#> Warning: some species have space.held values less than 0, and thus are poorly represented
# evaluate multiple manually specified solutions sim_rs4 <- solve(sim_ru, matrix(sample(c(0, 1), size = 500, replace = TRUE), ncol = 100, nrow = 5)) # }