# Method for implementing QP solver with matrix terms?

I am trying to implement (in code) a QP solver for the following equation:

$$\min_{u} u^{T} Wu$$

$$s.t. \; \beta u = \tau_{ref}$$ $$Au \leq b$$

See this document, section 5.1 (Page 35)

$$u$$ is a 2n vector of 2-dimensional vectors, $$W$$ is a 2nx2n matrix of weights, $$\beta$$ is a nx3 matrix and $$\tau_{ref}$$ is a 1x3 vector. The goal here is to find the lowest $$u$$ that satisfies the conditions (you can ignore the $$Au \leq b$$ constraint for now).

I'm not a math-scholar by any means, but I'm having problems formulating this into something I can feed a QP solver like Accord.NET.

If you don't want to read the document, $$u$$ is a vector of thrust values delivered by "n" actuators attached to a ship. Since those actuators only operate in 2 dimensions, they are 2-dimensional vectors. This method attempts to find a solution for a total required thrust distributed to the available "n" thrusters.

So my questions are:

• Is the Accord.NET implementation of GoldfarbIdnani the appropriate QP solver to use for this problem? Matlab is not an option and I'd prefer to sticking to open-source/free libraries (C# is preferred, but can do C/C++ bindings if necessary).

• How would I formulate the lambda expression to feed into the QP solver given that most QP solvers that I've found require a formula in the $$2x^2 + xy + y^2 - 5y$$ type format where x/y are not vectors/matricies?

• You can write the equality constraints as inequality constraints, at which point osqp.org could be used via C/C++ in exactly this form. – cdipaolo Oct 19 '19 at 15:47