A quick TSSOS tutorial aimed at practioners in robotics / computer vision. I assume the user is familiar with Shor's relaxation / the moment-SOS hierarchy, and focus on how to use TSSOS. Specifically, I focus on:
- The basics of using TSSOS to automatically relax a polynomial optimization problem to a convex semidefinite program
- Extracting the JuMP model from TSSOS to add constraints / use a different solver
Notably, the tutorial does not include:
- Complex, symmetric, matrix, etc. sum of squares
- Using binary variables in TSSOS
- Different types of sparsity
If there is interest, I may expand this tutorial to cover these problems in the future.
Written by Lorenzo Shaikewitz.
First, clone the repo:
git clone https://github.com/lopenguin/TSSOSTutorial.jlIn the repo directly, enter Julia with the repo environment:
julia --projectYou'll need to manually add TSSOS and my helper package SimpleRotations:
(TutorialTSSOS) pkg> add https://github.com/lopenguin/SimpleRotations.jl, https://github.com/lopenguin/TSSOS
# you can use the official TSSOS instead for the features in `simple`You are now ready to run either example script! Return to the Julia REPL and type:
include("scripts/example_pnp_simple.jl")I briefly review the backprojection form of perspective-n-point (PnP) and state the optimization problems solved in these examples.
The maximum likelihood form of the backprojection PnP problem is given by the following optimization problem:
This is the optimization problem solved in pnp_simple.
To define the varaibles:
With a little algebra (including dropping the chirality constraints), we can solve for the optimal
where