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.
Examples
data(CurrentLanduse)
CurrentLU <- terra::unwrap(CurrentLanduse)
TroublemakeR::create_budget(budget = 2,
Rastercurrentlanduse = CurrentLU,
landuses = c("Agriculture", "Forest", "Urban"),
name = "Problem",
verbose = TRUE)
#> Landuse 1 of 3 ready 2025-01-14 12:41:50.032301
#> Landuse 2 of 3 ready 2025-01-14 12:41:50.202892
#> Landuse 3 of 3 ready 2025-01-14 12:41:50.346733
# delete the file so the test on cran can pass this
file.remove("Problem.dat")
#> [1] TRUE