Public Member Functions | |
def | __init__ (self, variableSize, nbVariables) |
def | matrix_form_factor (self, factors) |
def | add_factor (self, factors, reference) |
def | add_factor_constraint (self, factors, reference) |
def | solve (self, eps=1e-8) |
Public Attributes | |
nx | |
N | |
A | |
b | |
C | |
d | |
The class FactorGraph stores a block-sparse linear-constrained quadratic program (LCQP) of variable x=(x1...xn). The size of the problem is set up at construction of the object. Methods add_factor() and add_factor_constraint() are used to set up the problem. Method solve() is used to compute the solution to the problem.
def __init__ | ( | self, | |
variableSize, | |||
nbVariables | |||
) |
Initialize a QP sparse problem as min || A x - b || so that C x = d where x = (x1, .., xn), and dim(xi) = variableSize and n = nbVariables After construction, A, b, C and d are allocated and set to 0.
Definition at line 44 of file factor.py.
References FactorGraph.A, FactorGraph.b, FactorGraph.C, FactorGraph.d, FactorGraph.N, and FactorGraph.nx.
def add_factor | ( | self, | |
factors, | |||
reference | |||
) |
Add a factor || sum_{i} factor[i].matrix * x_{factor[i].index} - reference || to the cost.
Definition at line 74 of file factor.py.
References FactorGraph.A, FactorGraph.b, and FactorGraph.matrix_form_factor().
def add_factor_constraint | ( | self, | |
factors, | |||
reference | |||
) |
Add a factor sum_{i} factor[i].matrix * x_{factor[i].index} = reference to the constraints.
Definition at line 83 of file factor.py.
References FactorGraph.C, FactorGraph.d, and FactorGraph.matrix_form_factor().
def matrix_form_factor | ( | self, | |
factors | |||
) |
Internal function: not designed to be called by the user. Create a factor matrix [ A1 0 A2 0 A3 ... ] where the Ai's are placed at the indexes of the factors.
Definition at line 57 of file factor.py.
References FactorGraph.N, and FactorGraph.nx.
Referenced by FactorGraph.add_factor(), and FactorGraph.add_factor_constraint().
def solve | ( | self, | |
eps = 1e-8 |
|||
) |
Implement a LCQP solver, with numerical threshold eps.
Definition at line 92 of file factor.py.
References FactorGraph.A, FactorGraph.b, FactorGraph.C, FactorGraph.d, FactorGraph.N, and FactorGraph.nx.