ldp: Least Distance Programming

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/ldp.R

Description

Solves the following inverse problem:

\min(∑ {x_i}^2)

subject to

Gx>=h

uses least distance programming subroutine ldp (FORTRAN) from Linpack

Usage

1
ldp(G, H, tol = sqrt(.Machine$double.eps), verbose = TRUE)

Arguments

G

numeric matrix containing the coefficients of the inequality constraints Gx>=H; if the columns of G have a names attribute, they will be used to label the output.

H

numeric vector containing the right-hand side of the inequality constraints.

tol

tolerance (for inequality constraints).

verbose

logical to print ldp error messages.

Value

a list containing:

X

vector containing the solution of the least distance problem.

residualNorm

scalar, the sum of absolute values of residuals of violated inequalities; should be zero or very small if the problem is feasible.

solutionNorm

scalar, the value of the quadratic function at the solution, i.e. the value of ∑ {w_i*x_i}^2.

IsError

logical, TRUE if an error occurred.

type

the string "ldp", such that how the solution was obtained can be traced.

numiter

the number of iterations.

Author(s)

Karline Soetaert <karline.soetaert@nioz.nl>

References

Lawson C.L.and Hanson R.J. 1974. Solving Least Squares Problems, Prentice-Hall

Lawson C.L.and Hanson R.J. 1995. Solving Least Squares Problems. SIAM classics in applied mathematics, Philadelphia. (reprint of book)

See Also

ldei, which includes equalities.

Examples

1
2
3
4
5
# parsimonious (simplest) solution
G <- matrix(nrow = 2, ncol = 2, data = c(3, 2, 2, 4))
H <- c(3, 2)

ldp(G, H)

Example output

$X
[1] 0.6923077 0.4615385

$residualNorm
[1] 4.440892e-16

$solutionNorm
[1] 0.6923077

$IsError
[1] FALSE

$type
[1] "ldp"

$numiter
[1] 1

limSolve documentation built on Nov. 12, 2019, 3 p.m.