Tutorials#
CDOpt is an easy-to-use modular package that separates the manifold modules, the problem descriptions, the automatic differentiation packages, and solvers apart. All of the automatic differentiations are done behind the scenes so the amount of setup that the user needs to do is minimal. Usually, only the following steps are required:
Instantiate a manifold \(\mathcal{M}\) from the
cdopt.manifold
or define \(\mathcal{M} = \{x \in \mathbb{R}^n: c(x) = 0 \}\) by thecdopt.core.basic_manifold
module.Define a cost function \(f\) to minimize over the manifold \(\mathcal{M}\).
Using the
cdopt.core.problem
as a high-level interface to describe the optimization problem.Retrieve the corresponding constraint dissolving function and its differentials from the problem object. Instantiate a solver from various of existing packages, including
scipy.optimize
andtorch.optim
, to minimize the constraint dissolving function without any constraints.
It is worth mentioning that the problem
class in CDOpt integrates various pre-processing and concurrency checking steps for the optimization problems. Moreover, it provides integrated APIs for calling the related solvers. Therefore, although we can run the solvers without the cdopt.core.problem
interface, using cdopt.core.problem
to define the problem is always recommended.