edge.repulsive.stage() performs one gradient-descent stage
for the objective evaluated by edge.repulsive.state(). It uses Armijo
backtracking, optionally recenters coordinates after each proposal, and
returns the final coordinates plus a per-iteration trace.
edge.repulsive.stage(
coords,
edges,
edge.lengths,
edge.weights = NULL,
lambda = 0,
edge.family = c("quadratic", "upper_barrier"),
eps.plus = 0.35,
beta = 0,
pair.index = NULL,
pair.weights = NULL,
repulsion.family = c("log", "inverse_power"),
repulsion.delta = 0.001,
repulsion.power = 1,
max.iter = 80L,
initial.step = 0.02,
step.shrink = 0.5,
armijo = 1e-04,
min.step = 1e-08,
grad.tol = 1e-07,
recenter = TRUE,
distance.eps = 1e-10,
return.frames = FALSE,
engine = c("cpp", "R")
)A list with coords, final state, a data-frame trace, and,
when requested, a list of coordinate frames.
Numeric n by dim coordinate matrix.
Integer or numeric matrix with two columns containing 1-based graph edge endpoints.
Numeric vector of target edge lengths, parallel to
edges.
Optional non-negative edge weights. Defaults to one.
Repulsion strength.
Edge potential family, either "quadratic" or
"upper_barrier".
Upper-barrier slack parameter.
Upper-barrier strength. When beta <= 0, the edge potential is
quadratic.
Optional two-column matrix of 1-based vertex pairs for the
repulsion term. If NULL and lambda > 0, all unordered pairs are used.
Optional pair weights, parallel to pair.index.
Repulsion potential family, either "log" or
"inverse_power".
Small positive softening parameter for pair distances.
Power used by the "inverse_power" repulsion.
Maximum number of gradient-descent iterations.
Initial gradient step size.
Multiplicative shrink factor used by backtracking.
Armijo sufficient-decrease coefficient.
Minimum allowable step before the stage stops.
Gradient-norm stopping tolerance.
Logical; whether to recenter coordinates after each proposal.
Small positive distance floor used in derivatives.
Logical; whether to return accepted coordinate frames. Frame 0 is the starting coordinate matrix and later frames are accepted updates.
Backend engine. "cpp" is the default; "R" uses the
reference implementation.
cycle_edges <- edges.cycle(6)
theta <- seq(0, 2 * pi, length.out = 7)[-7]
initial <- cbind(cos(theta), sin(theta))
fit <- edge.repulsive.stage(
initial, cycle_edges, rep(1, nrow(cycle_edges)),
lambda = 0.1, max.iter = 1, engine = "R"
)
Run the code above in your browser using DataLab