File: Quadratic-Programming.html

package info (click to toggle)
octave 6.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 124,192 kB
  • sloc: cpp: 322,665; ansic: 68,088; fortran: 20,980; objc: 8,121; sh: 7,719; yacc: 4,266; lex: 4,123; perl: 1,530; java: 1,366; awk: 1,257; makefile: 424; xml: 147
file content (223 lines) | stat: -rw-r--r-- 9,557 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Quadratic Programming (GNU Octave (version 6.2.0))</title>

<meta name="description" content="Quadratic Programming (GNU Octave (version 6.2.0))">
<meta name="keywords" content="Quadratic Programming (GNU Octave (version 6.2.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Optimization.html" rel="up" title="Optimization">
<link href="Nonlinear-Programming.html" rel="next" title="Nonlinear Programming">
<link href="Linear-Programming.html" rel="prev" title="Linear Programming">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<span id="Quadratic-Programming"></span><div class="header">
<p>
Next: <a href="Nonlinear-Programming.html" accesskey="n" rel="next">Nonlinear Programming</a>, Previous: <a href="Linear-Programming.html" accesskey="p" rel="prev">Linear Programming</a>, Up: <a href="Optimization.html" accesskey="u" rel="up">Optimization</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="Quadratic-Programming-1"></span><h3 class="section">25.2 Quadratic Programming</h3>

<p>Octave can also solve Quadratic Programming problems, this is
</p>
<div class="example">
<pre class="example">min 0.5 x'*H*x + x'*q
</pre></div>

<p>subject to
</p>
<div class="example">
<pre class="example">     A*x = b
     lb &lt;= x &lt;= ub
     A_lb &lt;= A_in*x &lt;= A_ub
</pre></div>


<span id="XREFqp"></span><dl>
<dt id="index-qp">: <em>[<var>x</var>, <var>obj</var>, <var>info</var>, <var>lambda</var>] =</em> <strong>qp</strong> <em>(<var>x0</var>, <var>H</var>)</em></dt>
<dt id="index-qp-1">: <em>[<var>x</var>, <var>obj</var>, <var>info</var>, <var>lambda</var>] =</em> <strong>qp</strong> <em>(<var>x0</var>, <var>H</var>, <var>q</var>)</em></dt>
<dt id="index-qp-2">: <em>[<var>x</var>, <var>obj</var>, <var>info</var>, <var>lambda</var>] =</em> <strong>qp</strong> <em>(<var>x0</var>, <var>H</var>, <var>q</var>, <var>A</var>, <var>b</var>)</em></dt>
<dt id="index-qp-3">: <em>[<var>x</var>, <var>obj</var>, <var>info</var>, <var>lambda</var>] =</em> <strong>qp</strong> <em>(<var>x0</var>, <var>H</var>, <var>q</var>, <var>A</var>, <var>b</var>, <var>lb</var>, <var>ub</var>)</em></dt>
<dt id="index-qp-4">: <em>[<var>x</var>, <var>obj</var>, <var>info</var>, <var>lambda</var>] =</em> <strong>qp</strong> <em>(<var>x0</var>, <var>H</var>, <var>q</var>, <var>A</var>, <var>b</var>, <var>lb</var>, <var>ub</var>, <var>A_lb</var>, <var>A_in</var>, <var>A_ub</var>)</em></dt>
<dt id="index-qp-5">: <em>[<var>x</var>, <var>obj</var>, <var>info</var>, <var>lambda</var>] =</em> <strong>qp</strong> <em>(&hellip;, <var>options</var>)</em></dt>
<dd><p>Solve a quadratic program (QP).
</p>
<p>Solve the quadratic program defined by
</p>
<div class="example">
<pre class="example">min 0.5 x'*H*x + x'*q
 x
</pre></div>

<p>subject to
</p>
<div class="example">
<pre class="example">A*x = b
lb &lt;= x &lt;= ub
A_lb &lt;= A_in*x &lt;= A_ub
</pre></div>

<p>using a null-space active-set method.
</p>
<p>Any bound (<var>A</var>, <var>b</var>, <var>lb</var>, <var>ub</var>, <var>A_in</var>, <var>A_lb</var>,
<var>A_ub</var>) may be set to the empty matrix (<code>[]</code>) if not present.  The
constraints <var>A</var> and <var>A_in</var> are matrices with each row representing
a single constraint.  The other bounds are scalars or vectors depending on
the number of constraints.  The algorithm is faster if the initial guess is
feasible.
</p>
<p><var>options</var> is a structure specifying additional parameters which
control the algorithm.  Currently, <code>qp</code> recognizes these options:
<code>&quot;MaxIter&quot;</code>, <code>&quot;TolX&quot;</code>.
</p>
<p><code>&quot;MaxIter&quot;</code> proscribes the maximum number of algorithm iterations
before optimization is halted.  The default value is 200.
The value must be a positive integer.
</p>
<p><code>&quot;TolX&quot;</code> specifies the termination tolerance for the unknown variables
<var>x</var>.  The default is <code>sqrt (eps)</code> or approximately 1e-8.
</p>
<p>On return, <var>x</var> is the location of the minimum and <var>fval</var> contains
the value of the objective function at <var>x</var>.
</p>
<dl compact="compact">
<dt><var>info</var></dt>
<dd><p>Structure containing run-time information about the algorithm.  The
following fields are defined:
</p>
<dl compact="compact">
<dt><code>solveiter</code></dt>
<dd><p>The number of iterations required to find the solution.
</p>
</dd>
<dt><code>info</code></dt>
<dd><p>An integer indicating the status of the solution.
</p>
<dl compact="compact">
<dt>0</dt>
<dd><p>The problem is feasible and convex.  Global solution found.
</p>
</dd>
<dt>1</dt>
<dd><p>The problem is not convex.  Local solution found.
</p>
</dd>
<dt>2</dt>
<dd><p>The problem is not convex and unbounded.
</p>
</dd>
<dt>3</dt>
<dd><p>Maximum number of iterations reached.
</p>
</dd>
<dt>6</dt>
<dd><p>The problem is infeasible.
</p></dd>
</dl>
</dd>
</dl>
</dd>
</dl>

