public class KKTSolver
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
KKTSolver.Status
Described whether or not a solution was found.
|
Modifier and Type | Field and Description |
---|---|
static boolean |
computeResidualMG |
static boolean |
myDebug |
static java.lang.String |
myQPTestCaseFile |
static boolean |
useBlockSolves |
Constructor and Description |
---|
KKTSolver() |
KKTSolver(SparseSolverId solverType) |
Modifier and Type | Method and Description |
---|---|
void |
analyze(SparseBlockMatrix M,
int sizeM,
SparseBlockMatrix GT,
VectorNd Rg,
int typeM)
Performs symbolic analysis on the equality portion of the KKT system
defined by matrices M and GT.
|
void |
analyze(VectorNd Mdiag,
int sizeM,
SparseBlockMatrix GT,
VectorNd Rg)
Performs symbolic analysis on the equality portion of the KKT system
defined by a diagonal M matrix and G.
|
void |
analyzeMG(java.lang.Object M,
int sizeM,
SparseBlockMatrix GT,
VectorNd Rg,
int typeM)
Performs symbolic analysis on the equality portion of the KKT system
defined by M and G.
|
void |
dispose() |
void |
factor(SparseBlockMatrix M,
int sizeM,
SparseBlockMatrix GT,
VectorNd Rg)
Does a numeric factorization of a KKT system containg only equality
constraints.
|
void |
factor(SparseBlockMatrix M,
int sizeM,
SparseBlockMatrix GT,
VectorNd Rg,
SparseBlockMatrix NT,
VectorNd Rn)
Does a numeric factorization of a KKT system containing equality and
inequality constraints.
|
void |
factor(SparseBlockMatrix M,
int sizeM,
SparseBlockMatrix GT,
VectorNd Rg,
SparseBlockMatrix NT,
VectorNd Rn,
SparseBlockMatrix DT,
VectorNd Rd)
Does a numeric factorization of a KKT system containg equality,
inequality, and friction constraints.
|
void |
factor(VectorNd Mdiag,
int sizeM,
SparseBlockMatrix GT,
VectorNd Rg)
Does a numeric factorization of a KKT system containg only equality
constraints.
|
void |
factor(VectorNd Mdiag,
int sizeM,
SparseBlockMatrix GT,
VectorNd Rg,
SparseBlockMatrix NT,
VectorNd Rn)
Does a numeric factorization of a KKT system containg equality and
inequality constraints.
|
KKTSolver.Status |
factorAndSolve(SparseBlockMatrix M,
int sizeM,
SparseBlockMatrix GT,
VectorNd Rg,
VectorNd vel,
VectorNd lam,
VectorNd bm,
VectorNd bg,
int tolExp)
Does a numeric factorization of a KKT system containg only equality
constraints.
|
void |
finalize() |
VectorNi |
getLcpState() |
MatrixNd |
getLinearMatrix() |
DirectSolver |
getMatrixSolver() |
int |
getNumNonZerosInFactors() |
void |
initialize() |
boolean |
isFactored() |
boolean |
lastSolveWasIterative() |
void |
printLinearProblem(java.io.PrintWriter pw,
VectorNd bf,
VectorNd bg,
java.lang.String fmtStr,
boolean omitLowerRightDiagonal) |
void |
printStructure(java.io.PrintStream ps) |
void |
printValues(java.io.PrintStream ps,
java.lang.String fmtStr) |
void |
printValues(java.io.PrintStream ps,
java.lang.String fmtStr,
double[] vals,
int[] rowOffs,
int[] colIdxs,
int size,
int numVals) |
double |
residual(SparseBlockMatrix M,
int sizeM,
SparseBlockMatrix GT,
VectorNd Rg,
SparseBlockMatrix NT,
VectorNd Rn,
VectorNd vel,
VectorNd lam,
VectorNd the,
VectorNd bm,
VectorNd bg,
VectorNd bn) |
KKTSolver.Status |
solve(VectorNd vel,
VectorNd lam,
VectorNd bm,
VectorNd bg)
Solves the equality parts of a factored system.
|
KKTSolver.Status |
solve(VectorNd vel,
VectorNd lam,
VectorNd the,
VectorNd bm,
VectorNd bg,
VectorNd bn)
Solves the equality and inequality parts of a factored system.
|
KKTSolver.Status |
solve(VectorNd vel,
VectorNd lam,
VectorNd the,
VectorNd phi,
VectorNd bm,
VectorNd bg,
VectorNd bn,
VectorNd bd,
VectorNd flim)
Solves the equality, inequality, and frictional parts of a factored
system.
|
KKTSolver.Status |
solve(VectorNd vel,
VectorNd lam,
VectorNd the,
VectorNd phi,
VectorNd bm,
VectorNd bg,
VectorNd bn,
VectorNd bd,
VectorNd flim,
VectorNi state,
VectorNi contactIdxs)
Solves the equality, inequality, and frictional parts of a factored
system.
|
KKTSolver.Status |
solve(VectorNd vel,
VectorNd lam,
VectorNd the,
VectorNd bm,
VectorNd bg,
VectorNd bn,
VectorNi state)
Solves the equality and inequality parts of a factored system.
|
void |
solveMG(double[] Xbuf,
double[] Bbuf,
int nrhs) |
void |
solveMG(VectorNd x,
VectorNd b)
Solve the system
|
void |
solveMG(VectorNd xm,
VectorNd xg,
VectorNd bm,
VectorNd bg)
Solve the system
|
public static boolean computeResidualMG
public static boolean useBlockSolves
public static java.lang.String myQPTestCaseFile
public static boolean myDebug
public KKTSolver(SparseSolverId solverType)
public KKTSolver()
public void analyzeMG(java.lang.Object M, int sizeM, SparseBlockMatrix GT, VectorNd Rg, int typeM)
public void analyze(VectorNd Mdiag, int sizeM, SparseBlockMatrix GT, VectorNd Rg)
Mdiag
- vector defining the diagonal entries of MsizeM
- size of MGT
- Sparse matrix defining the transpose of GRg
- if non-null, supplies the diagonal regularization matrix Rpublic void analyze(SparseBlockMatrix M, int sizeM, SparseBlockMatrix GT, VectorNd Rg, int typeM)
M
- Sparse matrix defining MsizeM
- size of MGT
- Sparse matrix defining the transpose of GRg
- if non-null, supplies the diagonal regularization matrix RtypeM
- describes the type of M, to be used in determining
how the resulting KKT system should be factored. Should be
either Matrix.INDEFINITE
, Matrix.SYMMETRIC
, or
Matrix.SPD
.public void factor(SparseBlockMatrix M, int sizeM, SparseBlockMatrix GT, VectorNd Rg)
public void factor(SparseBlockMatrix M, int sizeM, SparseBlockMatrix GT, VectorNd Rg, SparseBlockMatrix NT, VectorNd Rn)
public void factor(SparseBlockMatrix M, int sizeM, SparseBlockMatrix GT, VectorNd Rg, SparseBlockMatrix NT, VectorNd Rn, SparseBlockMatrix DT, VectorNd Rd)
public void factor(VectorNd Mdiag, int sizeM, SparseBlockMatrix GT, VectorNd Rg)
public void factor(VectorNd Mdiag, int sizeM, SparseBlockMatrix GT, VectorNd Rg, SparseBlockMatrix NT, VectorNd Rn)
public boolean isFactored()
public KKTSolver.Status solve(VectorNd vel, VectorNd lam, VectorNd the, VectorNd phi, VectorNd bm, VectorNd bg, VectorNd bn, VectorNd bd, VectorNd flim)
public KKTSolver.Status solve(VectorNd vel, VectorNd lam, VectorNd the, VectorNd phi, VectorNd bm, VectorNd bg, VectorNd bn, VectorNd bd, VectorNd flim, VectorNi state, VectorNi contactIdxs)
public KKTSolver.Status solve(VectorNd vel, VectorNd lam, VectorNd the, VectorNd bm, VectorNd bg, VectorNd bn)
public KKTSolver.Status solve(VectorNd vel, VectorNd lam, VectorNd the, VectorNd bm, VectorNd bg, VectorNd bn, VectorNi state)
public double residual(SparseBlockMatrix M, int sizeM, SparseBlockMatrix GT, VectorNd Rg, SparseBlockMatrix NT, VectorNd Rn, VectorNd vel, VectorNd lam, VectorNd the, VectorNd bm, VectorNd bg, VectorNd bn)
public KKTSolver.Status solve(VectorNd vel, VectorNd lam, VectorNd bm, VectorNd bg)
public KKTSolver.Status factorAndSolve(SparseBlockMatrix M, int sizeM, SparseBlockMatrix GT, VectorNd Rg, VectorNd vel, VectorNd lam, VectorNd bm, VectorNd bg, int tolExp)
public VectorNi getLcpState()
public void printStructure(java.io.PrintStream ps)
public void printValues(java.io.PrintStream ps, java.lang.String fmtStr)
public MatrixNd getLinearMatrix()
public void printLinearProblem(java.io.PrintWriter pw, VectorNd bf, VectorNd bg, java.lang.String fmtStr, boolean omitLowerRightDiagonal) throws java.io.IOException
java.io.IOException
public void printValues(java.io.PrintStream ps, java.lang.String fmtStr, double[] vals, int[] rowOffs, int[] colIdxs, int size, int numVals)
public void solveMG(VectorNd x, VectorNd b)
[ M -G ] [ x ] [ b ] [ ] [ ] = [ ] [ G Rg ] [lam] [ a ]using the factorization of
[ M G ] [ ] [ G -Rg ]This requires negating the value of lam from the original solve
public void solveMG(double[] Xbuf, double[] Bbuf, int nrhs)
public void solveMG(VectorNd xm, VectorNd xg, VectorNd bm, VectorNd bg)
[ M -G ] [ x ] [ b ] [ ] [ ] = [ ] [ G Rg ] [lam] [ a ]using the factorization of
[ M G ] [ ] [ G -Rg ]This requires negating the value of lam from the original solve
public int getNumNonZerosInFactors()
public boolean lastSolveWasIterative()
public void dispose()
public void finalize()
finalize
in class java.lang.Object
public DirectSolver getMatrixSolver()
public void initialize()