create_budget {TroublemakeR}R Documentation

Create budget

Description

This function generates or appends the budget and transition cost to a .dat file for ampl. The file will be written to the location specified by the name argument. If the file already exists, it will be overwritten. The file format is plain text, with each line terminated by a newline character.

Usage

create_budget(
  budget,
  Rastercurrentlanduse,
  landuses,
  name = "Problem",
  verbose = FALSE
)

Arguments

budget

maximum cost for the problem

Rastercurrentlanduse

raster object of current landuses

landuses

character vector with all landuses

name

The name of the output file

verbose

Logical whether messages will be written while the function is generating calculations, defaults to FALSE

Value

A .dat file. This function is used for the side-effect of writing values to a file.

Author(s)

Derek Corcoran

Examples


data(CurrentLanduse)
CurrentLU <- terra::unwrap(CurrentLanduse)


TroublemakeR::create_budget(budget = 2,
Rastercurrentlanduse = CurrentLU,
landuses = c("Agriculture", "Forest", "Urban"),
name = "Problem",
verbose = TRUE)

# delete the file so the test on cran can pass this

file.remove("Problem.dat")


[Package TroublemakeR version 0.0.1 Index]