Specify QP problems as literal C++ equations on named variables

Switch branches/tags
Nothing to show

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Files

Failed to load latest commit information.
Type
Name
Commit time

Introduction

QuadProgMm is a C++ library providing a domain specific language to express Quadratic programming problems as literal C++ equations on named variables.

These problems are generally specified using matrices and vectors, because it is the generic mathematical form used by resolution algorithms. This is sometime tedius, and QuadProgMm tries to fix that.

Note that QuadProgMm does not implement the arguably complex linear algebra algorithms for solving these problems and delegates all that hard work to QuadProg++, by Luca Di Gaspero.

It's licensed under the MIT license. Its documentation and its source code are on GitHub.

Questions? Remarks? Bugs? Want to contribute? Open an issue!

Quick start

Clone and build:

```\$ git clone https://github.com/jacquev6/QuadProgMm.git
\$ make lib
```

```#include <iostream>

int main() {
```

Create variables:

```Variable a, b, c;
```

And a quadratic expression to optimize:

```QuadraticExpression q = a + b + (a - b) * (a - b) + c + (b - c) * (b - c);
```

And constraints:

```std::vector<Constraint> constraints {
a <= 1,
c >= 4,
a - 2 * b <= 12,
};
```

Finally, solve:

```  Solution solution = minimize(q, constraints);

std::cout << "a: " << solution.get(a) << std::endl;
std::cout << "b: " << solution.get(b) << std::endl;
std::cout << "c: " << solution.get(c) << std::endl;
std::cout << "Cost: " << solution.getCost() << std::endl;
}
```

Build and run:

```\$ g++ -Ipath/to/QuadProgMm/src quick_start.cpp path/to/QuadProgMm/build/libquadprogmm.a path/to/QuadProgMm/QuadProgpp/src/libquadprog.a -o quick_start
\$ ./quick_start
```

Result:

```a: 1
b: 2
c: 4
Cost: 16
```

Specify QP problems as literal C++ equations on named variables

Releases

No releases published

Packages 0

No packages published