update: Update object

updateR Documentation

Update object

Description

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

Usage

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

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

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

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

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

## S3 method for class '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.

See Also

GurobiOpts, RapUnreliableOpts, RapReliableOpts, RapData, RapUnsolved, RapSolved.

Examples

## Not run: 
# load data
data(sim_ru, sim_rs)

# GurobiOpts
x <- GurobiOpts(MIPGap = 0.7)
y <- update(x, MIPGap = 0.1)
print(x)
print(y)

# RapUnreliableOpts
x <- RapUnreliableOpts(BLM = 10)
y <- update(x, BLM = 2)
print(x)
print(y)

# RapReliableOpts
x <- RapReliableOpts(failure.multiplier = 2)
y <- update(x, failure.multiplier = 4)
print(x)
print(y)

# RapData
x <- sim_ru@data
y <- update(x, space.target = c(0.4, 0.7, 0.1))
print(space.target(x))
print(space.target(y))

## 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))
print(y@opts@BLM); print(space.target(y))

## 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))
print(y@opts@BLM); print(space.target(y))

## End(Not run)

paleo13/rapr documentation built on Feb. 12, 2024, 3:27 a.m.