Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

write_problem

Write problem


Description

Save the mathematical formulation for a conservation planning problem() to a file for mixed integer programming solvers. Note that this function requires the Rsymphony package to be installed.

Usage

write_problem(x, path)

Arguments

x

problem() (i.e. ConservationProblem) object.

path

character file path to save the problem formulation. The argument should contain a ".lp" or .mps" file extension to specify whether the problem formulation will be saved in the LP or MPS format (respectively).

Value

Invisible TRUE indicating success.

Examples

## Not run: 
# set seed for reproducibility
set.seed(500)

# load data
data(sim_pu_raster, sim_features, sim_pu_zones_stack, sim_features_zones)

# create minimal problem
p <- problem(sim_pu_raster, sim_features) %>%
      add_min_set_objective() %>%
      add_relative_targets(0.1) %>%
      add_binary_decisions()

# save problem to file (using the Rsymphony R package)
write_problem(p, "model.lp")

## End(Not run)

prioritizr

Systematic Conservation Prioritization in R

v7.0.1
GPL-3
Authors
Jeffrey O Hanson [aut] (<https://orcid.org/0000-0002-4716-6134>), Richard Schuster [aut, cre] (<https://orcid.org/0000-0003-3191-7869>), Nina Morrell [aut], Matthew Strimas-Mackey [aut] (<https://orcid.org/0000-0001-8929-7776>), Matthew E Watts [aut], Peter Arcese [aut] (<https://orcid.org/0000-0002-8097-482X>), Joseph Bennett [aut] (<https://orcid.org/0000-0002-3901-9513>), Hugh P Possingham [aut] (<https://orcid.org/0000-0001-7755-996X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.