distsum: Computes distsum function

distsumR Documentation

Computes distsum function

Description

The objective function and the gradient of the objective function for the min-sum location problem.

Usage

distsum(o, x = 0, y = 0, lp = numeric(0))

Arguments

o

An object of loca.p class.

x

The x coordinate of the point to be evaluated.

y

The y coordinate of the point to be evaluated.

lp

If given, then l_p norm will be used instead of the Euclidean norm.

Details

The function zsum is deprecated and will be removed from new versions of the package.

Value

distsum returns the objective function of the min-sum location problem, \sum_{a_i \in o} w_i d(a_i, (x,y)), where d(a_i, (x,y)) gives the euclidean or the l_p distances between a_i and the point (x,y).

See Also

See also orloca-package and distsummin.

Examples

# A new unweighted loca.p object
loca <- loca.p(x = c(-1, 1, 1, -1), y = c(-1, -1, 1, 1))
# Evaluation of distsum at (0, 0)
distsum(loca)

# Evaluation of distsum at (1, 3)
distsum(loca, 1, 3)
# Compute the objective function at point (3, 4) using lp norm and p = 2.5
distsum(loca, 3, 4, lp=2.5)
# The gradient function at (1,3)
distsumgra(loca, 1, 3)


orloca documentation built on Feb. 1, 2024, 3 p.m.