vnl_solve_qp.h
Go to the documentation of this file.
1 // This is core/vnl/algo/vnl_solve_qp.h
2 #ifndef vnl_solve_qp_h_
3 #define vnl_solve_qp_h_
4 
5 //:
6 // \file
7 // \brief Functions to solve various forms of constrained quadratic programming
8 // \author Tim Cootes
9 
10 #include <vnl/vnl_vector.h>
11 #include <vnl/vnl_matrix.h>
12 #include <vnl/algo/vnl_algo_export.h>
13 
14 //: Solve quadratic programming problem with linear constraints
15 // Minimise F(x)=0.5x'Hx + g'x subject to Ax=b
16 // \param H Hessian of F(x) - must be symmetric
17 // \retval True if successful
19  const vnl_vector<double>& g,
20  const vnl_matrix<double>& A,
21  const vnl_vector<double>& b,
23 
24 //: Solve quadratic programming problem with constraint sum(x)=0
25 // Minimise F(x)=0.5x'Hx + g'x subject to sum(x)=0
26 // Special case of quadratic programming (Equality constraint: x.1=0)
27 // \param H Hessian of F(x) - must be symmetric
28 // \retval True if successful
30  const vnl_vector<double>& g,
32 
33 //: Find non-negative solution to a constrained quadratic programming problem
34 // Minimise F(x)=0.5x'Hx + g'x subject to Ax=b and x(i)>=0 for all i
35 //
36 // Uses a variant of the active set strategy to solve the problem.
37 // This performs a sequence of unconstrained solutions. If the inequality
38 // constraints are violated, the most violated x(i) is set to zero
39 // and a slightly smaller problem is solved.
40 // \param H Hessian of F(x) - must be symmetric
41 // \param x On input, it must satisfy all constraints (Ax=b, x(i)>=0)
42 // \param con_tol Tolerance for testing constraints: |Ax-b|^2<con_tol
43 // \param verbose When true, output error messages to cerr if failed
44 // \retval True if successful
45 bool VNL_ALGO_EXPORT vnl_solve_qp_with_non_neg_constraints(const vnl_matrix<double>& H,
46  const vnl_vector<double>& g,
47  const vnl_matrix<double>& A,
48  const vnl_vector<double>& b,
50  double con_tol = 1e-8,
51  bool verbose=true);
52 
53 //: Find non-negative solution to a constrained quadratic programming problem
54 // Minimise F(x)=0.5x'Hx + g'x subject to sum(x)=1 and x(i)>=0 for all i
55 //
56 // Uses a variant of the active set strategy to solve the problem.
57 // This performs a sequence of unconstrained solutions. If the inequality
58 // constraints are violated, the most violated x(i) is set to zero
59 // and a slightly smaller problem is solved.
60 // \param H Hessian of F(x) - must be symmetric
61 // \param x On input, it must satisfy all constraints (sum(x)=1, x(i)>=0)
62 // \param verbose When true, output error messages to cerr if failed
63 // \retval True if successful
64 bool VNL_ALGO_EXPORT vnl_solve_qp_non_neg_sum_one(const vnl_matrix<double>& H,
65  const vnl_vector<double>& g,
67  bool verbose=true);
68 
69 #endif // vnl_solve_qp_h_
An ordinary mathematical matrix.
bool vnl_solve_qp_with_equality_constraints(const vnl_matrix< double > &H, const vnl_vector< double > &g, const vnl_matrix< double > &A, const vnl_vector< double > &b, vnl_vector< double > &x)
Solve quadratic programming problem with linear constraints.
bool vnl_solve_qp_zero_sum(const vnl_matrix< double > &H, const vnl_vector< double > &g, vnl_vector< double > &x)
Solve quadratic programming problem with constraint sum(x)=0.
bool VNL_ALGO_EXPORT vnl_solve_qp_non_neg_sum_one(const vnl_matrix< double > &H, const vnl_vector< double > &g, vnl_vector< double > &x, bool verbose=true)
Find non-negative solution to a constrained quadratic programming problem.
bool VNL_ALGO_EXPORT vnl_solve_qp_with_non_neg_constraints(const vnl_matrix< double > &H, const vnl_vector< double > &g, const vnl_matrix< double > &A, const vnl_vector< double > &b, vnl_vector< double > &x, double con_tol=1e-8, bool verbose=true)
Find non-negative solution to a constrained quadratic programming problem.