SHOGUN
v2.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
lib
external
libqp.h
Go to the documentation of this file.
1
/*-----------------------------------------------------------------------
2
* libqp.h: Library for Quadratic Programming optimization.
3
*
4
* The library provides two solvers:
5
* 1. Solver for QP task with simplex constraints.
6
* See function ./lib/libqp_splx.c for definition of the QP task.
7
*
8
* 2. Solver for QP task with box constraints and a single linear
9
* equality constraint.
10
* See function ./lib/libqp_gsmo.c for definiton of the QP task.
11
*
12
* Copyright (C) 2006-2008 Vojtech Franc, xfrancv@cmp.felk.cvut.cz
13
* Center for Machine Perception, CTU FEL Prague
14
*
15
* This program is free software; you can redistribute it and/or
16
* modify it under the terms of the GNU General Public
17
* License as published by the Free Software Foundation;
18
* Version 3, 29 June 2007
19
*-------------------------------------------------------------------- */
20
21
#ifndef libqp_h
22
#define libqp_h
23
24
#include <math.h>
25
26
#include <
shogun/lib/common.h
>
27
namespace
shogun
28
{
29
#define LIBQP_PLUS_INF (-log(0.0))
30
#define LIBQP_CALLOC(x,y) calloc(x,y)
31
#define LIBQP_FREE(x) SG_FREE(x)
32
#define LIBQP_INDEX(ROW,COL,NUM_ROWS) ((COL)*(NUM_ROWS)+(ROW))
33
#define LIBQP_MIN(A,B) ((A) > (B) ? (B) : (A))
34
#define LIBQP_MAX(A,B) ((A) < (B) ? (B) : (A))
35
#define LIBQP_ABS(A) ((A) < 0 ? -(A) : (A))
36
37
#ifndef DOXYGEN_SHOULD_SKIP_THIS
38
39
typedef
struct
{
41
uint32_t nIter;
43
float64_t
QP;
45
float64_t
QD;
47
int8_t exitflag;
/* -1 ... not enough memory
48
0 ... nIter >= MaxIter
49
1 ... QP - QD <= TolRel*ABS(QP)
50
2 ... QP - QD <= TolAbs
51
3 ... QP <= QP_TH
52
4 ... eps-KKT conditions satisfied */
53
} libqp_state_T;
54
#endif
55
57
libqp_state_T
libqp_splx_solver
(
const
float64_t
* (*
get_col
)(uint32_t),
58
float64_t
*diag_H,
59
float64_t
*f,
60
float64_t
*b,
61
uint32_t *I,
62
uint8_t *S,
63
float64_t
*x,
64
uint32_t n,
65
uint32_t MaxIter,
66
float64_t
TolAbs,
67
float64_t
TolRel,
68
float64_t
QP_TH,
69
void
(*print_state)(libqp_state_T state));
70
72
libqp_state_T
libqp_gsmo_solver
(
const
float64_t
* (*
get_col
)(uint32_t),
73
float64_t
*diag_H,
74
float64_t
*f,
75
float64_t
*a,
76
float64_t
b,
77
float64_t
*LB,
78
float64_t
*UB,
79
float64_t
*x,
80
uint32_t n,
81
uint32_t MaxIter,
82
float64_t
TolKKT,
83
void
(*print_state)(libqp_state_T state));
84
85
}
86
#endif
/* libqp_h */
SHOGUN
Machine Learning Toolbox - Documentation