{ "cells": [ { "cell_type": "markdown", "id": "a58d890a", "metadata": {}, "source": [ "# NonlinearFactorGraph Class Documentation\n", "\n", "*Disclaimer: This documentation was generated by AI and may require human revision for accuracy and completeness.*\n", "\n", "## Overview\n", "\n", "The `NonlinearFactorGraph` class in GTSAM is a key component for representing and solving nonlinear factor graphs. A factor graph is a bipartite graph that represents the factorization of a function, commonly used in probabilistic graphical models. In the context of GTSAM, it is used to represent the structure of optimization problems, particularly in the domain of simultaneous localization and mapping (SLAM) and structure from motion (SfM).\n", "\n", "## Key Functionalities\n", "\n", "### Construction and Initialization\n", "\n", "- **Constructor**: The class provides a default constructor to initialize an empty nonlinear factor graph.\n", "\n", "### Factor Management\n", "\n", "- **add**: This method allows adding a new factor to the graph. Factors represent constraints or measurements in the optimization problem.\n", "- **reserve**: Pre-allocates space for a specified number of factors, optimizing memory usage when the number of factors is known in advance.\n", "\n", "### Graph Operations\n", "\n", "- **resize**: Adjusts the size of the factor graph, which can be useful when dynamically modifying the graph structure.\n", "- **remove**: Removes a factor from the graph, identified by its index.\n", "\n", "### Querying and Access\n", "\n", "- **size**: Returns the number of factors currently in the graph.\n", "- **empty**: Checks if the graph contains any factors.\n", "- **at**: Accesses a specific factor by its index.\n", "- **back**: Retrieves the last factor in the graph.\n", "- **front**: Retrieves the first factor in the graph.\n", "\n", "### Optimization and Linearization\n", "\n", "- **linearize**: Converts the nonlinear factor graph into a linear factor graph at a given linearization point. This is a crucial step in iterative optimization algorithms like Gauss-Newton or Levenberg-Marquardt.\n", " \n", " The linearization process involves computing the Jacobian matrices of the nonlinear functions, resulting in a linear approximation:\n", " \n", " $$ f(x) \\approx f(x_0) + J(x - x_0) $$\n", " \n", " where $J$ is the Jacobian matrix evaluated at the point $x_0$.\n", "\n", "### Utilities\n", "\n", "- **equals**: Compares two nonlinear factor graphs for equality, considering both the structure and the factors themselves.\n", "- **clone**: Creates a deep copy of the factor graph, including all its factors.\n", "\n", "## Usage Notes\n", "\n", "The `NonlinearFactorGraph` class is designed to be flexible and efficient, allowing users to construct complex optimization problems by adding and managing factors. It integrates seamlessly with GTSAM's optimization algorithms, enabling robust solutions to large-scale nonlinear problems.\n", "\n", "For effective use, it is important to understand the nature of the factors being added and the implications of linearization on the optimization process. The class provides a robust interface for managing the lifecycle of a factor graph, from construction through to optimization and solution extraction." ] } ], "metadata": {}, "nbformat": 4, "nbformat_minor": 5 }