> For the complete documentation index, see [llms.txt](https://ceres-solver-tutorial-cn.gitbook.io/ceres/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ceres-solver-tutorial-cn.gitbook.io/ceres/optimization-tutorial/non-linear-least-squares/introduction.md).

# Introduction

Ceres 可以鲁棒的解决以下形式的带有边界约束的非线性最小二乘问题

$$
\min\_{\mathbf{x}}\frac{1}{2}\sum\_{i}^{}\tau *{i}\left ( \parallel f\_i\left(x*{i1}, ..., x\_{ik}\right)\parallel ^2 \right )\ s.t.\ \ l\_j \le x\_j \le \mu\_{j}
$$

这种形式的问题广泛出现在科学研究和工程领域中，从统计学中的 [fitting curves](http://en.wikipedia.org/wiki/Nonlinear_regression) 问题到计算机视觉中的 [3D models from photographs](http://en.wikipedia.org/wiki/Bundle_adjustment) 问题。

在本章中，我们将学习如何使用 Ceres Solver 求解上述问题，本章中描述的所有示例以及更完整工作代码可以在 [examples](https://ceres-solver.googlesource.com/ceres-solver/+/master/examples/) 目录中找到。

表达式 $$\tau *{i}\left(\left|f*{i}\left(x\_{i\_{1}}, \ldots, x\_{i\_{k}}\right)\right|^{2}\right)$$ 在 Ceres 中是一个 `ResidualBlock` ，其中 $$f\_{i}(\cdot)$$ 在 Ceres 中是一个 `CostFunction` ，它的计算又需要 $$x\_{ij}$$ 这些参数的参与， $$\left\[x\_{i\_{1}}, \ldots, x\_{i\_{k}}\right]$$ 统称一个参数块。在大多数优化问题中，小组标量一起出现。例如，平移向量的三个分量和定义相机姿态的四元数的四个分量。我们将这样一组小标量称为 `ParameterBlock`。当然 `ParameterBlock` 也可以只有一个分量。$$l\_{j}$$ and $$u\_{j}$$ 是参数块 $$x\_{j}$$ 的上下界。 $$\tau \_{i}$$ 是一个 `Lossfunction`。它是一个标量函数，用于减小非线性优化问题中的异常值对优化的影响。

在特殊情况下，当 $$\tau *{i}(x)=x$$，是一个恒等映射，并且 $$l*{j}=-\infty$$ and $$u\_{j}=\infty$$ 我们就能得到常见的非线性优化问题形式如下：

$$
\frac{1}{2} \sum\_{i}\left|f\_{i}\left(x\_{i\_{1}}, \ldots, x\_{i\_{k}}\right)\right|^{2}
$$


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ceres-solver-tutorial-cn.gitbook.io/ceres/optimization-tutorial/non-linear-least-squares/introduction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