<p><strong>See also:</strong> <a href="Nonlinear-Programming.html#XREFsqp">sqp</a>.
</p></dd></dl>


<span id="XREFpqpnonneg"></span><dl>
<dt id="index-pqpnonneg">: <em><var>x</var> =</em> <strong>pqpnonneg</strong> <em>(<var>c</var>, <var>d</var>)</em></dt>
<dt id="index-pqpnonneg-1">: <em><var>x</var> =</em> <strong>pqpnonneg</strong> <em>(<var>c</var>, <var>d</var>, <var>x0</var>)</em></dt>
<dt id="index-pqpnonneg-2">: <em><var>x</var> =</em> <strong>pqpnonneg</strong> <em>(<var>c</var>, <var>d</var>, <var>x0</var>, <var>options</var>)</em></dt>
<dt id="index-pqpnonneg-3">: <em>[<var>x</var>, <var>minval</var>] =</em> <strong>pqpnonneg</strong> <em>(&hellip;)</em></dt>
<dt id="index-pqpnonneg-4">: <em>[<var>x</var>, <var>minval</var>, <var>exitflag</var>] =</em> <strong>pqpnonneg</strong> <em>(&hellip;)</em></dt>
<dt id="index-pqpnonneg-5">: <em>[<var>x</var>, <var>minval</var>, <var>exitflag</var>, <var>output</var>] =</em> <strong>pqpnonneg</strong> <em>(&hellip;)</em></dt>
<dt id="index-pqpnonneg-6">: <em>[<var>x</var>, <var>minval</var>, <var>exitflag</var>, <var>output</var>, <var>lambda</var>] =</em> <strong>pqpnonneg</strong> <em>(&hellip;)</em></dt>
<dd>
<p>Minimize <code>1/2*<var>x</var>'*<var>c</var>*<var>x</var> + <var>d</var>'*<var>x</var></code> subject to
<code><var>x</var> &gt;= 0</code>.
</p>
<p><var>c</var> and <var>d</var> must be real matrices, and <var>c</var> must be symmetric and
positive definite.
</p>
<p><var>x0</var> is an optional initial guess for the solution <var>x</var>.
</p>
<p><var>options</var> is an options structure to change the behavior of the
algorithm (see <a href="Linear-Least-Squares.html#XREFoptimset">optimset</a>).  <code>pqpnonneg</code> recognizes
one option: <code>&quot;MaxIter&quot;</code>.
</p>
<p>Outputs:
</p>
<dl compact="compact">
<dt><var>x</var></dt>
<dd><p>The solution matrix
</p>
</dd>
<dt><var>minval</var></dt>
<dd><p>The minimum attained model value,
<code>1/2*<var>xmin</var>'*<var>c</var>*<var>xmin</var> + <var>d</var>'*<var>xmin</var></code>
</p>
</dd>
<dt><var>exitflag</var></dt>
<dd><p>An indicator of convergence.  0 indicates that the iteration count was
exceeded, and therefore convergence was not reached; &gt;0 indicates that the
algorithm converged.  (The algorithm is stable and will converge given
enough iterations.)
</p>
</dd>
<dt><var>output</var></dt>
<dd><p>A structure with two fields:
</p>
<ul>
<li> <code>&quot;algorithm&quot;</code>: The algorithm used (<code>&quot;nnls&quot;</code>)

</li><li> <code>&quot;iterations&quot;</code>: The number of iterations taken.
</li></ul>

</dd>
<dt><var>lambda</var></dt>
<dd><p>Undocumented output
</p></dd>
</dl>

<p><strong>See also:</strong> <a href="Linear-Least-Squares.html#XREFlsqnonneg">lsqnonneg</a>, <a href="#XREFqp">qp</a>, <a href="Linear-Least-Squares.html#XREFoptimset">optimset</a>.
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="Nonlinear-Programming.html" accesskey="n" rel="next">Nonlinear Programming</a>, Previous: <a href="Linear-Programming.html" accesskey="p" rel="prev">Linear Programming</a>, Up: <a href="Optimization.html" accesskey="u" rel="up">Optimization</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>