Capacitated_connect - ObjectVision/GeoDMS GitHub Wiki

Network functions capacitated_connect

syntax

  • capacitated_connect(point_dataitem_dest, capacity_dest, point_dataitem_org, value_org)

definition

The capacitated_connect function works in a similar way as the first variant of the connect function, only with the extra condition that the nearest point is found in which the value of the value_org argument of the origin domain unit is less than or equal to the capacity_dest argument of the destination domain unit.

The result is a data item for the domain unit of the point_dataitem_org with as values unit the domain unit of the point_dataitem_dest data item.

description

The capacity is a condition per pair, not a budget: it is not reduced by the origins already connected to a destination, so the origins do not compete for it and the result does not depend on their order. For an allocation in which destinations do get used up, see Spatial joins and allocation.

The point_dataitem_dest argument should contain unique geometries. Use the unique function to make a domain unit with unique geometries.

applies to

  • data items point_dataitem_dest and point_dataitem_org with fpoint or dpoint value type
  • data items capacity_dest and value_org with float64 value type

conditions

  1. The value type of all arguments must match.
  2. The domain unit of arguments point_dataitem_dest and capacity_dest must match.
  3. The domain unit of arguments point_dataitem_org and value_org must match.

since version

7.159

performance

O(n * m) worst case where n = number of origins and m = number of destinations. Uses spatial indexing to prune candidates. Capacity constraints may require checking multiple nearby destinations per origin.

example

attribute<dest> dest_rel (org) := capacitated_connect(dest/geometry, dest/capacity, org/geometry, org/temp);
org/geometry org/temp dest_rel
xy(115135; 401331) 60° 2
xy(111803; 399476) 60° 1
xy(114903; 399289) 60° 2
xy(111353; 401729) 60° 1
xy(111741; 398696) 60° 1

domain org, nr of rows = 5

dest/geometry dest/capacity
xy(115131; 401331) 40°
xy(112601; 399138) 90°
xy(114903; 398600) 60°
xy(112156; 401729) 40°

domain dest, nr of rows = 4

⚠️ **GitHub.com Fallback** ⚠️