Gurobi Optimizer Reference Manual

0 views
Skip to first unread message

Garland Flugum

unread,
Aug 4, 2024, 10:58:58 PM8/4/24
to schichevjupas
Specifythat the Gurobi softwareshould be used to solve a conservation planning problem(Gurobi Optimization LLC 2021). This function can also be used tocustomize the behavior of the solver.It requires the gurobi package to be installed(see below for installation instructions).

numeric gap to optimality. This gap is relativeand expresses the acceptable deviance from the optimal objective.For example, a value of 0.01 will result in the solver stopping whenit has found a solution within 1% of optimality.Additionally, a value of 0 will result in the solver stoppingwhen it has found an optimal solution.The default value is 0.1 (i.e., 10% from optimality).


numeric time limit (seconds) for generating solutions.The solver will return the current best solution when this time limit isexceeded. The default value is the largest integer value(i.e., .Machine$integer.max), effectively meaning that solverwill keep running until a solution within the optimality gap is found.


integer number indicating how intensively thesolver should try to simplify the problem before solving it. Availableoptions are: (-1) automatically determine the intensity ofpre-solving, (0) disable pre-solving, (1) conservativelevel of pre-solving, and (2) very aggressive level of pre-solving .The default value is 2.


logical should the first feasible solution bebe returned? If first_feasible is set to TRUE, the solverwill return the first solution it encounters that meets all theconstraints, regardless of solution quality. Note that the first feasiblesolution is not an arbitrary solution, rather it is derived from therelaxed solution, and is therefore often reasonably close to optimality.Defaults to FALSE.


logical should extra attention be paidto verifying the accuracy of numerical calculations? This may beuseful when dealing with problems that may suffer from numerical instabilityissues. Beware that it will likely substantially increase run time(sets the Gurobi NumericFocus parameterto 3). Defaults to FALSE.


numeric threshold amount of memory (in GB).Once the amount of memory (RAM) used to store information for solvingthe optimization problem exceeds this parameter value, the solverwill begin storing this information on disk(using the Gurobi NodeFileStart parameter).This functionality is useful if the system has insufficient memory tosolve a given problem (e.g., solving the problem with default settingsyields the OUT OF MEMORY error message) and a system with more memory isnot readily available.For example, a value of 4 indicates that the solver will start usingthe disk after it uses more than 4 GB of memory to store informationon solving the problem.Defaults to Inf such that the solver will not attemptto store information on disk when solving a given problem.


NULL or object containing the starting solutionfor the solver. This is can be useful because specifying a startingsolution can speed up the optimization process.Defaults to NULL such that no starting solution is used.To specify a starting solution, the argument to start_solution shouldbe in the same format as the planning units (i.e., a NULL, numeric,matrix, data.frame, terra::rast(), or sf::sf() object).See the Start solution format section for more information.


Gurobi is astate-of-the-art commercial optimization software with an R packageinterface. It is by far the fastest of the solvers available forgenerating prioritizations, however, it is not freelyavailable. That said, licenses are available to academics at no cost. Thegurobi package is distributed with the Gurobi software suite.This solver uses the gurobi package to solve problems.For information on the performance of different solvers,please see Schuster et al. (2020) for benchmarks comparing therun time and solution quality of different solvers when applied todifferent sized datasets.


Broadly speaking, the argument to start_solution must be in the sameformat as the planning unit data in the argument to x.Further details on the correct format are listed separatelyfor each of the different planning unit data formats:


The argument to start_solution must be anumeric vector with each element corresponding to a different planningunit. It should have the same number of planning units as thosein the argument to x. Additionally, any planning units missingcost (NA) values should also have missing (NA) values in theargument to start_solution.


The argument to start_solution must be amatrix vector with each row corresponding to a different planningunit, and each column correspond to a different management zone.It should have the same number of planning units and zonesas those in the argument to x. Additionally, any planning unitsmissing cost (NA) values for a particular zone should also have amissing (NA) values in the argument to start_solution.


The argument to start_solutionbe a terra::rast() object where different grid cells (pixels) correspondto different planning units and layers correspond toa different management zones. It should have the same dimensionality(rows, columns, layers), resolution, extent, and coordinate referencesystem as the planning units in the argument to x. Additionally,any planning units missing cost (NA) values for a particular zoneshould also have missing (NA) values in the argument to start_solution.


The argument to start_solution mustbe a data.frame with each column corresponding to a different zone,each row corresponding to a different planning unit, and cell valuescorresponding to the solution value. This means that if a data.frameobject containing the solution also contains additional columns, thenthese columns will need to be subsetted prior to using this function(see below for example with sf::sf() data).Additionally, any planning units missing cost(NA) values for a particular zone should also have missing (NA)values in the argument to start_solution.


The argument to start_solution must bea sf::sf() object with each column corresponding to a differentzone, each row corresponding to a different planning unit, and cell valuescorresponding to the solution value. This means that if thesf::sf() object containing the solution also contains additionalcolumns, then these columns will need to be subsetted prior to using thisfunction (see below for example).Additionally, the argument to start_solution must also have the samecoordinate reference system as the planning unit data.Furthermore, any planning units missing cost(NA) values for a particular zone should also have missing (NA)values in the argument to start_solution.

3a8082e126
Reply all
Reply to author
Forward
0 new messages