Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Quadratically Constrained QP with GTSAM

This notebook solves QCQPs with quadratic constraints through AugmentedLagrangianOptimizer. It starts with a two-dimensional geometry example and finishes with quadrotor allocation under rotor bounds and a total-power limit.

Open In Colab

A 2D QCQP with active quadratic constraints

The target lies outside both the unit disk and the strip y^2 <= 0.25. The solution lands where the circular boundary and the upper strip boundary meet.

target = [1.2 0.8]
solution = [0.86602541 0.5       ]
x^2 + y^2 = 1.00000001
y^2 = 0.25000000
violations: equality=0.00e+00, inequality=8.94e-09
Loading...

Quadrotor allocation with total-power constraint

This QCQP uses the same wrench-tracking objective and rotor bounds as the QP notebook, then adds sum(rotor_i^2) <= 2.8. The initial point is feasible and close enough for the augmented Lagrangian method to converge to the active power boundary.

initial rotor thrusts = [1.         0.8        0.85       0.66143783]
solution rotor thrusts = [0.99999829 0.79330414 0.8628766  0.65277555]
total power = 2.80000000 / 2.8
achieved wrench = [ 3.30895459e+00  1.04198800e-01  6.94125698e-02 -1.70344889e-04]
wrench residual = [-0.09104541 -0.0458012  -0.03058743 -0.00017034]
objective = 5.662718e-03, inequality violation = 4.34e-12
Loading...