6778
|
1 @c Copyright (C) 1996, 1997, 2007 John W. Eaton |
7018
|
2 @c |
|
3 @c This file is part of Octave. |
|
4 @c |
|
5 @c Octave is free software; you can redistribute it and/or modify it |
|
6 @c under the terms of the GNU General Public License as published by the |
|
7 @c Free Software Foundation; either version 3 of the License, or (at |
|
8 @c your option) any later version. |
|
9 @c |
|
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 @c for more details. |
|
14 @c |
|
15 @c You should have received a copy of the GNU General Public License |
|
16 @c along with Octave; see the file COPYING. If not, see |
|
17 @c <http://www.gnu.org/licenses/>. |
3294
|
18 |
4167
|
19 @node Optimization |
3294
|
20 @chapter Optimization |
|
21 |
6741
|
22 Octave comes with support for solving various kinds of optimization |
|
23 problems. Specifically Octave can solve problems in Linear Programming, |
|
24 Quadratic Programming, Nonlinear Programming, and Linear Least Squares |
|
25 Minimization. |
|
26 |
3294
|
27 @menu |
4246
|
28 * Linear Programming:: |
3294
|
29 * Quadratic Programming:: |
|
30 * Nonlinear Programming:: |
|
31 * Linear Least Squares:: |
|
32 @end menu |
|
33 |
|
34 @c @cindex linear programming |
|
35 @cindex quadratic programming |
|
36 @cindex nonlinear programming |
|
37 @cindex optimization |
|
38 @cindex LP |
|
39 @cindex QP |
|
40 @cindex NLP |
|
41 |
4246
|
42 @node Linear Programming |
|
43 @section Linear Programming |
|
44 |
6741
|
45 Octave can solve Linear Programming problems using the @code{glpk} |
|
46 function. That is, Octave can solve |
|
47 |
|
48 @iftex |
|
49 @tex |
|
50 $$ |
|
51 \min_x c^T x |
|
52 $$ |
|
53 @end tex |
|
54 @end iftex |
|
55 @ifnottex |
|
56 @example |
|
57 min C'*x |
|
58 @end example |
|
59 @end ifnottex |
|
60 subject to the linear constraints |
|
61 @iftex |
|
62 @tex |
|
63 $Ax = b$ where $x \geq 0$. |
|
64 @end tex |
|
65 @end iftex |
|
66 @ifnottex |
|
67 @math{A*x = b} where @math{x >= 0}. |
|
68 @end ifnottex |
|
69 |
|
70 @noindent |
|
71 The @code{glpk} function also supports variations of this problem. |
|
72 |
6502
|
73 @DOCSTRING(glpk) |
|
74 |
4167
|
75 @node Quadratic Programming |
3294
|
76 @section Quadratic Programming |
|
77 |
6741
|
78 Octave can also solve Quadratic Programming problems, this is |
|
79 @iftex |
|
80 @tex |
|
81 $$ |
|
82 \min_x {1 \over 2} x^T H x + x^T q |
|
83 $$ |
|
84 @end tex |
|
85 @end iftex |
|
86 @ifnottex |
|
87 @example |
|
88 min 0.5 x'*H*x + x'*q |
|
89 @end example |
|
90 @end ifnottex |
|
91 subject to |
|
92 @iftex |
|
93 @tex |
|
94 $$ |
|
95 Ax = b \qquad lb \leq x \leq ub \qquad A_{lb} \leq A_{in} \leq A_{ub} |
|
96 $$ |
|
97 @end tex |
|
98 @end iftex |
|
99 @ifnottex |
|
100 @example |
|
101 A*x = b |
|
102 lb <= x <= ub |
|
103 A_lb <= A_in*x <= A_ub |
|
104 @end example |
|
105 @end ifnottex |
|
106 |
6502
|
107 @DOCSTRING(qp) |
|
108 |
4167
|
109 @node Nonlinear Programming |
3294
|
110 @section Nonlinear Programming |
|
111 |
6741
|
112 Octave can also perform general nonlinear minimization using a |
|
113 successive quadratic programming solver. |
|
114 |
6502
|
115 @DOCSTRING(sqp) |
|
116 |
4167
|
117 @node Linear Least Squares |
3294
|
118 @section Linear Least Squares |
|
119 |
6741
|
120 Octave also supports linear least squares minimization. That is, |
6939
|
121 Octave can find the parameter @math{b} such that the model |
6741
|
122 @iftex |
|
123 @tex |
|
124 $y = xb$ |
|
125 @end tex |
|
126 @end iftex |
|
127 @ifnottex |
|
128 @math{y = x*b} |
|
129 @end ifnottex |
|
130 fits data @math{(x,y)} as good as possible, assuming zero-mean |
|
131 Gaussian noise. If the noise is assumed to be isotropic the problem |
|
132 can be solved using the @samp{\} or @samp{/} operators, or the @code{ols} |
|
133 function. In the general case where the noise is assumed to be anisotropic |
|
134 the @code{gls} is needed. |
|
135 |
|
136 @DOCSTRING(ols) |
|
137 |
3368
|
138 @DOCSTRING(gls) |
3294
|
139 |