-
public final class spreadingKt
-
-
Method Summary
Modifier and Type Method Description final Unit
addRange(Object v)
final Unit
addRangeHop()
final Unit
addRangeWithLag(Object v, Object metric, Object speed)
final Unit
addRangeWithMetric(Object v, Object metric)
final <T extends Any> T
boundBroadcast(Boolean region, T null, Boolean source, Object value)
Constrain the spreading of broadcast function only within a region. final <T extends Any> T
boundG(Boolean region, T null, Boolean source, T initial, Function1<Unit, Number> metric, Function1<T, T> accumulate)
Constrain the spreading of G function only within a region. final Unit
boundDistanceTo(Object region, Object source)
final Unit
broadcast(Object source, Object value)
final Unit
broadcastWithMetric(Object source, Object value, Object metric)
final Boolean
channel(Boolean source, Boolean dest, Number thr)
Dynamically computes distributed routes between regions of a network, and dynamically adapts to shape and changes of the network topology. final Boolean
channelWithObstacle(Boolean source, Boolean dest, Boolean obstacle, Number thr)
Dynamically computes distributed routes between regions of a network, and dynamically adapts to shape and changes of the network topology. final Boolean
channel2(Boolean source, Object destination, Number width)
Channel pattern. final Boolean
channel2WithObstacle(Boolean source, Object destination, Boolean obstacle, Number width)
Channel pattern. final Boolean
closerThan(Boolean source, Number range)
final Boolean
closerThanWithMetric(Boolean source, Function1<Unit, Number> metric, Number range)
final Number
crfGradient(Boolean source, Number maxHop)
Self-healing gradient algorithm that reconfigures in O(diameter) time. final Number
crfGradientWithMetric(Boolean source, Function1<Unit, Number> metric, Number maxHop)
Self-healing gradient algorithm that reconfigures in O(diameter) time. final Number
bisGradient(Boolean source, Number radius, Number speed)
Self-healing gradient algorithm with single-path reaction speed. final Number
bisGradientWithMetric(Boolean source, Function1<Unit, Number> metric, Number radius, Number speed)
Self-healing gradient algorithm with single-path reaction speed. final Boolean
dilate(Boolean region, Number width)
Dilate a spatial region. final Boolean
dilateWithMetric(Boolean region, Function1<Unit, Number> metric, Number width)
Dilate a spatial region. final Boolean
directProjection(Boolean source, Boolean obstacle)
Forecast obstacles along a path to the source. final Boolean
directProjectionWithMetric(Boolean source, Boolean obstacle, Function1<Unit, Number> metric)
Forecast obstacles along a path to the source. final Number
distanceBetween(Boolean source, Boolean dest)
Smallest distance between source and destination devices. final Number
distanceBetweenWithMetric(Boolean source, Boolean dest, Function1<Unit, Number> metric)
Smallest distance between source and destination devices. final Unit
distanceTo(Object source)
final Unit
distanceToWithMetric(Object source, Object metric)
final Unit
roundTripTime(Number d)
Estimate worst propagation time considering a message round trip. final Unit
flex_distorce(Object minD, Object metric)
final Unit
flex_slope(Object d, Object nbrD, Object minD, Object metric)
final Unit
flexGradient(Boolean source, Number epsilon, Number rate, Number range, Number distortion)
Flex-Gradient. final Unit
flexGradientWithMetric(Boolean source, Number epsilon, Number rate, Number range, Number distortion, Function1<Unit, Number> metric)
Flex-Gradient. final Unit
G(Object source, Object initial, Object metric, Object accumulate)
final <T extends Any> T
Gnull(T v, T default)
Wrapper for G error. final <T extends Any> T
gradcast(Boolean source, T local, Number gradient, Function1<T, T> accumulate)
Gradcast. final <T extends Any> <ERROR CLASS>
gradient(Boolean source, T init, Function1<Unit, Number> metric, Function1<T, T> accumulate)
Spread and extend information with distance from the source region. final Unit
hopBroadcast(Object source, Object value)
final Unit
hopDistanceTo(Object source)
final <U extends Any, I extends Any, D extends Any, T extends Any> <ERROR CLASS>
,T,Function1,Function1)>multiG(<ERROR CLASS> sources, ,T,Function1,Function1)>T init, Function1<Unit, Number> metric, Function1<,T,Function1,Function1)>T, ,T,Function1,Function1)>T> accumulate)
Run an instance of G from every source. final <U extends Any, I extends Any, D extends Any, T extends Any> <ERROR CLASS>
,T,Function1,Function1)>multiGradient(<ERROR CLASS> sources, ,T,Function1,Function1)>T init, Function1<Unit, Number> metric, Function1<,T,Function1,Function1)>T, ,T,Function1,Function1)>T> accumulate)
Spread and extend information with distance from multiple source regions. final Number
neighborhood()
Count the number of neighbors. final Number
nbrDelay()
Time forward view. final Number
nbrLag()
Time backward view. final Unit
nbrRange()
final Unit
nbrRangeHop()
final Unit
nbrRangeLag(Object metric, Object lagMetric, Object speed)
final Boolean
descend(Boolean source, Number potential)
Shortest path according to a potential. final Boolean
rendezvous(Boolean source, Boolean dest)
Shortest path. final Boolean
shortestPath(Boolean source, Object destination)
Dynamically computes the shortest route between regions of a network, and dynamically adapts to shape and changes of the network topology. final <T extends Any> T
vm(Boolean source, Number range, Function1<Unit, T> f, T null)
Entry point for a computation. final <T extends Any> T
vmWithMetric(Boolean source, Function1<Unit, Number> metric, Number range, Function1<Unit, T> f, T null)
Entry point for a computation. final <T extends Any> T
voronoiPatitioning(Boolean source, T id)
Computing a Voronoi partition is an operation that is frequently useful in distributed systems. final <T extends Any> T
voronoiPatitioningWithMetric(Object seed, T id, Function1<Unit, Number> metric)
Computing a Voronoi partition is an operation that is frequently useful in distributed systems. -
-
Method Detail
-
addRangeHop
final Unit addRangeHop()
-
addRangeWithLag
final Unit addRangeWithLag(Object v, Object metric, Object speed)
-
addRangeWithMetric
final Unit addRangeWithMetric(Object v, Object metric)
-
boundBroadcast
final <T extends Any> T boundBroadcast(Boolean region, T null, Boolean source, Object value)
Constrain the spreading of broadcast function only within a region.
- Parameters:
region
- whether the function is spreaded or notnull
- default value where f is not spreadedsource
- whether the current device is a source
-
boundG
final <T extends Any> T boundG(Boolean region, T null, Boolean source, T initial, Function1<Unit, Number> metric, Function1<T, T> accumulate)
Constrain the spreading of G function only within a region.
- Parameters:
region
- whether the function is spreaded or notnull
- default value where f is not spreadedsource
- whether the current device is a sourceinitial
- initial value of the computationmetric
- estimate distance from other devicesaccumulate
- how to manage the value
-
boundDistanceTo
final Unit boundDistanceTo(Object region, Object source)
-
broadcastWithMetric
final Unit broadcastWithMetric(Object source, Object value, Object metric)
-
channel
final Boolean channel(Boolean source, Boolean dest, Number thr)
Dynamically computes distributed routes between regions of a network, and dynamically adapts to shape and changes of the network topology. The channel is a Boolean field that is true for devices near the shortest route from a given (distributed) source to a (distributed) destination.
- Parameters:
source
- whether the device is a sourcedest
- whether the device is a destinationthr
- threshold for Double comparison (e.g.
-
channelWithObstacle
final Boolean channelWithObstacle(Boolean source, Boolean dest, Boolean obstacle, Number thr)
Dynamically computes distributed routes between regions of a network, and dynamically adapts to shape and changes of the network topology. The channel is a Boolean field that is true for devices near the shortest route from a given (distributed) source to a (distributed) destination.
- Parameters:
source
- whether the device is a sourcedest
- whether the device is a destinationobstacle
- whether the device is an obstaclethr
- threshold for Double comparison (e.g.
-
channel2
final Boolean channel2(Boolean source, Object destination, Number width)
Channel pattern.
- Parameters:
source
- whether the device is a sourcewidth
- how much to dilate the channel
-
channel2WithObstacle
final Boolean channel2WithObstacle(Boolean source, Object destination, Boolean obstacle, Number width)
Channel pattern.
- Parameters:
source
- whether the device is a sourceobstacle
- whether the device is an obstaclewidth
- how much to dilate the channel
-
closerThan
final Boolean closerThan(Boolean source, Number range)
- Parameters:
source
- whether the device is a sourcerange
- range
-
closerThanWithMetric
final Boolean closerThanWithMetric(Boolean source, Function1<Unit, Number> metric, Number range)
- Parameters:
source
- whether the device is a sourcemetric
- how to estimate the distancerange
- range
-
crfGradient
final Number crfGradient(Boolean source, Number maxHop)
Self-healing gradient algorithm that reconfigures in O(diameter) time. Requires euclidean metric.
- Parameters:
source
- whether the device is a sourcemaxHop
- communication max range
-
crfGradientWithMetric
final Number crfGradientWithMetric(Boolean source, Function1<Unit, Number> metric, Number maxHop)
Self-healing gradient algorithm that reconfigures in O(diameter) time. Requires euclidean metric.
- Parameters:
source
- whether the device is a sourcemetric
- how to estimate distances without lagmaxHop
- communication max range
-
bisGradient
final Number bisGradient(Boolean source, Number radius, Number speed)
Self-healing gradient algorithm with single-path reaction speed.
- Parameters:
source
- whether the device is a sourceradius
- communication max rangespeed
- estimate of single-path speed
-
bisGradientWithMetric
final Number bisGradientWithMetric(Boolean source, Function1<Unit, Number> metric, Number radius, Number speed)
Self-healing gradient algorithm with single-path reaction speed.
- Parameters:
source
- whether the device is a sourcemetric
- how to estimate distances without lagradius
- communication max rangespeed
- estimate of single-path speed
-
dilate
final Boolean dilate(Boolean region, Number width)
Dilate a spatial region.
- Parameters:
region
- whether the device is inside the regionwidth
- how much to dilate
-
dilateWithMetric
final Boolean dilateWithMetric(Boolean region, Function1<Unit, Number> metric, Number width)
Dilate a spatial region.
- Parameters:
region
- whether the device is inside the regionmetric
- how to estimate the distance between deviceswidth
- how much to dilate
-
directProjection
final Boolean directProjection(Boolean source, Boolean obstacle)
Forecast obstacles along a path to the source.
- Parameters:
source
- whether the device is a sourceobstacle
- whether the device is an obstacle
-
directProjectionWithMetric
final Boolean directProjectionWithMetric(Boolean source, Boolean obstacle, Function1<Unit, Number> metric)
Forecast obstacles along a path to the source.
- Parameters:
source
- whether the device is a sourceobstacle
- whether the device is an obstaclemetric
- how to estimate neighbors distances
-
distanceBetween
final Number distanceBetween(Boolean source, Boolean dest)
Smallest distance between source and destination devices.
- Parameters:
source
- whether the current device is a sourcedest
- whether the current device is a destination
-
distanceBetweenWithMetric
final Number distanceBetweenWithMetric(Boolean source, Boolean dest, Function1<Unit, Number> metric)
Smallest distance between source and destination devices.
- Parameters:
source
- whether the current device is a sourcedest
- whether the current device is a destinationmetric
- estimate distance from other devices
-
distanceTo
final Unit distanceTo(Object source)
-
distanceToWithMetric
final Unit distanceToWithMetric(Object source, Object metric)
-
roundTripTime
final Unit roundTripTime(Number d)
Estimate worst propagation time considering a message round trip.
- Parameters:
d
- network diameter
-
flex_distorce
final Unit flex_distorce(Object minD, Object metric)
-
flexGradient
final Unit flexGradient(Boolean source, Number epsilon, Number rate, Number range, Number distortion)
Flex-Gradient.
- Parameters:
source
- whether the device is a sourceepsilon
- tolerancerate
- communication raterange
- communication rangedistortion
- distortion
-
flexGradientWithMetric
final Unit flexGradientWithMetric(Boolean source, Number epsilon, Number rate, Number range, Number distortion, Function1<Unit, Number> metric)
Flex-Gradient.
- Parameters:
source
- whether the device is a sourceepsilon
- tolerancerate
- communication raterange
- communication rangedistortion
- distortionmetric
- estimate distance from other devices
-
Gnull
final <T extends Any> T Gnull(T v, T default)
Wrapper for G error. For example: G(aBool, aBool, aMetric, (v) -> { Gnull(v, false) ... } assure that G is not broken in case minHood(..., ...) returns Infinity.
- Parameters:
v
- value to be checkeddefault
- default value to avoid to broke G
-
gradcast
final <T extends Any> T gradcast(Boolean source, T local, Number gradient, Function1<T, T> accumulate)
Gradcast.
- Parameters:
source
- whether the device is a sourcelocal
- local valuegradient
- gradient to followaccumulate
- how to accumulate local values
-
gradient
final <T extends Any> <ERROR CLASS> gradient(Boolean source, T init, Function1<Unit, Number> metric, Function1<T, T> accumulate)
Spread and extend information with distance from the source region.
- Parameters:
source
- whether the current device is a sourceinit
- initial value of the computationmetric
- estimate distance from other devicesaccumulate
- how to accumulate the value
-
hopBroadcast
final Unit hopBroadcast(Object source, Object value)
-
hopDistanceTo
final Unit hopDistanceTo(Object source)
-
multiG
final <U extends Any, I extends Any, D extends Any, T extends Any> <ERROR CLASS> ,T,Function1,Function1)>multiG(<ERROR CLASS> sources, ,T,Function1,Function1)>T init, Function1<Unit, Number> metric, Function1<,T,Function1,Function1)>T, ,T,Function1,Function1)>T> accumulate)
Run an instance of G from every source.
- Parameters:
sources
- list of active sourcesinit
- initial value of the computationmetric
- estimate distance from other devicesaccumulate
- how to accumulate the value
-
multiGradient
final <U extends Any, I extends Any, D extends Any, T extends Any> <ERROR CLASS> ,T,Function1,Function1)>multiGradient(<ERROR CLASS> sources, ,T,Function1,Function1)>T init, Function1<Unit, Number> metric, Function1<,T,Function1,Function1)>T, ,T,Function1,Function1)>T> accumulate)
Spread and extend information with distance from multiple source regions.
- Parameters:
sources
- list of active sourcesinit
- initial value of the computationmetric
- estimate distance from other devicesaccumulate
- how to accumulate the value
-
neighborhood
final Number neighborhood()
Count the number of neighbors.
-
nbrRangeHop
final Unit nbrRangeHop()
-
nbrRangeLag
final Unit nbrRangeLag(Object metric, Object lagMetric, Object speed)
-
descend
final Boolean descend(Boolean source, Number potential)
Shortest path according to a potential.
- Parameters:
source
- whether the device is a sourcepotential
- potential
-
rendezvous
final Boolean rendezvous(Boolean source, Boolean dest)
Shortest path.
- Parameters:
source
- whether the device is the sourcedest
- whether the device is the destination
-
shortestPath
final Boolean shortestPath(Boolean source, Object destination)
Dynamically computes the shortest route between regions of a network, and dynamically adapts to shape and changes of the network topology. The shortest path is a Boolean field that is true for devices near the shortest route from a given (distributed) source to a (distributed) destination.
- Parameters:
source
- whether the device is the source
-
vm
final <T extends Any> T vm(Boolean source, Number range, Function1<Unit, T> f, T null)
Entry point for a computation.
- Parameters:
source
- whether the device is a sourcerange
- spreading constraintf
- entry pointnull
- default value
-
vmWithMetric
final <T extends Any> T vmWithMetric(Boolean source, Function1<Unit, Number> metric, Number range, Function1<Unit, T> f, T null)
Entry point for a computation.
- Parameters:
source
- whether the device is a sourcemetric
- how to estimate neighbors distancesrange
- spreading constraintf
- entry pointnull
- default value
-
voronoiPatitioning
final <T extends Any> T voronoiPatitioning(Boolean source, T id)
Computing a Voronoi partition is an operation that is frequently useful in distributed systems. Given an initial set of seed devices, a Voronoi partition assigns each device to the partition of the nearest seed, effectively breaking the network up into zones of influence around key elements.
- Parameters:
source
- whether the device is a seedid
- partition id
-
voronoiPatitioningWithMetric
final <T extends Any> T voronoiPatitioningWithMetric(Object seed, T id, Function1<Unit, Number> metric)
Computing a Voronoi partition is an operation that is frequently useful in distributed systems. Given an initial set of seed devices, a Voronoi partition assigns each device to the partition of the nearest seed, effectively breaking the network up into zones of influence around key elements.
- Parameters:
id
- partition idmetric
- how to estimate the distances of the neighbors
-
-
-
-