Skip to content

Document and review patchmax psuedo-code #25

@codyevers

Description

@codyevers

Here’s the pseudo code for the procedure for everyone’s reference

Create spatial adjcency network

  • Create adjacency network object based on feature topology
  • Calculate pairwise-distances for each network dyad based on stand centroids
  • Flag each node in network as include or exclude based on stand threshold threshold
  • Modify distances for each dyad based on
    • Average objective (distance penalty is 10x for dyad with lowest objective when spw = 1)
    • Exclusion (distance penalty is 10x for dyads with excluded member when epw = 1)

Search function

  • While patch count <= total project count
    • Build patch for each node_i
      • Calcualte objective score
      • Assign score to node_i
    • Identify node_i with highest patch score (NAs are ignored)
      • (re)Build patch (same as above) at node_i
      • Record patch and stand statistics, assign patch_id to all nodes within patch
      • Remove nodes with patch_id from network return to START

Build function: build_func( node_i )

  • Calculate distance matrix for node_i to all other nodes using Djistra’s algorithm
  • Sort all nodes in descending order where dist == 0 is node_i
  • Mark nodes outside of treatment treshold as excluded
  • If excluded...
    • Set area to 0
    • Set objective to 0
    • Set constraint to 0
  • Calculate cumulative sum for area
  • Select nodes from node_i distance matrix until patch_area
  • If secondary constraint provided...
    • Calculate cumulative sum for constraint
    • Set threshold_met to FALSE if constraint limits exceeded
    • Delete nodes from tail of distance matrix until secondary constraint is met
  • Flag validity
    • Invalid if length == 0
    • Invalid if patch_area < min_patch_area
    • Invalid if excluded area fraction > threshold_exclusion_limit
  • Sum objective for remaining nodes in matrix
  • Return patch objective score if valid or NA if invalid

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions