Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,37 @@ Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.3
Depends:
R (>= 4.0.0)
R (>= 4.1.0)
Imports:
sf (>= 1.0.0),
igraph,
magrittr,
Matrix,
prioritizr (>= 7.0.0),
rlang,
sf (>= 1.0.0),
stats,
magrittr,
igraph,
Matrix
tidyselect
Suggests:
dplyr,
ggplot2,
prioritizrdata,
terra,
testthat (>= 3.0.0),
kableExtra,
knitr,
lwgeom,
oceandatr,
parallelly,
patchwork,
prioritizrdata,
purrr,
rmarkdown,
shadowtext,
stars,
stringr,
parallelly
terra,
testthat (>= 3.0.0),
tibble,
tmap
Remotes:
github::emlab-ucsb/oceandatr
VignetteBuilder: knitr
URL: https://github.com/SpatialPlanning/minpatch
BugReports: https://github.com/SpatialPlanning/minpatch/issues
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
export("%>%")
export(compare_solutions)
export(generate_minpatch_report)
export(make_minpatch_summary_table)
export(plot_minpatch)
export(plot_patch_validity)
export(plot_prioritizr)
export(plot_solution_grid)
export(print_minpatch_summary)
export(run_minpatch)
importFrom(magrittr,"%>%")
Expand Down
10 changes: 9 additions & 1 deletion R/minpatch.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#' @param whittle_patches Logical, whether to remove unnecessary units (Stage 3, default = TRUE)
#' @param solution_column Name of solution column (default = "solution_1")
#' @param verbose Logical, whether to print progress (default = TRUE)
#' @param debug_boundary Logical, whether to print boundary cost debug info (default = FALSE)
#' @param debug_boundary_every Integer, print debug info every N iterations (default = 50)
#'
#' @details
#' The MinPatch algorithm consists of three stages:
Expand Down Expand Up @@ -109,7 +111,9 @@ run_minpatch <- function(prioritizr_problem,
add_patches = TRUE,
whittle_patches = TRUE,
solution_column = "solution_1",
verbose = TRUE) {
verbose = TRUE,
debug_boundary = FALSE,
debug_boundary_every = 50) {

# Stage 0: Checks and data preparation -----

Expand Down Expand Up @@ -212,6 +216,10 @@ run_minpatch <- function(prioritizr_problem,
prioritizr_problem, prioritizr_solution, verbose
)

# DEBUG: pass flags into downstream functions (e.g., simulated_whittling)
minpatch_data$debug_boundary <- debug_boundary
minpatch_data$debug_boundary_every <- debug_boundary_every

# Create initial minpatch column in prioritizr_solution
minpatch_data$prioritizr_solution$minpatch <- create_solution_vector(minpatch_data$unit_dict)

Expand Down
Loading