This function updates parameters or data stored in an existing GurobiOpts(), RapUnreliableOpts(), RapReliableOpts(), RapData(), RapUnsolved(), or RapSolved() object.

# S3 method for GurobiOpts
update(
  object,
  Threads = NULL,
  MIPGap = NULL,
  Method = NULL,
  Presolve = NULL,
  TimeLimit = NULL,
  NumberSolutions = NULL,
  MultipleSolutionsMethod = NULL,
  NumericFocus = NULL,
  ...
)

# S3 method for ManualOpts
update(object, NumberSolutions = NULL, ...)

# S3 method for RapData
update(
  object,
  species = NULL,
  space = NULL,
  name = NULL,
  amount.target = NULL,
  space.target = NULL,
  pu = NULL,
  cost = NULL,
  status = NULL,
  ...
)

# S3 method for RapReliableOpts
update(object, BLM = NULL, failure.multiplier = NULL, max.r.level = NULL, ...)

# S3 method for RapUnreliableOpts
update(object, BLM = NULL, ...)

# S3 method for RapUnsolOrSol
update(object, ..., formulation = NULL, solve = TRUE)

Arguments

object

GurobiOpts(), RapUnreliableOpts(), RapReliableOpts(), RapData(), RapUnsolved(), or RapSolved() object.

Threads

integer number of cores to use for processing.

MIPGap

numeric MIP gap specifying minimum solution quality.

Method

integer Algorithm to use for solving model.

Presolve

integer code for level of computation in presolve.

TimeLimit

integer number of seconds to allow for solving.

NumberSolutions

integer number of solutions to generate.

MultipleSolutionsMethod

integer name of method to obtain multiple solutions (used when NumberSolutions is greater than one). Available options are "benders.cuts", "solution.pool.0", "solution.pool.1", and "solution.pool.2". The "benders.cuts" method produces a set of distinct solutions that are all within the optimality gap. The "solution.pool.0" method returns all solutions identified whilst trying to find a solution that is within the specified optimality gap. The "solution.pool.1" method finds one solution within the optimality gap and a number of additional solutions that are of any level of quality (such that the total number of solutions is equal to number_solutions). The "solution.pool.2" finds a specified number of solutions that are nearest to optimality. The search pool methods correspond to the parameters used by the Gurobi software suite (see https://www.gurobi.com/documentation/8.0/refman/poolsearchmode.html#parameter:PoolSearchMode). Defaults to "benders.cuts".

NumericFocus

integer how much effort should Gurobi focus on addressing numerical issues? Defaults to 0L such that minimal effort is spent to reduce run time.

...

parameters passed to update.RapReliableOpts(), update.RapUnreliableOpts(), or update.RapData().

species

integer or character denoting species for which targets or name should be updated.

space

integer denoting space for which targets should be updated.

name

character to rename species.

amount.target

numeric vector for new area targets (%) for the specified species.

space.target

numeric vector for new attribute space targets (%) for the specified species and attribute spaces.

pu

integer planning unit indices that need to be updated.

cost

numeric new costs for specified planning units.

status

integer new statuses for specified planning units.

BLM

numeric boundary length modifier.

failure.multiplier

numeric multiplier for failure planning unit.

max.r.level

numeric maximum R failure level for approximation.

formulation

character indicating new problem formulation to use. This can be either "unreliable" or "reliable". The default is NULL so that formulation in object is used.

solve

logical should the problem be solved? This argument is only valid for RapUnsolved() and RapSolved() objects. Defaults to TRUE.

Value

GurobiOpts, RapUnreliableOpts, RapReliableOpts, RapData, RapUnsolved, or RapSolved object depending on argument to x.

Examples

# \dontrun{
# load data
data(sim_ru, sim_rs)

# GurobiOpts
x <- GurobiOpts(MIPGap = 0.7)
y <- update(x, MIPGap = 0.1)
print(x)
#> GurobiOpts object.
#>   Threads: 1
#>   MIPGap: 0.7
#>   Method: 0
#>   Presolve: 2
#>   TimeLimit: NA
#>   NumberSolutions: 1
#>   MultipleSolutionsMethod: benders.cuts
#>   NumericFocus: 0
print(y)
#> GurobiOpts object.
#>   Threads: 1
#>   MIPGap: 0.1
#>   Method: 0
#>   Presolve: 2
#>   TimeLimit: NA
#>   NumberSolutions: 1
#>   MultipleSolutionsMethod: benders.cuts
#>   NumericFocus: 0

# RapUnreliableOpts
x <- RapUnreliableOpts(BLM = 10)
y <- update(x, BLM = 2)
print(x)
#> RapUnreliableOpts object.
#>   BLM: 10
print(y)
#> RapUnreliableOpts object.
#>   BLM: 2

# RapReliableOpts
x <- RapReliableOpts(failure.multiplier = 2)
y <- update(x, failure.multiplier = 4)
print(x)
#> RapReliableOpts object.
#>   BLM: 0
#>   failure.multiplier: 2
#>   max.r.level: 5
print(y)
#> RapReliableOpts object.
#>   BLM: 0
#>   failure.multiplier: 4
#>   max.r.level: 5

# RapData
x <- sim_ru@data
y <- update(x, space.target = c(0.4, 0.7, 0.1))
print(space.target(x))
#>            1
#> uniform 0.85
#> normal  0.85
#> bimodal 0.85
print(space.target(y))
#>           1
#> uniform 0.4
#> normal  0.7
#> bimodal 0.1

## RapUnsolved
x <- sim_ru
y <- update(x, amount.target = c(0.1, 0.2, 0.3), BLM = 3, solve = FALSE)
print(x@opts@BLM); print(amount.target(x))
#> [1] 0
#> uniform  normal bimodal 
#>     0.2     0.2     0.2 
print(y@opts@BLM); print(space.target(y))
#> [1] 3
#>            1
#> uniform 0.85
#> normal  0.85
#> bimodal 0.85

## RapSolved
x <- sim_rs
y <- update(x, space.target = c(0.4, 0.6, 0.9), BLM = 100, Presolve = 1L,
            solve = FALSE)
print(x@opts@BLM); print(amount.target(x))
#> [1] 0
#> uniform  normal bimodal 
#>     0.2     0.2     0.2 
print(y@opts@BLM); print(space.target(y))
#> [1] 100
#>           1
#> uniform 0.4
#> normal  0.6
#> bimodal 0.9
# }