3
|
1 // QP.cc -*- C++ -*- |
|
2 /* |
|
3 |
1011
|
4 Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton |
3
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
238
|
24 #ifdef HAVE_CONFIG_H |
1192
|
25 #include <config.h> |
3
|
26 #endif |
|
27 |
|
28 #include "QP.h" |
|
29 |
|
30 QP::QP (void) {} |
|
31 |
|
32 QP::QP (const Vector& x0, const Matrix& H_arg) : x (x0), H (H_arg) |
|
33 { |
|
34 make_h_symmetric (); |
|
35 } |
|
36 |
|
37 QP::QP (const Vector& x0, const Matrix& H_arg, const Vector& c_arg) |
|
38 : x (x0), H (H_arg), c (c_arg) |
|
39 { |
|
40 make_h_symmetric (); |
|
41 } |
|
42 |
|
43 |
|
44 QP::QP (const Vector& x0, const Matrix& H_arg, const Bounds& b) |
|
45 : x (x0), H (H_arg), bnds (b) |
|
46 { |
|
47 make_h_symmetric (); |
|
48 } |
|
49 |
|
50 |
|
51 QP::QP (const Vector& x0, const Matrix& H_arg, const LinConst& l) |
|
52 : x (x0), H (H_arg), lc (l) |
|
53 { |
|
54 make_h_symmetric (); |
|
55 } |
|
56 |
|
57 |
|
58 QP::QP (const Vector& x0, const Matrix& H_arg, const Vector& c_arg, |
|
59 const Bounds& b) |
|
60 : x (x0), H (H_arg), c (c_arg), bnds (b) |
|
61 { |
|
62 make_h_symmetric (); |
|
63 } |
|
64 |
|
65 |
|
66 QP::QP (const Vector& x0, const Matrix& H_arg, const Vector& c_arg, |
|
67 const LinConst& l) |
|
68 : x (x0), H (H_arg), c (c_arg), lc (l) |
|
69 { |
|
70 make_h_symmetric (); |
|
71 } |
|
72 |
|
73 |
|
74 QP::QP (const Vector& x0, const Matrix& H_arg, const Bounds& b, |
|
75 const LinConst& l) |
|
76 : x (x0), H (H_arg), bnds (b), lc (l) |
|
77 { |
|
78 make_h_symmetric (); |
|
79 } |
|
80 |
|
81 |
|
82 QP::QP (const Vector& x0, const Matrix& H_arg, const Vector& c_arg, |
|
83 const Bounds& b, const LinConst& l) |
|
84 : x (x0), H (H_arg), c (c_arg), bnds (b), lc (l) |
|
85 { |
|
86 make_h_symmetric (); |
|
87 } |
|
88 |
|
89 Matrix |
|
90 QP::make_h_symmetric (void) |
|
91 { |
|
92 return 0.5 * (H + H.transpose ()); |
|
93 } |
|
94 |
|
95 Vector |
|
96 QP::minimize (void) |
|
97 { |
|
98 double objf; |
|
99 int inform; |
|
100 Vector lambda; |
|
101 return minimize (objf, inform, lambda); |
|
102 } |
|
103 |
|
104 Vector |
|
105 QP::minimize (double& objf) |
|
106 { |
|
107 int inform; |
|
108 Vector lambda; |
|
109 return minimize (objf, inform, lambda); |
|
110 } |
|
111 |
|
112 Vector |
|
113 QP::minimize (double& objf, int& inform) |
|
114 { |
|
115 Vector lambda; |
|
116 return minimize (objf, inform, lambda); |
|
117 } |
|
118 |
|
119 Vector |
|
120 QP::minimize (const Vector& x0) |
|
121 { |
|
122 x = x0; |
|
123 double objf; |
|
124 int inform; |
|
125 Vector lambda; |
|
126 return minimize (objf, inform, lambda); |
|
127 } |
|
128 |
|
129 Vector |
|
130 QP::minimize (const Vector& x0, double& objf) |
|
131 { |
|
132 x = x0; |
|
133 int inform; |
|
134 Vector lambda; |
|
135 return minimize (objf, inform, lambda); |
|
136 } |
|
137 |
|
138 Vector |
|
139 QP::minimize (const Vector& x0, double& objf, int& inform) |
|
140 { |
|
141 x = x0; |
|
142 Vector lambda; |
|
143 return minimize (objf, inform, lambda); |
|
144 } |
|
145 |
|
146 Vector |
|
147 QP::minimize (const Vector& x0, double& objf, int& inform, Vector& lambda) |
|
148 { |
|
149 x = x0; |
|
150 return minimize (objf, inform, lambda); |
|
151 } |
|
152 |
|
153 /* |
|
154 ;;; Local Variables: *** |
|
155 ;;; mode: C++ *** |
|
156 ;;; page-delimiter: "^/\\*" *** |
|
157 ;;; End: *** |
|
158 */ |