|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.imsl.math.NonNegativeLeastSquares
public class NonNegativeLeastSquares
Solves a linear least squares problem with nonnegativity constraints.
NonNegativeLeastSquares
solves the problem
If a starting point is provided, those entries of that are are first combined with a descent gradient component. The start point is the origin. When is not provided the algorithm uses only the gradient to verify that an optimum has been found. The algorithm completes using only the gradient components to reach an optimum. For more information, see Lawson and Hanson (1974).
BoundedVariableLeastSquares
,
Example,
Serialized FormNested Class Summary | |
---|---|
static class |
NonNegativeLeastSquares.TooManyIterException
Maximum number of iterations has been exceeded. |
static class |
NonNegativeLeastSquares.TooMuchTimeException
Maximum time allowed for solve is exceeded. |
Constructor Summary | |
---|---|
NonNegativeLeastSquares(double[][] a,
double[] b)
Construct a new NonNegativeLeastSquares instance to solve Ax-b where x is a vector of n unknowns. |
Method Summary | |
---|---|
double[] |
getDualSolution()
Returns the dual solution vector, w. |
int |
getIterations()
Returns the number of iterations used to find the solution. |
double |
getResidualNorm()
Returns the euclidean norm of the residual vector, . |
double[] |
getSolution()
Returns the solution to the problem, x. |
void |
setDualTolerance(double dualTolerance)
Sets the dual tolerance. |
void |
setGuess(double[] guess)
Sets the initial guess. |
void |
setMaximumTime(long maximumTime)
Sets the maximum time allowed for the solve step. |
void |
setMaxIterations(int maxIterations)
Sets the maximum number of iterations. |
void |
setNormTolerance(double normTolerance)
Sets the residual norm tolerance. |
void |
setRankTolerance(double rankTolerance)
Sets the tolerance used for the incoming column rank deficient check. |
void |
solve()
Finds the solution to the problem for the current constraints. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NonNegativeLeastSquares(double[][] a, double[] b)
a
- the double
input matrix.b
- a double
array of length a.length
.Method Detail |
---|
public double[] getDualSolution()
double
array containing the dual solution vector,
w.public int getIterations()
int
containing the number of iterations.public double getResidualNorm()
double
containing the euclidean norm of the
residual vector.public double[] getSolution()
double
array containing the solution.public void setDualTolerance(double dualTolerance)
dualTolerance
- a double
containing the dual tolerance.public void setGuess(double[] guess)
guess
- a double
array containing the initial guess.
If set, the guess is used in a two-phase algorithm where the
positive components are matched with positive gradients to
choose an incoming column. If not set, the algorithm uses
only the gradient to verify that an optimum has been found.public void setMaximumTime(long maximumTime)
maximumTime
- a long
value specifying the maximum
time, in milliseconds, to be allowed for the solve
step. If maximumTime
is less than or
equal to zero, then no time
limit is imposed. By default, there is no time limit.public void setMaxIterations(int maxIterations)
maxIterations
- an int
specifying the maximum number of
iterations. The default is three times
a[0].length
.public void setNormTolerance(double normTolerance)
normTolerance
- a double
containing the residual norm
tolerance. The computation stops if , where rnorm is the
residual norm. By default, the value is 0.public void setRankTolerance(double rankTolerance)
rankTolerance
- a double
value used to check for rank
deficiency. The default value is 2.220e-016.public void solve() throws NonNegativeLeastSquares.TooManyIterException, NonNegativeLeastSquares.TooMuchTimeException
TooManyIterationsException
- is thrown if the maximum number of
iterations is exceeded.
NonNegativeLeastSquares.TooMuchTimeException
- is thrown if the maximum time allowed for
solve is exceeded.
NonNegativeLeastSquares.TooManyIterException
|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |