navlie.batch.problem.Problem¶
- class navlie.batch.problem.Problem(solver: str = 'GN', max_iters: int = 100, step_tol: float = 1e-07, ftol: float | None = None, gradient_tol: float | None = None, tau: float = 1e-11, verbose: bool = True)¶
Bases:
object
Main class for building nonlinear least squares problems.
- add_residual(residual: ~navlie.batch.residuals.Residual, loss: ~navlie.batch.losses.LossFunction = <navlie.batch.losses.L2Loss object>)¶
Adds a residual to the problem, along with a robust loss function to use. Default loss function is the standard L2Loss.
- Parameters:
residual (Residual) – the error term to be added to the problem.
loss (LossFunction, optional) – robust loss to be used for this residual, by default L2Loss().
- set_variables_constant(keys: List[Hashable])¶
Sets a variable to be held constant during optimization.
- Parameters:
keys (List[Hashable]) – List of keys to be held constant
- solve()¶
Solve the problem using either Gauss-Newton or Levenberg-Marquardt.
- compute_error_jac_cost(variables: Dict[Hashable, State] | None = None) → Tuple[ndarray, ndarray, float]¶
Computes the full error vector, Jacobian, and cost of the problem.
- get_covariance_block(key_1: Hashable, key_2: Hashable) → ndarray¶
Retrieve the covariance block corresponding to two variables.
- Parameters:
key_1 (Hashable) – Key of first variable.
key_2 (Hashable) – Key of second variable.
- Returns:
Covariance block corresponding to the two variables.
- Return type:
np.ndarray
- compute_covariance()¶
Compute covariance matrix after convergence of problem.