see_if_there_are_any_duplicate_links: See if there are any duplicate links

see_if_there_are_any_duplicate_linksR Documentation

See if there are any duplicate links

Description

I'm not certain, but I think that the original Xu algorithm doesn't allow duplicate links. I don't think that they would invalidate the solution, but I suspect that they could make the problem easier by giving more reasons to choose a pair of planning units. Consequently, I'm looking for duplicate links.

Usage

see_if_there_are_any_duplicate_links(occ_matrix, num_spp)

Arguments

occ_matrix

occupancy matrix, integer matrix with one row for each species and one column for each planning unit. Each matrix entry specifies whether that species occupies that planning unit; 1 indicates the species does occupy the planning unit and 0 indicates it does not. Same as bpm.

num_spp

integer number of species in the problem

Details

Note that you can only uniquely decode an edge list from an occurrence matrix if the species only occurs on 2 patches, i.e., the underlying assumption in the Xu problem generator. However, the only reason I'm building this routine now is to run it on the Xu benchmark problems to see if those allow any duplicate edges, i.e., more than one species occurring on the same pair of patches.

Value

Returns an edge list, a two column integer matrix of node IDs with one row for each edge and columns for the 2 ends of the edge; quits if any duplicate edges are found.


langfob/bdpg documentation built on Dec. 8, 2022, 5:33 a.m.