qpmad
Eigen-based C++ QP solver.
demo.cpp
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4 
5  @copyright 2019 Alexander Sherikov. Licensed under the Apache License,
6  Version 2.0. (see LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @brief
9 */
10 
11 
12 #include <qpmad/solver.h>
13 
14 
15 int main()
16 {
17  Eigen::VectorXd x;
18  Eigen::MatrixXd H;
19  Eigen::VectorXd h;
20  Eigen::MatrixXd A;
21  Eigen::VectorXd Alb;
22  Eigen::VectorXd Aub;
23  Eigen::VectorXd lb;
24  Eigen::VectorXd ub;
25 
26 
27  qpmad::MatrixIndex size = 20;
28  qpmad::MatrixIndex num_ctr = 1;
29 
30  H.setIdentity(size, size);
31  h.setOnes(size);
32 
33 
34  A.resize(num_ctr, size);
35  A.setOnes();
36  Alb.resize(num_ctr);
37  Aub.resize(num_ctr);
38  Alb << -1.5;
39  Aub << 1.5;
40 
41  lb.resize(size);
42  ub.resize(size);
43  lb << 1, 2, 3, 4, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5;
44  ub << 1, 2, 3, 4, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5;
45 
46 
47  qpmad::Solver solver;
48 
49  qpmad::Solver::ReturnStatus status = solver.solve(x, H, h, lb, ub, A, Alb, Aub);
50 
51  return (0);
52 }
int MatrixIndex
Definition: common.h:32
ReturnStatus solve(QPVector &primal, QPMatrix &H, const QPVector &h, const QPMatrix &A, const QPVector &Alb, const QPVector &Aub)
Definition: solver.h:47
int main()
Definition: demo.cpp:15