This function generates clustered networks. It first generates \(n\) cluster
centeres via a latin hypercube design to ensure space-filling property, i. e.,
to ensure, that the clusters are placed far from each other.
It then distributes points to the clusters according to
gaussian distributions using the cluster centers as the mean vector and
the distance to the nearest neighbour cluster center as the variance.
This procedure works well if the box constraints of the hypercube are
not too low (see the lower bound for the upper
parameter).
generateClusteredNetwork(n.cluster, n.points, n.dim = 2L,
generator = lhs::maximinLHS, lower = 0, upper = 100,
sigmas = NULL, n.depots = NULL,
distribution.strategy = "equally.distributed",
cluster.centers = NULL, out.of.bounds.handling = "mirror",
name = NULL, ...)
Arguments
n.cluster |
[integer(1) ]
Desired number of clusters. This is ignored if cluster.centers is
provided. |
n.points |
[integer(1) ]
Number of points for the network. |
n.dim |
[integer(1) ]
Number of dimensions. Default ist 2. |
generator |
[function ]
Function which generates cluster centers. Default is maximinLHS . |
lower |
[numeric(1) ]
Lower box constaint for cube. Default is 0 . |
upper |
[numeric(1) ]
Upper box constaint for cube. Default is 100 . |
sigmas |
[list | NULL ]
Unnamed list of length n.cluster containing a covariance matrix
for each cluster. Default is NULL . In this case the covariance
matrix is a diagonal matrix containing the distances to the nearest neighbour
cluster center as diagonal elements. |
n.depots |
[integer(1) ]
Number of depots in instances for the Vehicle Routing Problem (VRP).
Default is NULL , i. e., no depots. The proceeding is as follows:
If n.depots is 1L , a random cluster center is defined to be the depot.
If n.depots is 2L , the second depot has maximal distance to the first.
At the moment at most two depots are possible. |
distribution.strategy |
[character(1) ]
Define the strategy to distribute n.points on the n.cluster clusters.
Default is “equally.distributed”, which is the only option at the moment. |
cluster.centers |
[matrix ]
Matrix of cluster centres of dimension n.cluster x n.dim . If
this is set, cluster centres are not generated automatically.
Default is NULL . |
out.of.bounds.handling |
[character(1) ]
Clusters are generated on base of a multivariate gaussian distribution with
the cluster center as the mean vector. Possibly some of the points might fall
out of bounds, i. e., get coordinates larger than upper or lower than
lower . There are two strategies to force them to stick to the bounds:
- “reset”
Set the violating coordinates to the bounds.
- “mirror”
Mirror the coordinates at the violated axis.
Default is “mirror”. |
name |
[character(1) | NULL ]
Optional name for the generated network. Default is NULL . In this case
a random name is generated. |
... |
[any ]
Currently not used. |
Value
[ClusteredNetwork
]
Object of type ClusteredNetwork
.
See also
Examples
x = generateClusteredNetwork(n.points = 20L, n.cluster = 2L)
y = generateClusteredNetwork(n.points = 40L, n.cluster = 3L, n.depots = 2L)
z = generateClusteredNetwork(n.points = 200L, n.cluster = 10L, out.of.bounds.handling = "reset")