1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
2 | <html> |
---|
3 | |
---|
4 | <head> |
---|
5 | <meta http-equiv="Content-Language" content="en-us"> |
---|
6 | <title>YALMIP - Command reference</title> |
---|
7 | <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> |
---|
8 | <meta content="Microsoft FrontPage 6.0" name="GENERATOR"> |
---|
9 | <meta name="ProgId" content="FrontPage.Editor.Document"> |
---|
10 | <link href="yalmip.css" type="text/css" rel="stylesheet"> |
---|
11 | <base target="_self"> |
---|
12 | </head> |
---|
13 | |
---|
14 | <body> |
---|
15 | |
---|
16 | <div align="left"> |
---|
17 | <table border="0" cellpadding="4" cellspacing="3" style="border-collapse: collapse" width="100%" align="left"> |
---|
18 | <tr> |
---|
19 | <td width="100%" align="left" height="100%" valign="top"> |
---|
20 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table30"> |
---|
21 | <tr> |
---|
22 | <td class="tableheader"> |
---|
23 | <p class="tableheader"><a name="assign">ASSIGN</font></a></p> |
---|
24 | </td> |
---|
25 | </tr> |
---|
26 | <tr> |
---|
27 | <td> |
---|
28 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table31"> |
---|
29 | <tr> |
---|
30 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
31 | Syntax</th> |
---|
32 | <td class="code" valign="top" nowrap width="100%"><code>assign(X,Y)</code></td> |
---|
33 | </tr> |
---|
34 | <tr> |
---|
35 | <td class="tabxpl"> |
---|
36 | <table border="0" id="table32"> |
---|
37 | <tr> |
---|
38 | <td> |
---|
39 | <p align="right"><font face="Courier New" size="2">X:</font></p> |
---|
40 | </td> |
---|
41 | <td>sdpvar object</td> |
---|
42 | </tr> |
---|
43 | <tr> |
---|
44 | <td> |
---|
45 | <p align="right"><font face="Courier New" size="2">Y:</font></p> |
---|
46 | </td> |
---|
47 | <td>double</td> |
---|
48 | </tr> |
---|
49 | </table> |
---|
50 | </td> |
---|
51 | </tr> |
---|
52 | <tr> |
---|
53 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
54 | Description</th> |
---|
55 | </tr> |
---|
56 | <tr> |
---|
57 | <td class="tabxpl">assign is used to explicitly assigning the value obtained |
---|
58 | when applying the command double on an |
---|
59 | <a href="reference.htm#sdpvar">sdpvar</a> object</td> |
---|
60 | </tr> |
---|
61 | <tr> |
---|
62 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
63 | Examples</th> |
---|
64 | </tr> |
---|
65 | <tr> |
---|
66 | <td class="tabxpl">Variables are initialized as NaNs<table cellpadding="10" width="100%" id="table33"> |
---|
67 | <tr> |
---|
68 | <td class="xmpcode"> |
---|
69 | <pre>x = sdpvar(1,1); |
---|
70 | double(x) |
---|
71 | <font color="#000000">ans = |
---|
72 | NaN</font></pre> |
---|
73 | </td> |
---|
74 | </tr> |
---|
75 | </table> |
---|
76 | <p>By using <a href="reference.htm#assign">assign</a>, this |
---|
77 | value can be altered </p> |
---|
78 | <table cellpadding="10" width="100%" id="table34"> |
---|
79 | <tr> |
---|
80 | <td class="xmpcode"> |
---|
81 | <pre>assign(x,1) |
---|
82 | double(x) |
---|
83 | <font color="#000000"> ans = |
---|
84 | 1</font></pre> |
---|
85 | </td> |
---|
86 | </tr> |
---|
87 | </table> |
---|
88 | <p>By default, inconsistent assignments generate an error message.</p> |
---|
89 | <table cellpadding="10" width="100%" id="table35"> |
---|
90 | <tr> |
---|
91 | <td class="xmpcode"> |
---|
92 | <pre>t = sdpvar(1,1);x = [t t]; |
---|
93 | assign(x,[1 2]) |
---|
94 | <font color="#000000">??? Error using ==> sdpvar/assign |
---|
95 | Inconsistent assignment</font></pre> |
---|
96 | </td> |
---|
97 | </tr> |
---|
98 | </table> |
---|
99 | <p>With a third argument, a least squares assignment is obtained</p> |
---|
100 | <table cellpadding="10" width="100%" id="table36"> |
---|
101 | <tr> |
---|
102 | <td class="xmpcode"> |
---|
103 | <pre>t = sdpvar(1,1);x = [t t]; |
---|
104 | assign(x,[1 2],1) |
---|
105 | double(x) |
---|
106 | |
---|
107 | <font color="#000000">ans = |
---|
108 | |
---|
109 | 1.5000 1.5000</font></pre> |
---|
110 | </td> |
---|
111 | </tr> |
---|
112 | </table> |
---|
113 | </td> |
---|
114 | </tr> |
---|
115 | <tr> |
---|
116 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
117 | Related commands</th> |
---|
118 | </tr> |
---|
119 | <tr> |
---|
120 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
121 | </tr> |
---|
122 | </table> |
---|
123 | </td> |
---|
124 | </tr> |
---|
125 | </table> |
---|
126 | <p> </p> |
---|
127 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
128 | <tr> |
---|
129 | <td class="tableheader"> |
---|
130 | <p class="tableheader"><a name="binary">BINARY</a></p> |
---|
131 | </td> |
---|
132 | </tr> |
---|
133 | <tr> |
---|
134 | <td> |
---|
135 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
136 | <tr> |
---|
137 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
138 | Syntax</th> |
---|
139 | <td class="code" valign="top" nowrap width="100%"><code>c = binary(x)</code></td> |
---|
140 | </tr> |
---|
141 | <tr> |
---|
142 | <td class="tabxpl"> |
---|
143 | <table border="0"> |
---|
144 | <tr> |
---|
145 | <td> |
---|
146 | <p align="right"><font face="Courier New">c:</font></p> |
---|
147 | </td> |
---|
148 | <td>sdpvar object (only useful in <a href="reference.htm#lmi"> |
---|
149 | set</a>)</td> |
---|
150 | </tr> |
---|
151 | <tr> |
---|
152 | <td> |
---|
153 | <p align="right"><font face="Courier New">x:</font></p> |
---|
154 | </td> |
---|
155 | <td>sdpvar object</td> |
---|
156 | </tr> |
---|
157 | </table> |
---|
158 | </td> |
---|
159 | </tr> |
---|
160 | <tr> |
---|
161 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
162 | Description</th> |
---|
163 | </tr> |
---|
164 | <tr> |
---|
165 | <td class="tabxpl">binary is used to constrain a variables to be binary.</td> |
---|
166 | </tr> |
---|
167 | <tr> |
---|
168 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
169 | Examples</th> |
---|
170 | </tr> |
---|
171 | <tr> |
---|
172 | <td class="tabxpl"> |
---|
173 | |
---|
174 | <p>Setting up a binary linear program <b>{min c<sup>T</sup>x |
---|
175 | subject to Ax≤b}</b> can be done as</p> |
---|
176 | |
---|
177 | <table cellpadding="10" width="100%"> |
---|
178 | <tr> |
---|
179 | <td class="xmpcode"> |
---|
180 | <pre>x = binvar(n,1); |
---|
181 | solvesdp(set(A*x<b),c'*x)</pre> |
---|
182 | </td> |
---|
183 | </tr> |
---|
184 | </table> |
---|
185 | <p>or</p> |
---|
186 | <table cellpadding="10" width="100%"> |
---|
187 | <tr> |
---|
188 | <td class="xmpcode"> |
---|
189 | <pre>x = sdpvar(n,1); |
---|
190 | solvesdp(set(A*x<b)+set(binary(x)),c'*x)</pre> |
---|
191 | </td> |
---|
192 | </tr> |
---|
193 | </table> |
---|
194 | <p>Note, the binary constraint is imposed on the involved variables, |
---|
195 | not the actual <a href="reference.htm#sdpvar">sdpvar</a> object. Hence, |
---|
196 | the following two constraints are equivalent </p> |
---|
197 | <table cellpadding="10" width="100%"> |
---|
198 | <tr> |
---|
199 | <td class="xmpcode"> |
---|
200 | <pre>F = set(binary(x)); |
---|
201 | F = set(binary(pi+sqrt(2)*x));</pre> |
---|
202 | </td> |
---|
203 | </tr> |
---|
204 | </table> |
---|
205 | </td> |
---|
206 | </tr> |
---|
207 | <tr> |
---|
208 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
209 | Related commands</th> |
---|
210 | </tr> |
---|
211 | <tr> |
---|
212 | <td class="tabxpl"><a href="reference.htm#intvar">intvar</a>, |
---|
213 | <a href="reference.htm#sdpvar">sdpvar</a>, |
---|
214 | <a href="reference.htm#binvar">binvar</a>, <a href="#set">set</a></td> |
---|
215 | </tr> |
---|
216 | </table> |
---|
217 | </td> |
---|
218 | </tr> |
---|
219 | </table> |
---|
220 | <p> </p> |
---|
221 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
222 | <tr> |
---|
223 | <td class="tableheader"> |
---|
224 | <p class="tableheader"><a name="binvar">BINVAR</a></p> |
---|
225 | </td> |
---|
226 | </tr> |
---|
227 | <tr> |
---|
228 | <td> |
---|
229 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
230 | <tr> |
---|
231 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
232 | Syntax<p> </p> |
---|
233 | </th> |
---|
234 | <td class="code" valign="top" nowrap width="100%"><code>x = binvar(n,m,'field','type')</code></td> |
---|
235 | </tr> |
---|
236 | <tr> |
---|
237 | <td class="tabxpl"> |
---|
238 | <table border="0"> |
---|
239 | <tr> |
---|
240 | <td> |
---|
241 | <p align="right"><font face="Courier New" size="2">n:</font></p> |
---|
242 | </td> |
---|
243 | <td>Height</td> |
---|
244 | </tr> |
---|
245 | <tr> |
---|
246 | <td> |
---|
247 | <p align="right"><font face="Courier New" size="2">m:</font></p> |
---|
248 | </td> |
---|
249 | <td>Width</td> |
---|
250 | </tr> |
---|
251 | <tr> |
---|
252 | <td> |
---|
253 | <p align="right"><font face="Courier New" size="2">'field':</font></p> |
---|
254 | </td> |
---|
255 | <td>char {'real','complex'}</td> |
---|
256 | </tr> |
---|
257 | <tr> |
---|
258 | <td> |
---|
259 | <p align="right"><font face="Courier New" size="2">'type':</font></p> |
---|
260 | </td> |
---|
261 | <td>char {'symmetric','full','hermitian','toeplitz','hankel','skew'}</td> |
---|
262 | </tr> |
---|
263 | </table> |
---|
264 | </td> |
---|
265 | </tr> |
---|
266 | <tr> |
---|
267 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
268 | Description</th> |
---|
269 | </tr> |
---|
270 | <tr> |
---|
271 | <td class="tabxpl">binvar is used to define symbolic decision variables |
---|
272 | with binary elements.</td> |
---|
273 | </tr> |
---|
274 | <tr> |
---|
275 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
276 | Examples</th> |
---|
277 | </tr> |
---|
278 | <tr> |
---|
279 | <td class="tabxpl"><p>A scalar binary variable is defined with</p><table cellpadding="10" width="100%"> |
---|
280 | <tr> |
---|
281 | <td class="xmpcode"> |
---|
282 | <pre>P = binvar(1,1)</pre> |
---|
283 | </td> |
---|
284 | </tr> |
---|
285 | </table> |
---|
286 | <p>For more examples, see <a href="reference.htm#sdpvar">sdpvar</a>.</p> |
---|
287 | </td> |
---|
288 | </tr> |
---|
289 | <tr> |
---|
290 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
291 | Related commands</th> |
---|
292 | </tr> |
---|
293 | <tr> |
---|
294 | <td class="tabxpl"><a href="reference.htm#intvar">intvar</a>, |
---|
295 | <a href="reference.htm#sdpvar">sdpvar</a>, |
---|
296 | <a href="reference.htm#integer">integer</a>, |
---|
297 | <a href="reference.htm#binary">binary</a>, <a href="#set">set</a></td> |
---|
298 | </tr> |
---|
299 | </table> |
---|
300 | </td> |
---|
301 | </tr> |
---|
302 | </table> |
---|
303 | <p> </p> |
---|
304 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table53"> |
---|
305 | <tr> |
---|
306 | <td class="tableheader"> |
---|
307 | <p class="tableheader"><a name="blkvar">BLKVAR</a></p> |
---|
308 | </td> |
---|
309 | </tr> |
---|
310 | <tr> |
---|
311 | <td> |
---|
312 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table54"> |
---|
313 | <tr> |
---|
314 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
315 | Syntax<p> </p> |
---|
316 | </th> |
---|
317 | <td class="code" valign="top" nowrap width="100%"><code>X = blkvar</code></td> |
---|
318 | </tr> |
---|
319 | <tr> |
---|
320 | <td class="tabxpl"> |
---|
321 | <table border="0" id="table55"> |
---|
322 | <tr> |
---|
323 | <td> |
---|
324 | <p align="right"><font face="Courier New" size="2">X:</font></p> |
---|
325 | </td> |
---|
326 | <td>Container for block matrix</td> |
---|
327 | </tr> |
---|
328 | </table> |
---|
329 | </td> |
---|
330 | </tr> |
---|
331 | <tr> |
---|
332 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
333 | Description</th> |
---|
334 | </tr> |
---|
335 | <tr> |
---|
336 | <td class="tabxpl">blkvar is used to handle block matrices in a |
---|
337 | more symbolic fashion.</td> |
---|
338 | </tr> |
---|
339 | <tr> |
---|
340 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
341 | Examples</th> |
---|
342 | </tr> |
---|
343 | <tr> |
---|
344 | <td class="tabxpl">Consider the 3x3 block matrix <code>[A B 0;B' C |
---|
345 | D;0 D' E]</code>. Using standard YALMIP and MATLAB code, we would define this using |
---|
346 | concatenations. <table cellpadding="10" width="100%" id="table56"> |
---|
347 | <tr> |
---|
348 | <td class="xmpcode"> |
---|
349 | <pre>n = 5; |
---|
350 | m = 3; |
---|
351 | A = sdpvar(n,n); |
---|
352 | B = randn(n,2); |
---|
353 | E = sdpvar(m,m); |
---|
354 | C = randn(2,2); |
---|
355 | D = randn(2,m);</pre> |
---|
356 | <pre>X = [A B zeros(n,m);B' C D;zeros(m,n) D' E];</pre> |
---|
357 | </td> |
---|
358 | </tr> |
---|
359 | </table> |
---|
360 | <p>By using a block variable, we can define blocks instead. </p> |
---|
361 | <table cellpadding="10" width="100%" id="table57"> |
---|
362 | <tr> |
---|
363 | <td class="xmpcode"> |
---|
364 | <pre>X = blkvar; |
---|
365 | X(1,1) = A; |
---|
366 | X(1,2) = B; |
---|
367 | X(1,3) = 0; |
---|
368 | X(2,2) = C; |
---|
369 | X(2,3) = D; |
---|
370 | X(3,3) = E; |
---|
371 | X = sdpvar(X);</pre> |
---|
372 | </td> |
---|
373 | </tr> |
---|
374 | </table> |
---|
375 | <p>Dimension of 0 blocks do not have to be specified, they will be |
---|
376 | automatically be derived, if possible, from the dimension of |
---|
377 | other elements. Note that we only have to define one element of |
---|
378 | symmetric pairs, YALMIP will automatically fill in the symmetric |
---|
379 | counter-part. If no symmetric counter-part is found, the |
---|
380 | corresponding block is filled with zeroes. Hence, the following |
---|
381 | code is equivalent.</p> |
---|
382 | <table cellpadding="10" width="100%" id="table58"> |
---|
383 | <tr> |
---|
384 | <td class="xmpcode"> |
---|
385 | <pre>X = blkvar; |
---|
386 | X(1,1) = A; |
---|
387 | X(1,2) = B; |
---|
388 | X(2,2) = C; |
---|
389 | X(2,3) = D; |
---|
390 | X(3,3) = E; |
---|
391 | X = sdpvar(X);</pre> |
---|
392 | </td> |
---|
393 | </tr> |
---|
394 | </table> |
---|
395 | <p>Standard operators can typically be applied directly to the |
---|
396 | block variable (but it is currently recommended to convert the |
---|
397 | variable to an sdpvar object)</p> |
---|
398 | <table cellpadding="10" width="100%" id="table59"> |
---|
399 | <tr> |
---|
400 | <td class="xmpcode"> |
---|
401 | <pre>X = blkvar; |
---|
402 | X(1,1) = A; |
---|
403 | X(1,2) = B; |
---|
404 | X(2,2) = C; |
---|
405 | X(2,3) = D; |
---|
406 | X(3,3) = E; |
---|
407 | F = set(X > 0 ) + set(trace(X)==1); |
---|
408 | % Recommended |
---|
409 | X = sdpvar(X); |
---|
410 | F = set(X > 0 ) + set(trace(X)==1);</pre> |
---|
411 | </td> |
---|
412 | </tr> |
---|
413 | </table> |
---|
414 | </td> |
---|
415 | </tr> |
---|
416 | <tr> |
---|
417 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
418 | Related commands</th> |
---|
419 | </tr> |
---|
420 | <tr> |
---|
421 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
422 | </tr> |
---|
423 | </table> |
---|
424 | </td> |
---|
425 | </tr> |
---|
426 | </table> |
---|
427 | <p> </p> |
---|
428 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table44"> |
---|
429 | <tr> |
---|
430 | <td class="tableheader"> |
---|
431 | <p class="tableheader"><a name="bounds">BOUNDS</font></a></p> |
---|
432 | </td> |
---|
433 | </tr> |
---|
434 | <tr> |
---|
435 | <td> |
---|
436 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table45"> |
---|
437 | <tr> |
---|
438 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
439 | Syntax</th> |
---|
440 | <td class="code" valign="top" nowrap width="100%"><code>bounds(X,lower,upper)</code></td> |
---|
441 | </tr> |
---|
442 | <tr> |
---|
443 | <td class="tabxpl"> |
---|
444 | <table border="0" id="table51"> |
---|
445 | <tr> |
---|
446 | <td> |
---|
447 | <p align="right"><font face="Courier New" size="2">X:</font></p> |
---|
448 | </td> |
---|
449 | <td>sdpvar</td> |
---|
450 | </tr> |
---|
451 | <tr> |
---|
452 | <td> |
---|
453 | <p align="right"><font face="Courier New" size="2">lower:</font></p> |
---|
454 | </td> |
---|
455 | <td>double</td> |
---|
456 | </tr> |
---|
457 | <tr> |
---|
458 | <td> |
---|
459 | <p align="right"><font face="Courier New" size="2">upper:</font></p> |
---|
460 | </td> |
---|
461 | <td>double</td> |
---|
462 | </tr> |
---|
463 | </table> |
---|
464 | </td> |
---|
465 | </tr> |
---|
466 | <tr> |
---|
467 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
468 | Description</th> |
---|
469 | </tr> |
---|
470 | <tr> |
---|
471 | <td class="tabxpl" height="26">bounds is used to add implicit |
---|
472 | domain bounds on variables to improve big-M relaxations.</td> |
---|
473 | </tr> |
---|
474 | <tr> |
---|
475 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
476 | Examples</th> |
---|
477 | </tr> |
---|
478 | <tr> |
---|
479 | <td class="tabxpl">Variable bounds defined with the command bounds |
---|
480 | are used to compute suitable constants when performing big-M |
---|
481 | relaxations in |
---|
482 | <a href="logic.htm">logic programming</a> and while creating MILP |
---|
483 | models for <a href="extoperators.htm#milp">non-convex operators</a>. As an example, the following simple mixed |
---|
484 | integer logic |
---|
485 | program requires a big-M relaxation in YALMIP. To improve the |
---|
486 | relaxation, we supply bounds on the variable <b>x</b>.<table cellpadding="10" width="100%" id="table47"> |
---|
487 | <tr> |
---|
488 | <td class="xmpcode"> |
---|
489 | <pre>A1 = randn(10,3); |
---|
490 | b1 = rand(10,1)*10; |
---|
491 | A2 = randn(10,3); |
---|
492 | b2 = rand(10,1)*10; |
---|
493 | x = sdpvar(3,1);bounds(x,[-25;-25;-25],[25;25;25]); |
---|
494 | F = set((A1*x<=b1) | (A1*x <=b2)); |
---|
495 | solvesdp(F,sum(x))</pre> |
---|
496 | </td> |
---|
497 | </tr> |
---|
498 | </table> |
---|
499 | <p>Of course, standard MATLAB notation applies so if you have the |
---|
500 | same bound on all variables, you only need to supply one scalar |
---|
501 | bound.</p><table cellpadding="10" width="100%" id="table52"> |
---|
502 | <tr> |
---|
503 | <td class="xmpcode"> |
---|
504 | <pre>A1 = randn(10,3); |
---|
505 | b1 = rand(10,1)*10; |
---|
506 | A2 = randn(10,3); |
---|
507 | b2 = rand(10,1)*10; |
---|
508 | x = sdpvar(3,1);bounds(x,-25,25); |
---|
509 | F = set((A1*x<=b1) | (A1*x <=b2)); |
---|
510 | solvesdp(F,sum(x))</pre> |
---|
511 | </td> |
---|
512 | </tr> |
---|
513 | </table> |
---|
514 | <p>Note that the big-M computation only take advantage of |
---|
515 | bounds explicitly defined using the bounds command. Bounds defined using a |
---|
516 | <a href="reference.htm#set">set</a> construction will not be detected or exploited. Hence, the |
---|
517 | following problem will give rise to a MILP with weaker relaxations (big-M will be set to e 10<sup>4</sup>).</p> |
---|
518 | <table cellpadding="10" width="100%" id="table49"> |
---|
519 | <tr> |
---|
520 | <td class="xmpcode"> |
---|
521 | <pre>x = sdpvar(3,1); |
---|
522 | F = set(-25 <= x<= 25) + set((A1*x<=b1) | (A1*x <=b2)); |
---|
523 | solvesdp(F,sum(x))</pre> |
---|
524 | </td> |
---|
525 | </tr> |
---|
526 | </table> |
---|
527 | </td> |
---|
528 | </tr> |
---|
529 | <tr> |
---|
530 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
531 | Related commands</th> |
---|
532 | </tr> |
---|
533 | <tr> |
---|
534 | <td class="tabxpl"><a href="reference.htm#set">set</a></td> |
---|
535 | </tr> |
---|
536 | </table> |
---|
537 | </td> |
---|
538 | </tr> |
---|
539 | </table> |
---|
540 | <p> </p> |
---|
541 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
542 | <tr> |
---|
543 | <td class="tableheader"> |
---|
544 | <p class="tableheader"><a name="checkset">CHECKSET</a></p> |
---|
545 | </td> |
---|
546 | </tr> |
---|
547 | <tr> |
---|
548 | <td> |
---|
549 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
550 | <tr> |
---|
551 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
552 | Syntax</th> |
---|
553 | <td class="code" valign="top" nowrap width="100%"><code>[p,d] = checkset(F)</code></td> |
---|
554 | </tr> |
---|
555 | <tr> |
---|
556 | <td class="tabxpl"> |
---|
557 | <table border="0"> |
---|
558 | <tr> |
---|
559 | <td> |
---|
560 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
561 | </td> |
---|
562 | <td>set object</td> |
---|
563 | </tr> |
---|
564 | <tr> |
---|
565 | <td> |
---|
566 | <p align="right"><font face="Courier New">p</font><font face="Courier New" size="2">:</font></p> |
---|
567 | </td> |
---|
568 | <td>Primal constraint residuals</td> |
---|
569 | </tr> |
---|
570 | <tr> |
---|
571 | <td> |
---|
572 | <p align="right"><font face="Courier New">d</font><font face="Courier New" size="2">:</font></p> |
---|
573 | </td> |
---|
574 | <td>Dual constraint residuals</td> |
---|
575 | </tr> |
---|
576 | </table> |
---|
577 | </td> |
---|
578 | </tr> |
---|
579 | <tr> |
---|
580 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
581 | Description</th> |
---|
582 | </tr> |
---|
583 | <tr> |
---|
584 | <td class="tabxpl">checkset is used to examine satisfaction of constraints |
---|
585 | in a <a href="#set">set</a> object.</td> |
---|
586 | </tr> |
---|
587 | <tr> |
---|
588 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
589 | Examples</th> |
---|
590 | </tr> |
---|
591 | <tr> |
---|
592 | <td class="tabxpl"><p>After solving a problem, we can easily check how |
---|
593 | well the constraints are satisfied.</p><table cellpadding="10" width="100%"> |
---|
594 | <tr> |
---|
595 | <td class="xmpcode"> |
---|
596 | <pre>solvesdp(F,objective); |
---|
597 | checkset(F)</pre> |
---|
598 | </td> |
---|
599 | </tr> |
---|
600 | </table> |
---|
601 | <p>The constraint residuals are defined as smallest eigenvalue, smallest |
---|
602 | element, negated largest absolute-value element and largest distance |
---|
603 | to an integer for semidefinite, element-wise, second order cone and |
---|
604 | integrality constraints respectively. Hence, a solution is feasible |
---|
605 | if all residuals related to inequalities are non-negative and residuals |
---|
606 | related to equalities are sufficiently close to zero.</p> |
---|
607 | <p>Sometimes it might be convenient to have the numerical values of |
---|
608 | the constraint violations</p> |
---|
609 | <table cellpadding="10" width="100%"> |
---|
610 | <tr> |
---|
611 | <td class="xmpcode"> |
---|
612 | <pre>[p,d] = checkset(F);</pre> |
---|
613 | </td> |
---|
614 | </tr> |
---|
615 | </table> |
---|
616 | </td> |
---|
617 | </tr> |
---|
618 | <tr> |
---|
619 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
620 | Related commands</th> |
---|
621 | </tr> |
---|
622 | <tr> |
---|
623 | <td class="tabxpl"><a href="reference.htm#set">set</a>, |
---|
624 | <a href="reference.htm#solvesdp">solvesdp</a></td> |
---|
625 | </tr> |
---|
626 | </table> |
---|
627 | </td> |
---|
628 | </tr> |
---|
629 | </table> |
---|
630 | <p class="Sh2"> </p> |
---|
631 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
632 | <tr> |
---|
633 | <td class="tableheader"> |
---|
634 | <p class="tableheader"><a name="clean">CLEAN</a></p> |
---|
635 | </td> |
---|
636 | </tr> |
---|
637 | <tr> |
---|
638 | <td> |
---|
639 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
640 | <tr> |
---|
641 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
642 | Syntax</th> |
---|
643 | <td class="code" valign="top" nowrap width="100%"><code>y = clean(x,tol)</code></td> |
---|
644 | </tr> |
---|
645 | <tr> |
---|
646 | <td class="tabxpl"> |
---|
647 | <table border="0"> |
---|
648 | <tr> |
---|
649 | <td> |
---|
650 | <p align="right"><font face="Courier New" size="2">y:</font></p> |
---|
651 | </td> |
---|
652 | <td>sdpvar object</td> |
---|
653 | </tr> |
---|
654 | <tr> |
---|
655 | <td> |
---|
656 | <p align="right"><font face="Courier New" size="2">x:</font></p> |
---|
657 | </td> |
---|
658 | <td>sdpvar object</td> |
---|
659 | </tr> |
---|
660 | <tr> |
---|
661 | <td> |
---|
662 | <p align="right"><font face="Courier New" size="2">tol:</font></p> |
---|
663 | </td> |
---|
664 | <td>double (tolerance)</td> |
---|
665 | </tr> |
---|
666 | </table> |
---|
667 | </td> |
---|
668 | </tr> |
---|
669 | <tr> |
---|
670 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
671 | Description</th> |
---|
672 | </tr> |
---|
673 | <tr> |
---|
674 | <td class="tabxpl">clean is used to remove base matrices in an |
---|
675 | <a href="reference.htm#sdpvar">sdpvar</a> object that are small (mainly |
---|
676 | used together with <a href="reference.htm#solvesos">solvesos</a>)</td> |
---|
677 | </tr> |
---|
678 | <tr> |
---|
679 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
680 | Examples</th> |
---|
681 | </tr> |
---|
682 | <tr> |
---|
683 | <td class="tabxpl"><p>Removing nuisance variables</p><table cellpadding="10" width="100%"> |
---|
684 | <tr> |
---|
685 | <td class="xmpcode"> |
---|
686 | <pre>x1 = sdpvar(n,1); |
---|
687 | x2 = sdpvar(n,1); |
---|
688 | x = x1+1e-8*x2; |
---|
689 | y = clean(x,1e-6); |
---|
690 | sdisplay(y) |
---|
691 | <font color="#000000">ans |
---|
692 | 'x1'</font></pre> |
---|
693 | </td> |
---|
694 | </tr> |
---|
695 | </table> |
---|
696 | </td> |
---|
697 | </tr> |
---|
698 | <tr> |
---|
699 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
700 | Related commands</th> |
---|
701 | </tr> |
---|
702 | <tr> |
---|
703 | <td class="tabxpl"><a href="reference.htm#sos">sos</a>, |
---|
704 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
705 | </tr> |
---|
706 | </table> |
---|
707 | </td> |
---|
708 | </tr> |
---|
709 | </table> |
---|
710 | <p> </p> |
---|
711 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table19"> |
---|
712 | <tr> |
---|
713 | <td class="tableheader"> |
---|
714 | <p class="tableheader"><a name="coefficients">COEFFICIENTS</a></p> |
---|
715 | </td> |
---|
716 | </tr> |
---|
717 | <tr> |
---|
718 | <td> |
---|
719 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table20"> |
---|
720 | <tr> |
---|
721 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
722 | Syntax<p> </p> |
---|
723 | </th> |
---|
724 | <td class="code" valign="top" nowrap width="100%"><code>[c,v] = |
---|
725 | coefficients(p,x)</code></td> |
---|
726 | </tr> |
---|
727 | <tr> |
---|
728 | <td class="tabxpl"> |
---|
729 | <table border="0" id="table21"> |
---|
730 | <tr> |
---|
731 | <td> |
---|
732 | <p align="right"><font face="Courier New">c</font><font face="Courier New" size="2">:</font></p> |
---|
733 | </td> |
---|
734 | <td>Coefficients (sdpvar object)</td> |
---|
735 | </tr> |
---|
736 | <tr> |
---|
737 | <td> |
---|
738 | <p align="right"><font face="Courier New" size="2">v:</font></p> |
---|
739 | </td> |
---|
740 | <td>Monomials (sdpvar object)</td> |
---|
741 | </tr> |
---|
742 | <tr> |
---|
743 | <td> |
---|
744 | <p align="right"><font face="Courier New" size="2">p:</font></p> |
---|
745 | </td> |
---|
746 | <td>Polynomials (sdpvar object)</td> |
---|
747 | </tr> |
---|
748 | <tr> |
---|
749 | <td> |
---|
750 | <p align="right"><font face="Courier New">x</font><font face="Courier New" size="2">:</font></p> |
---|
751 | </td> |
---|
752 | <td>Variables (sdpvar object)</td> |
---|
753 | </tr> |
---|
754 | </table> |
---|
755 | </td> |
---|
756 | </tr> |
---|
757 | <tr> |
---|
758 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
759 | Description</th> |
---|
760 | </tr> |
---|
761 | <tr> |
---|
762 | <td class="tabxpl">coefficients is used to extract the |
---|
763 | coefficients of a polynomials.</td> |
---|
764 | </tr> |
---|
765 | <tr> |
---|
766 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
767 | Examples</th> |
---|
768 | </tr> |
---|
769 | <tr> |
---|
770 | <td class="tabxpl">Define a polynomial in variables <b>x</b> and |
---|
771 | <b>y</b>, with coefficients parameterized by <b>s</b> and <b>t</b>.<table cellpadding="10" width="100%" id="table22"> |
---|
772 | <tr> |
---|
773 | <td class="xmpcode"> |
---|
774 | <pre>sdpvar x y s t |
---|
775 | p = x^2+x*y*(s+t)+s^2+t^2;</pre> |
---|
776 | </td> |
---|
777 | </tr> |
---|
778 | </table> |
---|
779 | <p>The coefficients are easily recovered</p> |
---|
780 | <table cellpadding="10" width="100%" id="table23"> |
---|
781 | <tr> |
---|
782 | <td class="xmpcode"> |
---|
783 | <pre>c = coefficients(p,[x y]); |
---|
784 | sdisplay(c) |
---|
785 | |
---|
786 | <font color="#000000">ans = |
---|
787 | 's^2+t^2' |
---|
788 | 's+t' |
---|
789 | '1'</font></pre> |
---|
790 | </td> |
---|
791 | </tr> |
---|
792 | </table> |
---|
793 | <p>By adding a second output, the monomial basis is returned also.</p> |
---|
794 | <table cellpadding="10" width="100%" id="table24"> |
---|
795 | <tr> |
---|
796 | <td class="xmpcode"> |
---|
797 | <pre>[c,v] = coefficients(p,[x y]); |
---|
798 | sdisplay([c v]) |
---|
799 | |
---|
800 | <font color="#000000">ans = |
---|
801 | 's^2+t^2' '1' |
---|
802 | 's+t' 'xy' |
---|
803 | '1' 'x^2'</font></pre> |
---|
804 | <pre>p-c'*v |
---|
805 | |
---|
806 | <font color="#000000">ans = |
---|
807 | 0</font></pre> |
---|
808 | </td> |
---|
809 | </tr> |
---|
810 | </table> |
---|
811 | <p>Of-course, we might just as well consider this to be a |
---|
812 | polynomial in <b>s</b> and <b>t</b> with coefficients |
---|
813 | parameterized by <b>x</b> and |
---|
814 | <b>y</b>.<table cellpadding="10" width="100%" id="table25"> |
---|
815 | <tr> |
---|
816 | <td class="xmpcode"> |
---|
817 | <pre>[c,v] = coefficients(p,[s t]); |
---|
818 | sdisplay([c v]) |
---|
819 | |
---|
820 | <font color="#000000">ans = |
---|
821 | 'x^2' '1' |
---|
822 | 'xy' 't' |
---|
823 | '1' 't^2' |
---|
824 | 'xy' 's' |
---|
825 | '1' 's^2'</font></pre> |
---|
826 | </td> |
---|
827 | </tr> |
---|
828 | </table> |
---|
829 | </td> |
---|
830 | </tr> |
---|
831 | <tr> |
---|
832 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
833 | Related commands</th> |
---|
834 | </tr> |
---|
835 | <tr> |
---|
836 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
837 | </tr> |
---|
838 | </table> |
---|
839 | </td> |
---|
840 | </tr> |
---|
841 | </table> |
---|
842 | <p> </p> |
---|
843 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
844 | <tr> |
---|
845 | <td class="tableheader"> |
---|
846 | <p class="tableheader"><a name="cone">CONE</a></p> |
---|
847 | </td> |
---|
848 | </tr> |
---|
849 | <tr> |
---|
850 | <td> |
---|
851 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
852 | <tr> |
---|
853 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> <p> </p> |
---|
854 | </th> |
---|
855 | <td class="code" valign="top" nowrap width="100%"><code>c = cone(x,y)</code></td> |
---|
856 | </tr> |
---|
857 | <tr> |
---|
858 | <td class="tabxpl"> |
---|
859 | <table border="0"> |
---|
860 | <tr> |
---|
861 | <td> |
---|
862 | <p align="right"><font face="Courier New" size="2">c:</font></p> |
---|
863 | </td> |
---|
864 | <td>sdpvar object (only useful in set object)</td> |
---|
865 | </tr> |
---|
866 | <tr> |
---|
867 | <td> |
---|
868 | <p align="right"><font face="Courier New" size="2">x:</font></p> |
---|
869 | </td> |
---|
870 | <td>sdpvar object (vector)</td> |
---|
871 | </tr> |
---|
872 | <tr> |
---|
873 | <td> |
---|
874 | <p align="right"><font face="Courier New" size="2">y:</font></p> |
---|
875 | </td> |
---|
876 | <td>sdpvar object (scalar)</td> |
---|
877 | </tr> |
---|
878 | </table> |
---|
879 | </td> |
---|
880 | </tr> |
---|
881 | <tr> |
---|
882 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
883 | Description</th> |
---|
884 | </tr> |
---|
885 | <tr> |
---|
886 | <td class="tabxpl">cone is used to define the constraints <b> |
---|
887 | <font face="Tahoma">||x||</font>≤<font face="Tahoma">y</font></b></td> |
---|
888 | </tr> |
---|
889 | <tr> |
---|
890 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
891 | Examples</th> |
---|
892 | </tr> |
---|
893 | <tr> |
---|
894 | <td class="tabxpl"><p>Constraining the Euclidean norm of a vector to |
---|
895 | be less than 1 is done with</p><table cellpadding="10" width="100%"> |
---|
896 | <tr> |
---|
897 | <td class="xmpcode"> |
---|
898 | <pre>x = sdpvar(n,1); |
---|
899 | F = set(cone(x,1));</pre> |
---|
900 | </td> |
---|
901 | </tr> |
---|
902 | </table> |
---|
903 | <p>Of-course, arbitrary complicated constructs are possible, such |
---|
904 | as constraining the norm of the diagonal to be less than the sum of |
---|
905 | the off-diagonal terms in a matrix! </p> |
---|
906 | <table cellpadding="10" width="100%"> |
---|
907 | <tr> |
---|
908 | <td class="xmpcode"> |
---|
909 | <pre>x = sdpvar(n,n); |
---|
910 | F = set(cone(diag(x),sum(sum(x-diag(diag(x))))))</pre> |
---|
911 | </td> |
---|
912 | </tr> |
---|
913 | </table> |
---|
914 | <p>An alternative is to use the nonlinear norm operator instead |
---|
915 | (see the examples on <a href="extoperators.htm">nonlinear |
---|
916 | operators</a> for details)</p> |
---|
917 | <table cellpadding="10" width="100%"> |
---|
918 | <tr> |
---|
919 | <td class="xmpcode"> |
---|
920 | <pre>x = sdpvar(n,n); |
---|
921 | F = set(norm(diag(x)) < sum(sum(x-diag(diag(x)))))</pre> |
---|
922 | </td> |
---|
923 | </tr> |
---|
924 | </table> |
---|
925 | </td> |
---|
926 | </tr> |
---|
927 | <tr> |
---|
928 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
929 | Related commands</th> |
---|
930 | </tr> |
---|
931 | <tr> |
---|
932 | <td class="tabxpl"><a href="reference.htm#rcone">rcone</a>, |
---|
933 | <a href="#set">set</a>, <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
934 | </tr> |
---|
935 | </table> |
---|
936 | </td> |
---|
937 | </tr> |
---|
938 | </table> |
---|
939 | <p> </p> |
---|
940 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
941 | <tr> |
---|
942 | <td class="tableheader"> |
---|
943 | <p class="tableheader"><a name="cut">CUT</a></p> |
---|
944 | </td> |
---|
945 | </tr> |
---|
946 | <tr> |
---|
947 | <td> |
---|
948 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
949 | <tr> |
---|
950 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
951 | Syntax<p> </p> |
---|
952 | </th> |
---|
953 | <td class="code" valign="top" nowrap width="100%"><code>F = cut(X,'tag')</code></td> |
---|
954 | </tr> |
---|
955 | <tr> |
---|
956 | <td class="tabxpl"> |
---|
957 | <table border="0"> |
---|
958 | <tr> |
---|
959 | <td> |
---|
960 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
961 | </td> |
---|
962 | <td>set object</td> |
---|
963 | </tr> |
---|
964 | <tr> |
---|
965 | <td> |
---|
966 | <p align="right"><font face="Courier New" size="2">X:</font></p> |
---|
967 | </td> |
---|
968 | <td>sdpvar or constraint object, or string</td> |
---|
969 | </tr> |
---|
970 | <tr> |
---|
971 | <td> |
---|
972 | <p align="right"><font face="Courier New" size="2">'tag':</font></p> |
---|
973 | </td> |
---|
974 | <td>char</td> |
---|
975 | </tr> |
---|
976 | </table> |
---|
977 | </td> |
---|
978 | </tr> |
---|
979 | <tr> |
---|
980 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
981 | Description</th> |
---|
982 | </tr> |
---|
983 | <tr> |
---|
984 | <td class="tabxpl">cut is used to define user-specified cuts for the |
---|
985 | global BMI solver.</td> |
---|
986 | </tr> |
---|
987 | <tr> |
---|
988 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
989 | Example</th> |
---|
990 | </tr> |
---|
991 | <tr> |
---|
992 | <td class="tabxpl"><p>The result from this command is nothing but a |
---|
993 | <a href="#set">set</a> object.</p> |
---|
994 | <table cellpadding="10" width="100%"> |
---|
995 | <tr> |
---|
996 | <td class="xmpcode"> |
---|
997 | <pre>P = sdpvar(2,2); |
---|
998 | F = cut((P-eye(2))*(P-eye(2))>0); |
---|
999 | <font color="#000000">+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1000 | | ID| Constraint| Type| |
---|
1001 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1002 | | #1| Numeric value| Matrix inequality (quadratic) 2x2| |
---|
1003 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></pre> |
---|
1004 | </td> |
---|
1005 | </tr> |
---|
1006 | </table> |
---|
1007 | <p>The only difference is that this constraint will not be used in |
---|
1008 | the upper bound problem in the branch & bound procudure. The constraint |
---|
1009 | will thus only be used to improve the relaxations. See the examples |
---|
1010 | in <a target="topic" href="globalbmi.htm">global solutions of bilinear |
---|
1011 | programs</a>.</p> |
---|
1012 | </td> |
---|
1013 | </tr> |
---|
1014 | <tr> |
---|
1015 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1016 | Related commands</th> |
---|
1017 | </tr> |
---|
1018 | <tr> |
---|
1019 | <td class="tabxpl"><a href="reference.htm#set">set</a></td> |
---|
1020 | </tr> |
---|
1021 | </table> |
---|
1022 | </td> |
---|
1023 | </tr> |
---|
1024 | </table> |
---|
1025 | <p> </p> |
---|
1026 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table69"> |
---|
1027 | <tr> |
---|
1028 | <td class="tableheader"> |
---|
1029 | <p class="tableheader"><a name="dissect">DISSECT</a></p> |
---|
1030 | </td> |
---|
1031 | </tr> |
---|
1032 | <tr> |
---|
1033 | <td> |
---|
1034 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table70"> |
---|
1035 | <tr> |
---|
1036 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1037 | Syntax<p> </p> |
---|
1038 | </th> |
---|
1039 | <td class="code" valign="top" nowrap width="100%"><code>F = |
---|
1040 | dissect(X)</code></td> |
---|
1041 | </tr> |
---|
1042 | <tr> |
---|
1043 | <td class="tabxpl"> |
---|
1044 | <table border="0" id="table71"> |
---|
1045 | <tr> |
---|
1046 | <td> |
---|
1047 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
1048 | </td> |
---|
1049 | <td>set object</td> |
---|
1050 | </tr> |
---|
1051 | <tr> |
---|
1052 | <td> |
---|
1053 | <p align="right"><font face="Courier New" size="2">X:</font></p> |
---|
1054 | </td> |
---|
1055 | <td>set object</td> |
---|
1056 | </tr> |
---|
1057 | </table> |
---|
1058 | </td> |
---|
1059 | </tr> |
---|
1060 | <tr> |
---|
1061 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1062 | Description</th> |
---|
1063 | </tr> |
---|
1064 | <tr> |
---|
1065 | <td class="tabxpl">dissect can be used to transform extremely |
---|
1066 | large sparse and structured SDP constraints to a set of smaller |
---|
1067 | SDP constraints, at the price of introducing more variables.</td> |
---|
1068 | </tr> |
---|
1069 | <tr> |
---|
1070 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1071 | Example</th> |
---|
1072 | </tr> |
---|
1073 | <tr> |
---|
1074 | <td class="tabxpl">NOTE : For the examples below to work, you need |
---|
1075 | to have |
---|
1076 | <a target="_blank" href="http://www.cerfacs.fr/algor/Softs/MESHPART/"> |
---|
1077 | MESHPART</a> installed. |
---|
1078 | <p>Let us begin by defining a large but low bandwidth SDP |
---|
1079 | constraint.</p> |
---|
1080 | <table cellpadding="10" width="100%" id="table72"> |
---|
1081 | <tr> |
---|
1082 | <td class="xmpcode"> |
---|
1083 | <pre>n = 500; |
---|
1084 | r = 3; |
---|
1085 | B = randn(n,r+1); |
---|
1086 | S = spdiags(B,0:r,n,n);S = S+S'; |
---|
1087 | x = sdpvar(n,1); |
---|
1088 | X = diag(x)-S; |
---|
1089 | p = randperm(n); |
---|
1090 | X = X(p,p); |
---|
1091 | F = set(X > 0) |
---|
1092 | spy(F)<font color="#000000"> |
---|
1093 | +++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1094 | | ID| Constraint| Type| |
---|
1095 | +++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1096 | | #1| Numeric value| Matrix inequality 500x500| |
---|
1097 | +++++++++++++++++++++++++++++++++++++++++++++++++++++</font></pre> |
---|
1098 | </td> |
---|
1099 | </tr> |
---|
1100 | </table> |
---|
1101 | <p>Applying the dissect command simplifies the constraint to a set |
---|
1102 | of two smaller SDP constraints, at the price of introducing 6 |
---|
1103 | additional variables.</p> |
---|
1104 | <table cellpadding="10" width="100%" id="table73"> |
---|
1105 | <tr> |
---|
1106 | <td class="xmpcode"> |
---|
1107 | <pre>dissect(F) |
---|
1108 | <font color="#000000">+++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1109 | | ID| Constraint| Type| |
---|
1110 | +++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1111 | | #1| Numeric value| Matrix inequality 252x252| |
---|
1112 | | #2| Numeric value| Matrix inequality 251x251| |
---|
1113 | +++++++++++++++++++++++++++++++++++++++++++++++++++++</font> |
---|
1114 | length(getvariables(dissect(F))) |
---|
1115 | <font color="#000000">ans =</font></pre> |
---|
1116 | <pre><font color="#000000"> 506</font></pre> |
---|
1117 | </td> |
---|
1118 | </tr> |
---|
1119 | </table> |
---|
1120 | <p>The procedure can be recursively applied.</p> |
---|
1121 | <table cellpadding="10" width="100%" id="table74"> |
---|
1122 | <tr> |
---|
1123 | <td class="xmpcode"> |
---|
1124 | <pre>dissect(dissect(F)) |
---|
1125 | <font color="#000000">+++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1126 | | ID| Constraint| Type| |
---|
1127 | +++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1128 | | #1| Numeric value| Matrix inequality 128x128| |
---|
1129 | | #2| Numeric value| Matrix inequality 127x127| |
---|
1130 | | #3| Numeric value| Matrix inequality 127x127| |
---|
1131 | | #4| Numeric value| Matrix inequality 127x127| |
---|
1132 | +++++++++++++++++++++++++++++++++++++++++++++++++++++</font> |
---|
1133 | length(getvariables(dissect((dissect(F))))) |
---|
1134 | <font color="#000000">ans =</font></pre> |
---|
1135 | <pre><font color="#000000"> 518</font></pre> |
---|
1136 | </td> |
---|
1137 | </tr> |
---|
1138 | </table> |
---|
1139 | <p>To see the impact of the dissection, let us solve an SDP |
---|
1140 | problem for various levels of dissection</p> |
---|
1141 | <table cellpadding="10" width="100%" id="table75"> |
---|
1142 | <tr> |
---|
1143 | <td class="xmpcode"> |
---|
1144 | <pre>sol = solvesdp(F,trace(X));sol.solvertime |
---|
1145 | <font color="#000000">ans =</font></pre> |
---|
1146 | <pre><font color="#000000"> 123.2810 |
---|
1147 | |
---|
1148 | </font>F = dissect(F); |
---|
1149 | sol = solvesdp(F,trace(X));sol.solvertime |
---|
1150 | <font color="#000000">ans =</font></pre> |
---|
1151 | <pre><font color="#000000"> 36.0940 |
---|
1152 | |
---|
1153 | </font>F = dissect(F); |
---|
1154 | sol = solvesdp(F,trace(X));sol.solvertime |
---|
1155 | <font color="#000000">ans =</font></pre> |
---|
1156 | <pre><font color="#000000"> 11.9070</font></pre> |
---|
1157 | <pre>F = dissect(F); |
---|
1158 | sol = solvesdp(F,trace(X));sol.solvertime |
---|
1159 | <font color="#000000">ans =</font></pre> |
---|
1160 | <pre><font color="#000000"> 4.6410</font></pre> |
---|
1161 | <pre>F = dissect(F); |
---|
1162 | sol = solvesdp(F,trace(X));sol.solvertime |
---|
1163 | <font color="#000000">ans =</font></pre> |
---|
1164 | <pre><font color="#000000"> 3.8430</font></pre> |
---|
1165 | <pre>F = dissect(F); |
---|
1166 | sol = solvesdp(F,trace(X));sol.solvertime |
---|
1167 | <font color="#000000">ans =</font></pre> |
---|
1168 | <pre><font color="#000000"> 3.9370</font></pre> |
---|
1169 | </td> |
---|
1170 | </tr> |
---|
1171 | </table> |
---|
1172 | <p>Note that the dissection command can be applied to arbitrary |
---|
1173 | SDP problems in YALMIP (nonlinear problems, mixed semidefinite |
---|
1174 | and second order cone problems etc).</p> |
---|
1175 | <p>The algorithm in the command is based on finding a vertex |
---|
1176 | separator of the matrix in the SDP constraint, applying a |
---|
1177 | Dulmage-Mendelsohn permutation to detect corresponding blocks, |
---|
1178 | followed by a series of Schur completions. Details will be available in an |
---|
1179 | accompanying report soon... |
---|
1180 | </td> |
---|
1181 | </tr> |
---|
1182 | <tr> |
---|
1183 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1184 | Related commands</th> |
---|
1185 | </tr> |
---|
1186 | <tr> |
---|
1187 | <td class="tabxpl"><a href="reference.htm#set">set</a>, <a href="reference.htm#unblkdiag">unblkdiag</a></td> |
---|
1188 | </tr> |
---|
1189 | </table> |
---|
1190 | </td> |
---|
1191 | </tr> |
---|
1192 | </table> |
---|
1193 | <p> </p> |
---|
1194 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
1195 | <tr> |
---|
1196 | <td class="tableheader"> |
---|
1197 | <p class="tableheader"><a name="double">DOUBLE</a></p> |
---|
1198 | </td> |
---|
1199 | </tr> |
---|
1200 | <tr> |
---|
1201 | <td> |
---|
1202 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
1203 | <tr> |
---|
1204 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1205 | Syntax</th> |
---|
1206 | <td class="code" valign="top" nowrap width="100%"><code>Y = double(X)</code></td> |
---|
1207 | </tr> |
---|
1208 | <tr> |
---|
1209 | <td class="tabxpl"> |
---|
1210 | <table border="0"> |
---|
1211 | <tr> |
---|
1212 | <td> |
---|
1213 | <p align="right"><font face="Courier New" size="2">Y:</font></p> |
---|
1214 | </td> |
---|
1215 | <td>double</td> |
---|
1216 | </tr> |
---|
1217 | <tr> |
---|
1218 | <td> |
---|
1219 | <p align="right"><font face="Courier New" size="2">X:</font></p> |
---|
1220 | </td> |
---|
1221 | <td>sdpvar or set object</td> |
---|
1222 | </tr> |
---|
1223 | </table> |
---|
1224 | </td> |
---|
1225 | </tr> |
---|
1226 | <tr> |
---|
1227 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1228 | Description</th> |
---|
1229 | </tr> |
---|
1230 | <tr> |
---|
1231 | <td class="tabxpl">double is used to extract the numerical value of |
---|
1232 | a decision variable, or the residual of a constraint</td> |
---|
1233 | </tr> |
---|
1234 | <tr> |
---|
1235 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1236 | Examples</th> |
---|
1237 | </tr> |
---|
1238 | <tr> |
---|
1239 | <td class="tabxpl"><p>After solving an optimization problem we might, |
---|
1240 | e.g., extract the optimal objective value.</p><table cellpadding="10" width="100%"> |
---|
1241 | <tr> |
---|
1242 | <td class="xmpcode"> |
---|
1243 | <pre>solvesdp(F,obj); |
---|
1244 | optobj = double(obj);</pre> |
---|
1245 | </td> |
---|
1246 | </tr> |
---|
1247 | </table> |
---|
1248 | <p>It can also be used to extract the residual of a constraint </p> |
---|
1249 | <table cellpadding="10" width="100%"> |
---|
1250 | <tr> |
---|
1251 | <td class="xmpcode"> |
---|
1252 | <pre>solvesdp(F,obj); |
---|
1253 | res = double(F(1));</pre> |
---|
1254 | </td> |
---|
1255 | </tr> |
---|
1256 | </table> |
---|
1257 | </td> |
---|
1258 | </tr> |
---|
1259 | <tr> |
---|
1260 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1261 | Related commands</th> |
---|
1262 | </tr> |
---|
1263 | <tr> |
---|
1264 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a>, |
---|
1265 | <a href="reference.htm#solvesdp">solvesdp</a>, |
---|
1266 | <a href="reference.htm#assign">assign</a></td> |
---|
1267 | </tr> |
---|
1268 | </table> |
---|
1269 | </td> |
---|
1270 | </tr> |
---|
1271 | </table> |
---|
1272 | <p> </p> |
---|
1273 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table76"> |
---|
1274 | <tr> |
---|
1275 | <td class="tableheader"> |
---|
1276 | <p class="tableheader"><a name="hessian0">HESSIAN</a></p> |
---|
1277 | </td> |
---|
1278 | </tr> |
---|
1279 | <tr> |
---|
1280 | <td> |
---|
1281 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table77"> |
---|
1282 | <tr> |
---|
1283 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1284 | Syntax</th> |
---|
1285 | <td class="code" valign="top" nowrap width="100%"><code>H = hessian(f,x)</code></td> |
---|
1286 | </tr> |
---|
1287 | <tr> |
---|
1288 | <td class="tabxpl"> |
---|
1289 | <table border="0" id="table78"> |
---|
1290 | <tr> |
---|
1291 | <td> |
---|
1292 | <p align="right"><font face="Courier New" size="2">H:</font></p> |
---|
1293 | </td> |
---|
1294 | <td>sdpvar object</td> |
---|
1295 | </tr> |
---|
1296 | <tr> |
---|
1297 | <td> |
---|
1298 | <p align="right"><font face="Courier New" size="2">f:</font></p> |
---|
1299 | </td> |
---|
1300 | <td>scalar sdpvar object </td> |
---|
1301 | </tr> |
---|
1302 | <tr> |
---|
1303 | <td> |
---|
1304 | <p align="right"><font face="Courier New" size="2">x:</font></p> |
---|
1305 | </td> |
---|
1306 | <td>sdpvar object</td> |
---|
1307 | </tr> |
---|
1308 | </table> |
---|
1309 | </td> |
---|
1310 | </tr> |
---|
1311 | <tr> |
---|
1312 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1313 | Description</th> |
---|
1314 | </tr> |
---|
1315 | <tr> |
---|
1316 | <td class="tabxpl">Hessian calculates d2f/dx2</td> |
---|
1317 | </tr> |
---|
1318 | <tr> |
---|
1319 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1320 | Examples</th> |
---|
1321 | </tr> |
---|
1322 | <tr> |
---|
1323 | <td class="tabxpl">With only 1 argument, the differentiation is performed |
---|
1324 | with respect to all involved variables<table cellpadding="10" width="100%" id="table79"> |
---|
1325 | <tr> |
---|
1326 | <td class="xmpcode"> |
---|
1327 | <pre>x1 = sdpvar(1,1); |
---|
1328 | x2 = sdpvar(1,1); |
---|
1329 | f = x1^4+5*x2^2; |
---|
1330 | sdisplay(hessian(f))</pre> |
---|
1331 | <pre><font color="#000000">ans = </font></pre> |
---|
1332 | <pre><font color="#000000"> '12x1^2' '0' |
---|
1333 | '0' '10'</font></pre> |
---|
1334 | </td> |
---|
1335 | </tr> |
---|
1336 | </table> |
---|
1337 | <p>Giving a second argument controls what variables to differentiate |
---|
1338 | with respect to </p> |
---|
1339 | <table cellpadding="10" width="100%" id="table80"> |
---|
1340 | <tr> |
---|
1341 | <td class="xmpcode"> |
---|
1342 | <pre>sdisplay(hessian(f,x1)) |
---|
1343 | <font color="#000000">ans = </font></pre> |
---|
1344 | <pre><font color="#000000"> '12x1^2'</font></pre> |
---|
1345 | </td> |
---|
1346 | </tr> |
---|
1347 | </table> |
---|
1348 | </td> |
---|
1349 | </tr> |
---|
1350 | <tr> |
---|
1351 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1352 | Related commands</th> |
---|
1353 | </tr> |
---|
1354 | <tr> |
---|
1355 | <td class="tabxpl"><a href="reference.htm#jacobian">jacobian</a>, |
---|
1356 | <a href="reference.htm#sdisplay">sdisplay</a>, |
---|
1357 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
1358 | </tr> |
---|
1359 | </table> |
---|
1360 | </td> |
---|
1361 | </tr> |
---|
1362 | </table> |
---|
1363 | <p> </p> |
---|
1364 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
1365 | <tr> |
---|
1366 | <td class="tableheader"> |
---|
1367 | <p class="tableheader"><a name="dual">DUAL</a></p> |
---|
1368 | </td> |
---|
1369 | </tr> |
---|
1370 | <tr> |
---|
1371 | <td> |
---|
1372 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
1373 | <tr> |
---|
1374 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1375 | Syntax</th> |
---|
1376 | <td class="code" valign="top" nowrap width="100%"><code>Z = dual(F)</code></td> |
---|
1377 | </tr> |
---|
1378 | <tr> |
---|
1379 | <td class="tabxpl"> |
---|
1380 | <table border="0"> |
---|
1381 | <tr> |
---|
1382 | <td> |
---|
1383 | <p align="right"><font face="Courier New" size="2">Z:</font></p> |
---|
1384 | </td> |
---|
1385 | <td>double</td> |
---|
1386 | </tr> |
---|
1387 | <tr> |
---|
1388 | <td> |
---|
1389 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
1390 | </td> |
---|
1391 | <td>set object (with one constraint)</td> |
---|
1392 | </tr> |
---|
1393 | </table> |
---|
1394 | </td> |
---|
1395 | </tr> |
---|
1396 | <tr> |
---|
1397 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1398 | Description</th> |
---|
1399 | </tr> |
---|
1400 | <tr> |
---|
1401 | <td class="tabxpl">dual is used to extract the dual variable related |
---|
1402 | to a constraint</td> |
---|
1403 | </tr> |
---|
1404 | <tr> |
---|
1405 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1406 | Examples</th> |
---|
1407 | </tr> |
---|
1408 | <tr> |
---|
1409 | <td class="tabxpl"><p>After solving an optimization problem we might, |
---|
1410 | e.g., extract the dual variable of the 2nd constraint.</p><table cellpadding="10" width="100%"> |
---|
1411 | <tr> |
---|
1412 | <td class="xmpcode"> |
---|
1413 | <pre>solvesdp(F,obj); |
---|
1414 | Z2 = dual(F(2));</pre> |
---|
1415 | </td> |
---|
1416 | </tr> |
---|
1417 | </table> |
---|
1418 | <p>If the constraints in the set object have been tagged, we can use |
---|
1419 | the tag instead </p> |
---|
1420 | <table cellpadding="10" width="100%"> |
---|
1421 | <tr> |
---|
1422 | <td class="xmpcode"> |
---|
1423 | <pre>solvesdp(F,obj); |
---|
1424 | Z2 = dual(F('Lyapunov constraint'));</pre> |
---|
1425 | </td> |
---|
1426 | </tr> |
---|
1427 | </table> |
---|
1428 | </td> |
---|
1429 | </tr> |
---|
1430 | <tr> |
---|
1431 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1432 | Related commands</th> |
---|
1433 | </tr> |
---|
1434 | <tr> |
---|
1435 | <td class="tabxpl"><a href="reference.htm#set">set</a>, |
---|
1436 | <a href="reference.htm#solvesdp">solvesdp</a>, |
---|
1437 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
1438 | </tr> |
---|
1439 | </table> |
---|
1440 | </td> |
---|
1441 | </tr> |
---|
1442 | </table> |
---|
1443 | <p> </p> |
---|
1444 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
1445 | <tr> |
---|
1446 | <td class="tableheader"> |
---|
1447 | <p class="tableheader"><a name="dualize">DUALIZE</a></p> |
---|
1448 | </td> |
---|
1449 | </tr> |
---|
1450 | <tr> |
---|
1451 | <td> |
---|
1452 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
1453 | <tr> |
---|
1454 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1455 | Syntax</th> |
---|
1456 | <td class="code" valign="top" nowrap width="100%"><code> |
---|
1457 | [Fd,objd,X,free] = dualize(F,obj)</code></td> |
---|
1458 | </tr> |
---|
1459 | <tr> |
---|
1460 | <td class="tabxpl"> |
---|
1461 | <table border="0"> |
---|
1462 | <tr> |
---|
1463 | <td> |
---|
1464 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
1465 | </td> |
---|
1466 | <td>set object in primal SDP form</td> |
---|
1467 | </tr> |
---|
1468 | <tr> |
---|
1469 | <td> |
---|
1470 | <p align="right"><font face="Courier New" size="2">obj:</font></p> |
---|
1471 | </td> |
---|
1472 | <td>sdpvar object (primal cost)</td> |
---|
1473 | </tr> |
---|
1474 | <tr> |
---|
1475 | <td> |
---|
1476 | <p align="right"><font face="Courier New" size="2">Fd:</font></p> |
---|
1477 | </td> |
---|
1478 | <td>set object in dual SDP form</td> |
---|
1479 | </tr> |
---|
1480 | <tr> |
---|
1481 | <td> |
---|
1482 | <p align="right"><font face="Courier New">objd</font><font face="Courier New" size="2">:</font></p> |
---|
1483 | </td> |
---|
1484 | <td>sdpvar object (dual cost)</td> |
---|
1485 | </tr> |
---|
1486 | <tr> |
---|
1487 | <td> |
---|
1488 | <p align="right"><font face="Courier New" size="2">X:</font></p> |
---|
1489 | </td> |
---|
1490 | <td>cell of sdpvar object (primal cone variables)</td> |
---|
1491 | </tr> |
---|
1492 | <tr> |
---|
1493 | <td> |
---|
1494 | <p align="right"><font face="Courier New" size="2">free:</font></p> |
---|
1495 | </td> |
---|
1496 | <td>sdpvar objects (free primal variables)</td> |
---|
1497 | </tr> |
---|
1498 | </table> |
---|
1499 | </td> |
---|
1500 | </tr> |
---|
1501 | <tr> |
---|
1502 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1503 | Description</th> |
---|
1504 | </tr> |
---|
1505 | <tr> |
---|
1506 | <td class="tabxpl">dualize is used to convert a SDP problem given |
---|
1507 | in primal form to the corresponding dual problem.</td> |
---|
1508 | </tr> |
---|
1509 | <tr> |
---|
1510 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1511 | Examples</th> |
---|
1512 | </tr> |
---|
1513 | <tr> |
---|
1514 | <td class="tabxpl">Consider the following SDP problem in primal |
---|
1515 | form.<table cellpadding="10" width="100%"> |
---|
1516 | <tr> |
---|
1517 | <td class="xmpcode"> |
---|
1518 | <pre>X = sdpvar(3,3); |
---|
1519 | Y = sdpvar(3,3); |
---|
1520 | F = set(X>0) + set(Y>0); |
---|
1521 | F = F + set(X(1,3)==9) + set(Y(1,1)==X(2,2)); |
---|
1522 | F = F + set(sum(sum(X))+sum(sum(Y)) == 20); |
---|
1523 | obj = trace(X)+trace(Y);</pre> |
---|
1524 | </td> |
---|
1525 | </tr> |
---|
1526 | </table> |
---|
1527 | <p>We can solve this in the given format. This will however be |
---|
1528 | very inefficient in YALMIP, since the matrices X and Y will be |
---|
1529 | explicitely parameterized, and the problem will be solved in a |
---|
1530 | dual form with equality constraints. Instead, we note that the |
---|
1531 | problem is an SDP in standard primal form. We therefor let YALMIP |
---|
1532 | extract this primal model, and return the dual of this. If we |
---|
1533 | solve this problem, the dual of this will be the original primal. |
---|
1534 | Confused yet? (note that the dual objective should be maximized)</p> |
---|
1535 | <table cellpadding="10" width="100%"> |
---|
1536 | <tr> |
---|
1537 | <td class="xmpcode"> |
---|
1538 | <pre>[Fd,objd,XX,y] = dualize(F,obj); |
---|
1539 | solvesdp(Fd,-objd);</pre> |
---|
1540 | </td> |
---|
1541 | </tr> |
---|
1542 | </table> |
---|
1543 | <p>To obtain our original variables, we extract the duals</p> |
---|
1544 | <table cellpadding="10" width="100%"> |
---|
1545 | <tr> |
---|
1546 | <td class="xmpcode"> |
---|
1547 | <pre>assign(XX{1},dual(Fd(1)); |
---|
1548 | assign(XX{2},dual(Fd(2));</pre> |
---|
1549 | </td> |
---|
1550 | </tr> |
---|
1551 | </table> |
---|
1552 | <p>Check out the tutorial for more <a href="dual.htm#dualize"> |
---|
1553 | examples</a></td> |
---|
1554 | </tr> |
---|
1555 | <tr> |
---|
1556 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1557 | Related commands</th> |
---|
1558 | </tr> |
---|
1559 | <tr> |
---|
1560 | <td class="tabxpl"> |
---|
1561 | <a href="reference.htm#dual">dual</a>, |
---|
1562 | <a href="reference.htm#set">set</a>, |
---|
1563 | <a href="reference.htm#solvesdp">solvesdp</a>, |
---|
1564 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
1565 | </tr> |
---|
1566 | </table> |
---|
1567 | </td> |
---|
1568 | </tr> |
---|
1569 | </table> |
---|
1570 | <p> </p> |
---|
1571 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
1572 | <tr> |
---|
1573 | <td class="tableheader"> |
---|
1574 | <p class="tableheader"><a name="export">EXPORT</font></a></p> |
---|
1575 | </td> |
---|
1576 | </tr> |
---|
1577 | <tr> |
---|
1578 | <td> |
---|
1579 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
1580 | <tr> |
---|
1581 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1582 | Syntax<p> </p> |
---|
1583 | </th> |
---|
1584 | <td class="code" valign="top" nowrap width="100%"><code>[model,recoverymodel] |
---|
1585 | = export(F,h,ops)</code></td> |
---|
1586 | </tr> |
---|
1587 | <tr> |
---|
1588 | <td class="tabxpl"> |
---|
1589 | <table border="0"> |
---|
1590 | <tr> |
---|
1591 | <td> |
---|
1592 | <p align="right"><font face="Courier New" size="2">model:</font></p> |
---|
1593 | </td> |
---|
1594 | <td>Output structure.</td> |
---|
1595 | </tr> |
---|
1596 | <tr> |
---|
1597 | <td> |
---|
1598 | <font face="Courier New" size="2">recoverymodel:</font></td> |
---|
1599 | <td>Output structure.</td> |
---|
1600 | </tr> |
---|
1601 | <tr> |
---|
1602 | <td> |
---|
1603 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
1604 | </td> |
---|
1605 | <td>set object describing the constraints. </td> |
---|
1606 | </tr> |
---|
1607 | <tr> |
---|
1608 | <td> |
---|
1609 | <p align="right"><font face="Courier New" size="2">h:</font></p> |
---|
1610 | </td> |
---|
1611 | <td>sdpvar-object describing the objective function.</td> |
---|
1612 | </tr> |
---|
1613 | <tr> |
---|
1614 | <td> |
---|
1615 | <p align="right"><font face="Courier New" size="2">ops:</font></p> |
---|
1616 | </td> |
---|
1617 | <td>options structure from sdpsettings.</td> |
---|
1618 | </tr> |
---|
1619 | </table> |
---|
1620 | </td> |
---|
1621 | </tr> |
---|
1622 | <tr> |
---|
1623 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1624 | Description</th> |
---|
1625 | </tr> |
---|
1626 | <tr> |
---|
1627 | <td class="tabxpl">export is used to export YALMIP models to |
---|
1628 | various solver formats (<font color="#FF0000">note : not all |
---|
1629 | solvers are supported yet</font>)</td> |
---|
1630 | </tr> |
---|
1631 | <tr> |
---|
1632 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1633 | Examples</th> |
---|
1634 | </tr> |
---|
1635 | <tr> |
---|
1636 | <td class="tabxpl"><p>Consider a Lyapunov stability problem</p><table cellpadding="10" width="100%"> |
---|
1637 | <tr> |
---|
1638 | <td class="xmpcode"> |
---|
1639 | <pre>A = randn(5,5);A = -A*A'; |
---|
1640 | P = sdpvar(5,5); |
---|
1641 | F = set(A'*P+P*A < 0) + set(P>eye(5)); |
---|
1642 | obj = trace(P);</pre> |
---|
1643 | </td> |
---|
1644 | </tr> |
---|
1645 | </table> |
---|
1646 | <p>Exporting this to a model in SeDuMi format is done by |
---|
1647 | specifying the solver as <code>'sedumi'</code> and calling export in the same way |
---|
1648 | as <a href="reference.htm#solvesdp">solvesdp</a> would have ben called.</p> |
---|
1649 | <table cellpadding="10" width="100%"> |
---|
1650 | <tr> |
---|
1651 | <td class="xmpcode"> |
---|
1652 | <pre>[model,recoverymodel] = export(F,obj,sdpsettings('solver','sedumi'));</pre> |
---|
1653 | <pre><font color="#000000">model = </font></pre> |
---|
1654 | <pre><font color="#000000"> A: [50x15 double] |
---|
1655 | b: [15x1 double] |
---|
1656 | C: [50x1 double] |
---|
1657 | K: [1x1 struct] |
---|
1658 | pars: [1x1 struct]</font></pre> |
---|
1659 | </td> |
---|
1660 | </tr> |
---|
1661 | </table> |
---|
1662 | <p>The data in <code>recoverymodel</code> can be used to relate a solution |
---|
1663 | obtained from using the exported model, to the actual variables in |
---|
1664 | YALMIP. </p> |
---|
1665 | <table cellpadding="10" width="100%"> |
---|
1666 | <tr> |
---|
1667 | <td class="xmpcode"> |
---|
1668 | <pre>[x,y] = sedumi(model.A,model.b,model.C,model.K); |
---|
1669 | assign(recover(recoverymodel.used_variables),y);</pre> |
---|
1670 | </td> |
---|
1671 | </tr> |
---|
1672 | </table> |
---|
1673 | <p>Some solvers do not support equality constraints. One way to |
---|
1674 | handle this in YALMIP is to use <code>sdpsettings('remove',1)</code>. |
---|
1675 | If this is done, YALMIP derives basis and |
---|
1676 | solves the problem in the reduced variables. This basis is |
---|
1677 | communicated through the structure <code>recoverymodel</code>.</p> |
---|
1678 | <table cellpadding="10" width="100%"> |
---|
1679 | <tr> |
---|
1680 | <td class="xmpcode"> |
---|
1681 | <pre>ops = sdpsettings('solver','sedumi','remove',1); |
---|
1682 | [model,recoverymodel] = export(F+set(trace(P)==10),obj,ops); |
---|
1683 | [x,y] = sedumi(model.A,model.b,model.C,model.K); |
---|
1684 | z = recoverymodel.x_equ + recoverymodel.H*y; |
---|
1685 | assign(recover(recoverymodel.used_variables),z);</pre> |
---|
1686 | </td> |
---|
1687 | </tr> |
---|
1688 | </table> |
---|
1689 | </td> |
---|
1690 | </tr> |
---|
1691 | <tr> |
---|
1692 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1693 | Related commands</th> |
---|
1694 | </tr> |
---|
1695 | <tr> |
---|
1696 | <td class="tabxpl"><a href="reference.htm#solvesdp">solvesdp</a></td> |
---|
1697 | </tr> |
---|
1698 | </table> |
---|
1699 | </td> |
---|
1700 | </tr> |
---|
1701 | </table> |
---|
1702 | <p> </p> |
---|
1703 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
1704 | <tr> |
---|
1705 | <td class="tableheader"> |
---|
1706 | <p class="tableheader"><a name="hessian">HESSIAN</a></p> |
---|
1707 | </td> |
---|
1708 | </tr> |
---|
1709 | <tr> |
---|
1710 | <td> |
---|
1711 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
1712 | <tr> |
---|
1713 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1714 | Syntax</th> |
---|
1715 | <td class="code" valign="top" nowrap width="100%"><code>H = hessian(f,x)</code></td> |
---|
1716 | </tr> |
---|
1717 | <tr> |
---|
1718 | <td class="tabxpl"> |
---|
1719 | <table border="0"> |
---|
1720 | <tr> |
---|
1721 | <td> |
---|
1722 | <p align="right"><font face="Courier New" size="2">H:</font></p> |
---|
1723 | </td> |
---|
1724 | <td>sdpvar object</td> |
---|
1725 | </tr> |
---|
1726 | <tr> |
---|
1727 | <td> |
---|
1728 | <p align="right"><font face="Courier New" size="2">f:</font></p> |
---|
1729 | </td> |
---|
1730 | <td>scalar sdpvar object </td> |
---|
1731 | </tr> |
---|
1732 | <tr> |
---|
1733 | <td> |
---|
1734 | <p align="right"><font face="Courier New" size="2">x:</font></p> |
---|
1735 | </td> |
---|
1736 | <td>sdpvar object</td> |
---|
1737 | </tr> |
---|
1738 | </table> |
---|
1739 | </td> |
---|
1740 | </tr> |
---|
1741 | <tr> |
---|
1742 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1743 | Description</th> |
---|
1744 | </tr> |
---|
1745 | <tr> |
---|
1746 | <td class="tabxpl">Hessian calculates d2f/dx2</td> |
---|
1747 | </tr> |
---|
1748 | <tr> |
---|
1749 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1750 | Examples</th> |
---|
1751 | </tr> |
---|
1752 | <tr> |
---|
1753 | <td class="tabxpl">With only 1 argument, the differentiation is performed |
---|
1754 | with respect to all involved variables<table cellpadding="10" width="100%"> |
---|
1755 | <tr> |
---|
1756 | <td class="xmpcode"> |
---|
1757 | <pre>x1 = sdpvar(1,1); |
---|
1758 | x2 = sdpvar(1,1); |
---|
1759 | f = x1^4+5*x2^2; |
---|
1760 | sdisplay(hessian(f))</pre> |
---|
1761 | <pre><font color="#000000">ans = </font></pre> |
---|
1762 | <pre><font color="#000000"> '12x1^2' '0' |
---|
1763 | '0' '10'</font></pre> |
---|
1764 | </td> |
---|
1765 | </tr> |
---|
1766 | </table> |
---|
1767 | <p>Giving a second argument controls what variables to differentiate |
---|
1768 | with respect to </p> |
---|
1769 | <table cellpadding="10" width="100%"> |
---|
1770 | <tr> |
---|
1771 | <td class="xmpcode"> |
---|
1772 | <pre>sdisplay(hessian(f,x1)) |
---|
1773 | <font color="#000000">ans = </font></pre> |
---|
1774 | <pre><font color="#000000"> '12x1^2'</font></pre> |
---|
1775 | </td> |
---|
1776 | </tr> |
---|
1777 | </table> |
---|
1778 | </td> |
---|
1779 | </tr> |
---|
1780 | <tr> |
---|
1781 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1782 | Related commands</th> |
---|
1783 | </tr> |
---|
1784 | <tr> |
---|
1785 | <td class="tabxpl"><a href="reference.htm#jacobian">jacobian</a>, |
---|
1786 | <a href="reference.htm#sdisplay">sdisplay</a>, |
---|
1787 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
1788 | </tr> |
---|
1789 | </table> |
---|
1790 | </td> |
---|
1791 | </tr> |
---|
1792 | </table> |
---|
1793 | <p> </p> |
---|
1794 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table132"> |
---|
1795 | <tr> |
---|
1796 | <td class="tableheader"> |
---|
1797 | <p class="tableheader"><a name="hull">HULL</a></p> |
---|
1798 | </td> |
---|
1799 | </tr> |
---|
1800 | <tr> |
---|
1801 | <td> |
---|
1802 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table133"> |
---|
1803 | <tr> |
---|
1804 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1805 | Syntax</th> |
---|
1806 | <td class="code" valign="top" nowrap width="100%"><code>F = hull(F1,F2,...)</code></td> |
---|
1807 | </tr> |
---|
1808 | <tr> |
---|
1809 | <td class="tabxpl"> |
---|
1810 | <table border="0" id="table134"> |
---|
1811 | <tr> |
---|
1812 | <td> |
---|
1813 | <p align="right"><font face="Courier New">F</font><font face="Courier New" size="2">:</font></p> |
---|
1814 | </td> |
---|
1815 | <td>set object </td> |
---|
1816 | </tr> |
---|
1817 | <tr> |
---|
1818 | <td> |
---|
1819 | <p align="right"><font face="Courier New" size="2">Fi:</font></p> |
---|
1820 | </td> |
---|
1821 | <td>set objects</td> |
---|
1822 | </tr> |
---|
1823 | </table> |
---|
1824 | </td> |
---|
1825 | </tr> |
---|
1826 | <tr> |
---|
1827 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1828 | Description</th> |
---|
1829 | </tr> |
---|
1830 | <tr> |
---|
1831 | <td class="tabxpl">hull is used to create a convex representation |
---|
1832 | of the convex hull of a set of constraints.</td> |
---|
1833 | </tr> |
---|
1834 | <tr> |
---|
1835 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1836 | Examples</th> |
---|
1837 | </tr> |
---|
1838 | <tr> |
---|
1839 | <td class="tabxpl">Define two polytope<table cellpadding="10" width="100%" id="table135"> |
---|
1840 | <tr> |
---|
1841 | <td class="xmpcode"> |
---|
1842 | <pre>sdpvar x y |
---|
1843 | F1 = set(-1 < x < 1) + set(-1 < y < 1); |
---|
1844 | F2 = set(-1.5 < x-y < 1.5) + set(-1.5 < x+y < 1.5);</pre> |
---|
1845 | </td> |
---|
1846 | </tr> |
---|
1847 | </table> |
---|
1848 | <p>Plot the polytopes</p> |
---|
1849 | <table cellpadding="10" width="100%" id="table136"> |
---|
1850 | <tr> |
---|
1851 | <td class="xmpcode"> |
---|
1852 | <pre>plot(F2);hold on |
---|
1853 | plot(F1);</pre> |
---|
1854 | </td> |
---|
1855 | </tr> |
---|
1856 | </table> |
---|
1857 | <p>Notice, if you have MPT installed, this is quicker</p> |
---|
1858 | <table cellpadding="10" width="100%" id="table137"> |
---|
1859 | <tr> |
---|
1860 | <td class="xmpcode"> |
---|
1861 | <pre>plot(polytope(F2));hold on |
---|
1862 | plot(polytope(F1));</pre> |
---|
1863 | </td> |
---|
1864 | </tr> |
---|
1865 | </table> |
---|
1866 | <p>Create a convex model of the convex hull</p> |
---|
1867 | <table cellpadding="10" width="100%" id="table138"> |
---|
1868 | <tr> |
---|
1869 | <td class="xmpcode"> |
---|
1870 | <pre>H = hull(F1,F2) |
---|
1871 | +++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1872 | | ID| Constraint| Type| |
---|
1873 | +++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
1874 | | #1| Numeric value| Element-wise 2x1| |
---|
1875 | | #2| Numeric value| Element-wise 2x1| |
---|
1876 | | #3| Numeric value| Element-wise 2x1| |
---|
1877 | | #4| Numeric value| Element-wise 2x1| |
---|
1878 | | #5| Numeric value| Equality constraint 2x1| |
---|
1879 | | #6| Numeric value| Equality constraint 1x1| |
---|
1880 | | #7| Numeric value| Element-wise 2x1| |
---|
1881 | +++++++++++++++++++++++++++++++++++++++++++++++++++</pre> |
---|
1882 | </td> |
---|
1883 | </tr> |
---|
1884 | </table> |
---|
1885 | <p>Important to realize is that the representation will introduce |
---|
1886 | new variables due to a lifting procedure. We can plot the convex hull, but since |
---|
1887 | we have introduced new variables, we must declare that we |
---|
1888 | are interested in the projection on the original variables <b>x</b> |
---|
1889 | and <b>y</b></p> |
---|
1890 | <table cellpadding="10" width="100%" id="table139"> |
---|
1891 | <tr> |
---|
1892 | <td class="xmpcode"> |
---|
1893 | <pre>clf; |
---|
1894 | plot(H,[x y]);hold on |
---|
1895 | plot(F2); |
---|
1896 | plot(F1);</pre> |
---|
1897 | </td> |
---|
1898 | </tr> |
---|
1899 | </table> |
---|
1900 | <p>The command applies to (almost) arbitrary convex constraints.<table cellpadding="10" width="100%" id="table140"> |
---|
1901 | <tr> |
---|
1902 | <td class="xmpcode"> |
---|
1903 | <pre>clf; |
---|
1904 | sdpvar x y |
---|
1905 | F1 = set([1 x y+3;[x;y+3] 1/5*eye(2)] > 0); |
---|
1906 | F2 = set(-1.5 < x-y < 1.5) + set(-1.5 < x+y < 1.5); |
---|
1907 | H = hull(F1,F2); |
---|
1908 | plot(H,[x y]);hold on |
---|
1909 | plot(F2); |
---|
1910 | plot(F1);</pre> |
---|
1911 | </td> |
---|
1912 | </tr> |
---|
1913 | </table> |
---|
1914 | <p>At the moment, the command does not support constraints that |
---|
1915 | involve <a href="extoperators.htm">nonlinear operators</a> or |
---|
1916 | quadratic terms, although this easily can be added if anyone |
---|
1917 | needs it.</td> |
---|
1918 | </tr> |
---|
1919 | <tr> |
---|
1920 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1921 | Related commands</th> |
---|
1922 | </tr> |
---|
1923 | <tr> |
---|
1924 | <td class="tabxpl"><a href="reference.htm#set">set</a>, |
---|
1925 | <a href="reference.htm#solvesdp">solvesdp</a>, |
---|
1926 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
1927 | </tr> |
---|
1928 | </table> |
---|
1929 | </td> |
---|
1930 | </tr> |
---|
1931 | </table> |
---|
1932 | <p> </p> |
---|
1933 | <p> </p> |
---|
1934 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table4"> |
---|
1935 | <tr> |
---|
1936 | <td class="tableheader"> |
---|
1937 | <p class="tableheader"><a name="imagemodel">IMAGEMODEL</a></p> |
---|
1938 | </td> |
---|
1939 | </tr> |
---|
1940 | <tr> |
---|
1941 | <td> |
---|
1942 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table5"> |
---|
1943 | <tr> |
---|
1944 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1945 | Syntax</th> |
---|
1946 | <td class="code" valign="top" nowrap width="100%"><code> |
---|
1947 | [Fi,obji,x,y] = imagemodel(F,obj)</code></td> |
---|
1948 | </tr> |
---|
1949 | <tr> |
---|
1950 | <td class="tabxpl"> |
---|
1951 | <table border="0" id="table6"> |
---|
1952 | <tr> |
---|
1953 | <td> |
---|
1954 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
1955 | </td> |
---|
1956 | <td>set object</td> |
---|
1957 | </tr> |
---|
1958 | <tr> |
---|
1959 | <td> |
---|
1960 | <p align="right"><font face="Courier New" size="2">obj:</font></p> |
---|
1961 | </td> |
---|
1962 | <td>sdpvar object (objective)</td> |
---|
1963 | </tr> |
---|
1964 | <tr> |
---|
1965 | <td> |
---|
1966 | <p align="right"><font face="Courier New" size="2">Fd:</font></p> |
---|
1967 | </td> |
---|
1968 | <td>set object</td> |
---|
1969 | </tr> |
---|
1970 | <tr> |
---|
1971 | <td> |
---|
1972 | <p align="right"><font face="Courier New">obji</font><font face="Courier New" size="2">:</font></p> |
---|
1973 | </td> |
---|
1974 | <td>sdpvar object (dual cost)</td> |
---|
1975 | </tr> |
---|
1976 | <tr> |
---|
1977 | <td> |
---|
1978 | <p align="right"><font face="Courier New">x</font><font face="Courier New" size="2">:</font></p> |
---|
1979 | </td> |
---|
1980 | <td>sdpvar object (original variables)</td> |
---|
1981 | </tr> |
---|
1982 | <tr> |
---|
1983 | <td> |
---|
1984 | <p align="right"><font face="Courier New">y</font><font face="Courier New" size="2">:</font></p> |
---|
1985 | </td> |
---|
1986 | <td>sdpvar object (original variables expressed in new |
---|
1987 | basis)</td> |
---|
1988 | </tr> |
---|
1989 | </table> |
---|
1990 | </td> |
---|
1991 | </tr> |
---|
1992 | <tr> |
---|
1993 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
1994 | Description</th> |
---|
1995 | </tr> |
---|
1996 | <tr> |
---|
1997 | <td class="tabxpl">imagemodel is used to reduce the number of |
---|
1998 | variables in a problem by eliminating explicit equality |
---|
1999 | constraints</td> |
---|
2000 | </tr> |
---|
2001 | <tr> |
---|
2002 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2003 | Examples</th> |
---|
2004 | </tr> |
---|
2005 | <tr> |
---|
2006 | <td class="tabxpl">Consider the following equality constrained |
---|
2007 | SDP.<table cellpadding="10" width="100%" id="table7"> |
---|
2008 | <tr> |
---|
2009 | <td class="xmpcode"> |
---|
2010 | <pre>C = eye(2); |
---|
2011 | A1 = randn(2,2);A1 = A1*A1'; |
---|
2012 | A2 = randn(2,2);A2 = A2*A2'; |
---|
2013 | A3 = randn(2,2);A3 = A3*A3'; |
---|
2014 | z = sdpvar(3,1);</pre> |
---|
2015 | <pre>obj = sum(z) |
---|
2016 | F = set(C+A1*z(1)+A2*z(2)+A3*z(3) > 0) + set(z(1)+z(2)== 1)</pre> |
---|
2017 | </td> |
---|
2018 | </tr> |
---|
2019 | </table> |
---|
2020 | <p>A model without the explicit equality constraint is easily |
---|
2021 | obtained.</p> |
---|
2022 | <table cellpadding="10" width="100%" id="table8"> |
---|
2023 | <tr> |
---|
2024 | <td class="xmpcode"> |
---|
2025 | <pre>[Fi,obji,x,y] = imagemodel(F,obj);</pre> |
---|
2026 | </td> |
---|
2027 | </tr> |
---|
2028 | </table> |
---|
2029 | <p>We solve the reduced problem, and recover the original |
---|
2030 | variables</p> |
---|
2031 | <table cellpadding="10" width="100%" id="table9"> |
---|
2032 | <tr> |
---|
2033 | <td class="xmpcode"> |
---|
2034 | <pre>solvesdp(F,obji); |
---|
2035 | assign(x,double(y));</pre> |
---|
2036 | </td> |
---|
2037 | </tr> |
---|
2038 | </table> |
---|
2039 | <p>Note that this reduction is automatically done when you call |
---|
2040 | <a href="reference.htm#solvesdp">solvesdp</a> and use a solver |
---|
2041 | that cannot handle equality constraints. Hence, there is |
---|
2042 | typically no reason to use this command, unless some further |
---|
2043 | manipulations are going to be performed.</td> |
---|
2044 | </tr> |
---|
2045 | <tr> |
---|
2046 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2047 | Related commands</th> |
---|
2048 | </tr> |
---|
2049 | <tr> |
---|
2050 | <td class="tabxpl"> |
---|
2051 | <a href="reference.htm#solvesdp">solvesdp</a>, |
---|
2052 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
2053 | </tr> |
---|
2054 | </table> |
---|
2055 | </td> |
---|
2056 | </tr> |
---|
2057 | </table> |
---|
2058 | <p> </p> |
---|
2059 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
2060 | <tr> |
---|
2061 | <td class="tableheader"> |
---|
2062 | <p class="tableheader"><a name="integer">INTEGER</a></p> |
---|
2063 | </td> |
---|
2064 | </tr> |
---|
2065 | <tr> |
---|
2066 | <td> |
---|
2067 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
2068 | <tr> |
---|
2069 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2070 | Syntax</th> |
---|
2071 | <td class="code" valign="top" nowrap width="100%"><code>c = integer(x)</code></td> |
---|
2072 | </tr> |
---|
2073 | <tr> |
---|
2074 | <td class="tabxpl"> |
---|
2075 | <table border="0"> |
---|
2076 | <tr> |
---|
2077 | <td> |
---|
2078 | <p align="right"><font face="Courier New" size="2">c:</font></p> |
---|
2079 | </td> |
---|
2080 | <td>sdpvar object (only useful in set object)</td> |
---|
2081 | </tr> |
---|
2082 | <tr> |
---|
2083 | <td> |
---|
2084 | <p align="right"><font face="Courier New" size="2">x:</font></p> |
---|
2085 | </td> |
---|
2086 | <td>sdpvar object</td> |
---|
2087 | </tr> |
---|
2088 | </table> |
---|
2089 | </td> |
---|
2090 | </tr> |
---|
2091 | <tr> |
---|
2092 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2093 | Description</th> |
---|
2094 | </tr> |
---|
2095 | <tr> |
---|
2096 | <td class="tabxpl">integer is used to constrain a set of variable |
---|
2097 | to be integer.</td> |
---|
2098 | </tr> |
---|
2099 | <tr> |
---|
2100 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2101 | Examples</th> |
---|
2102 | </tr> |
---|
2103 | <tr> |
---|
2104 | <td class="tabxpl">Setting up a integer linear program {<b><font face="Tahoma">min |
---|
2105 | c<sup>T</sup>x subject to Ax</font>≤<font face="Tahoma">b</font></b>} |
---|
2106 | can be done as<table cellpadding="10" width="100%"> |
---|
2107 | <tr> |
---|
2108 | <td class="xmpcode"> |
---|
2109 | <pre>x = intvar(n,1); |
---|
2110 | solvesdp(set(A*x<b),c'*x)</pre> |
---|
2111 | </td> |
---|
2112 | </tr> |
---|
2113 | </table> |
---|
2114 | <p>or </p> |
---|
2115 | <table cellpadding="10" width="100%"> |
---|
2116 | <tr> |
---|
2117 | <td class="xmpcode"> |
---|
2118 | <pre> </pre> |
---|
2119 | <pre>x = sdpvar(n,1); |
---|
2120 | solvesdp(set(A*x<b)+set(integer(x),c'*x)</pre> |
---|
2121 | </td> |
---|
2122 | </tr> |
---|
2123 | </table> |
---|
2124 | <p>Note, the integrality constraint is imposed on the involved variables, |
---|
2125 | not the actual <a href="#sdpvar">sdpvar</a> object. Hence, the following |
---|
2126 | two constraints are equivalent </p> |
---|
2127 | <table cellpadding="10" width="100%"> |
---|
2128 | <tr> |
---|
2129 | <td class="xmpcode"> |
---|
2130 | <pre>F = set(integer(x)); |
---|
2131 | F = set(integer(pi+sqrt(2)*x));</pre> |
---|
2132 | </td> |
---|
2133 | </tr> |
---|
2134 | </table> |
---|
2135 | </td> |
---|
2136 | </tr> |
---|
2137 | <tr> |
---|
2138 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2139 | Related commands</th> |
---|
2140 | </tr> |
---|
2141 | <tr> |
---|
2142 | <td class="tabxpl"><a href="reference.htm#intvar">intvar</a>, |
---|
2143 | <a href="reference.htm#sdpvar">sdpvar</a>, |
---|
2144 | <a href="reference.htm#binvar">binvar</a>, <a href="#set">set</a></td> |
---|
2145 | </tr> |
---|
2146 | </table> |
---|
2147 | </td> |
---|
2148 | </tr> |
---|
2149 | </table> |
---|
2150 | <p> </p> |
---|
2151 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
2152 | <tr> |
---|
2153 | <td class="tableheader"> |
---|
2154 | <p class="tableheader"><a name="intvar">INTVAR</a></p> |
---|
2155 | </td> |
---|
2156 | </tr> |
---|
2157 | <tr> |
---|
2158 | <td> |
---|
2159 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
2160 | <tr> |
---|
2161 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2162 | Syntax </th> |
---|
2163 | <td class="code" valign="top" nowrap width="100%"><code>x = intvar(n,m,'field','type')</code></td> |
---|
2164 | </tr> |
---|
2165 | <tr> |
---|
2166 | <td class="tabxpl"> |
---|
2167 | <table border="0"> |
---|
2168 | <tr> |
---|
2169 | <td> |
---|
2170 | <p align="right"><font face="Courier New" size="2">n:</font></p> |
---|
2171 | </td> |
---|
2172 | <td>Height</td> |
---|
2173 | </tr> |
---|
2174 | <tr> |
---|
2175 | <td> |
---|
2176 | <p align="right"><font face="Courier New" size="2">m:</font></p> |
---|
2177 | </td> |
---|
2178 | <td>Width</td> |
---|
2179 | </tr> |
---|
2180 | <tr> |
---|
2181 | <td> |
---|
2182 | <p align="right"><font face="Courier New" size="2">'field':</font></p> |
---|
2183 | </td> |
---|
2184 | <td>char {'real','complex'}</td> |
---|
2185 | </tr> |
---|
2186 | <tr> |
---|
2187 | <td> |
---|
2188 | <p align="right"><font face="Courier New" size="2">'type':</font></p> |
---|
2189 | </td> |
---|
2190 | <td>char {'symmetric','full','hermitian','toeplitz','hankel','skew'}</td> |
---|
2191 | </tr> |
---|
2192 | </table> |
---|
2193 | </td> |
---|
2194 | </tr> |
---|
2195 | <tr> |
---|
2196 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2197 | Description</th> |
---|
2198 | </tr> |
---|
2199 | <tr> |
---|
2200 | <td class="tabxpl">intvar is used to define symbolic decision variables |
---|
2201 | with integer elements.</td> |
---|
2202 | </tr> |
---|
2203 | <tr> |
---|
2204 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2205 | Examples</th> |
---|
2206 | </tr> |
---|
2207 | <tr> |
---|
2208 | <td class="tabxpl">A scalar integer variable is defined with<table cellpadding="10" width="100%"> |
---|
2209 | <tr> |
---|
2210 | <td class="xmpcode"> |
---|
2211 | <pre>P = intvar(1,1)</pre> |
---|
2212 | </td> |
---|
2213 | </tr> |
---|
2214 | </table> |
---|
2215 | <p>For more examples, see <a href="reference.htm#sdpvar">sdpvar</a>.</p> |
---|
2216 | </td> |
---|
2217 | </tr> |
---|
2218 | <tr> |
---|
2219 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2220 | Related commands</th> |
---|
2221 | </tr> |
---|
2222 | <tr> |
---|
2223 | <td class="tabxpl"><a href="reference.htm#binvar">binvar</a>, |
---|
2224 | <a href="reference.htm#sdpvar">sdpvar</a>, |
---|
2225 | <a href="reference.htm#integer">integer</a>, |
---|
2226 | <a href="reference.htm#binary">binary</a>, <a href="#set">set</a></td> |
---|
2227 | </tr> |
---|
2228 | </table> |
---|
2229 | </td> |
---|
2230 | </tr> |
---|
2231 | </table> |
---|
2232 | <p> </p> |
---|
2233 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
2234 | <tr> |
---|
2235 | <td class="tableheader"> |
---|
2236 | <p class="tableheader"><a name="is">IS</a></p> |
---|
2237 | </td> |
---|
2238 | </tr> |
---|
2239 | <tr> |
---|
2240 | <td> |
---|
2241 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
2242 | <tr> |
---|
2243 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2244 | Syntax</th> |
---|
2245 | <td class="code" valign="top" nowrap width="100%"><code>y = is(x,'property')</code></td> |
---|
2246 | </tr> |
---|
2247 | <tr> |
---|
2248 | <td class="tabxpl"> |
---|
2249 | <table border="0"> |
---|
2250 | <tr> |
---|
2251 | <td> |
---|
2252 | <p align="right"><font face="Courier New" size="2">y:</font></p> |
---|
2253 | </td> |
---|
2254 | <td>logical</td> |
---|
2255 | </tr> |
---|
2256 | <tr> |
---|
2257 | <td> |
---|
2258 | <p align="right"><font face="Courier New" size="2">x:</font></p> |
---|
2259 | </td> |
---|
2260 | <td>sdpvar or set object </td> |
---|
2261 | </tr> |
---|
2262 | <tr> |
---|
2263 | <td> |
---|
2264 | <p align="right"><font face="Courier New">property</font><font face="Courier New" size="2">:</font></p> |
---|
2265 | </td> |
---|
2266 | <td>char {'real', 'symmetric', 'hermitian', 'scalar', 'linear', |
---|
2267 | 'homogeneous', 'integer', 'binary'} for sdpvar objects, |
---|
2268 | {'elementwise', 'socc','lmi', 'linear', 'kyp'} on set objects</td> |
---|
2269 | </tr> |
---|
2270 | </table> |
---|
2271 | </td> |
---|
2272 | </tr> |
---|
2273 | <tr> |
---|
2274 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2275 | Description</th> |
---|
2276 | </tr> |
---|
2277 | <tr> |
---|
2278 | <td class="tabxpl">is is used to check properties of sdpvar and set |
---|
2279 | objects.</td> |
---|
2280 | </tr> |
---|
2281 | <tr> |
---|
2282 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2283 | Examples</th> |
---|
2284 | </tr> |
---|
2285 | <tr> |
---|
2286 | <td class="tabxpl">Checking if an <a href="reference.htm#sdpvar">sdpvar</a> |
---|
2287 | object is linear can be done with is<table cellpadding="10" width="100%"> |
---|
2288 | <tr> |
---|
2289 | <td class="xmpcode"> |
---|
2290 | <pre>x = sdpvar(1,1); |
---|
2291 | y = [x;x*x]; |
---|
2292 | is(y,'linear') |
---|
2293 | <font color="#000000">ans = |
---|
2294 | 0</font></pre> |
---|
2295 | </td> |
---|
2296 | </tr> |
---|
2297 | </table> |
---|
2298 | <p>The command works almost in the same way on <a href="#set">set |
---|
2299 | </a>objects, with the difference that the check is performed on every |
---|
2300 | constraint in the <a href="reference.htm#set">set</a> object separately, |
---|
2301 | so the output can be a vector </p> |
---|
2302 | <table cellpadding="10" width="100%"> |
---|
2303 | <tr> |
---|
2304 | <td class="xmpcode"> |
---|
2305 | <pre>x = sdpvar(1,1); |
---|
2306 | F = set(x>1) + set([1 x;x 1]>0) + set(x<3); |
---|
2307 | is(F,'elementwise') |
---|
2308 | <font color="#000000">ans =</font></pre> |
---|
2309 | <pre><font color="#000000"> 1 |
---|
2310 | 0 |
---|
2311 | 1</font></pre> |
---|
2312 | </td> |
---|
2313 | </tr> |
---|
2314 | </table> |
---|
2315 | <p>Hence, creating a <a href="#set">set</a> object containing only |
---|
2316 | the element-wise constraints is done with </p> |
---|
2317 | <table cellpadding="10" width="100%"> |
---|
2318 | <tr> |
---|
2319 | <td class="xmpcode"> |
---|
2320 | <pre>F_element = F(is(F,'elementwise'));</pre> |
---|
2321 | </td> |
---|
2322 | </tr> |
---|
2323 | </table> |
---|
2324 | </td> |
---|
2325 | </tr> |
---|
2326 | <tr> |
---|
2327 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2328 | Related commands</th> |
---|
2329 | </tr> |
---|
2330 | <tr> |
---|
2331 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a>, |
---|
2332 | <a href="#set">set</a></td> |
---|
2333 | </tr> |
---|
2334 | </table> |
---|
2335 | </td> |
---|
2336 | </tr> |
---|
2337 | </table> |
---|
2338 | <p> </p> |
---|
2339 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table112"> |
---|
2340 | <tr> |
---|
2341 | <td class="tableheader"> |
---|
2342 | <p class="tableheader"><a name="ismember">ISMEMBER</font></a></p> |
---|
2343 | </td> |
---|
2344 | </tr> |
---|
2345 | <tr> |
---|
2346 | <td> |
---|
2347 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table113"> |
---|
2348 | <tr> |
---|
2349 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2350 | Syntax</th> |
---|
2351 | <td class="code" valign="top" nowrap width="100%"><code>F = |
---|
2352 | ismember(x,Y)</code></td> |
---|
2353 | </tr> |
---|
2354 | <tr> |
---|
2355 | <td class="tabxpl"> |
---|
2356 | <table border="0" id="table114"> |
---|
2357 | <tr> |
---|
2358 | <td> |
---|
2359 | <p align="right"><font face="Courier New">F</font><font face="Courier New" size="2">:</font></p> |
---|
2360 | </td> |
---|
2361 | <td>set object</td> |
---|
2362 | </tr> |
---|
2363 | <tr> |
---|
2364 | <td> |
---|
2365 | <p align="right"><font face="Courier New" size="2">x:</font></p> |
---|
2366 | </td> |
---|
2367 | <td>sdpvar object</td> |
---|
2368 | </tr> |
---|
2369 | <tr> |
---|
2370 | <td> |
---|
2371 | <p align="right"><font face="Courier New" size="2">Y:</font></p> |
---|
2372 | </td> |
---|
2373 | <td>vector of doubles or polytope array</td> |
---|
2374 | </tr> |
---|
2375 | </table> |
---|
2376 | </td> |
---|
2377 | </tr> |
---|
2378 | <tr> |
---|
2379 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2380 | Description</th> |
---|
2381 | </tr> |
---|
2382 | <tr> |
---|
2383 | <td class="tabxpl" height="26"><a href="#ismember">ismember</a> is used to constrain an sdpvar object to be part |
---|
2384 | of a set of doubles or polytopes</td> |
---|
2385 | </tr> |
---|
2386 | <tr> |
---|
2387 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2388 | Examples</th> |
---|
2389 | </tr> |
---|
2390 | <tr> |
---|
2391 | <td class="tabxpl">To constrain a scalar variable to take a value |
---|
2392 | from a finite set, <a href="#ismember">ismember</a> can be used.<table cellpadding="10" width="100%" id="table115"> |
---|
2393 | <tr> |
---|
2394 | <td class="xmpcode"> |
---|
2395 | <pre>sdpvar x |
---|
2396 | F = set(ismember(x,[1 2 3 4]));</pre> |
---|
2397 | </td> |
---|
2398 | </tr> |
---|
2399 | </table> |
---|
2400 | <p>Of course, this can also be obtained with a standard integer |
---|
2401 | variable.</p><table cellpadding="10" width="100%" id="table116"> |
---|
2402 | <tr> |
---|
2403 | <td class="xmpcode"> |
---|
2404 | <pre>intvar x |
---|
2405 | F = set(1 <= x <=4);</pre> |
---|
2406 | </td> |
---|
2407 | </tr> |
---|
2408 | </table> |
---|
2409 | <p>or an integrality constraint</p> |
---|
2410 | <table cellpadding="10" width="100%" id="table117"> |
---|
2411 | <tr> |
---|
2412 | <td class="xmpcode"> |
---|
2413 | <pre>sdpvar x |
---|
2414 | F = set(integer(x)) + set(1 <= x <= 4);</pre> |
---|
2415 | </td> |
---|
2416 | </tr> |
---|
2417 | </table> |
---|
2418 | <p>The functionality is more useful when the set is more |
---|
2419 | complicated.</p> |
---|
2420 | <table cellpadding="10" width="100%" id="table121"> |
---|
2421 | <tr> |
---|
2422 | <td class="xmpcode"> |
---|
2423 | <pre>sdpvar x |
---|
2424 | F = set(ismember(x,[1 pi 12 -8]));</pre> |
---|
2425 | </td> |
---|
2426 | </tr> |
---|
2427 | </table> |
---|
2428 | <p>The function <a href="#ismember">ismember</a> can also be used together with the |
---|
2429 | polytope object in <a href="solvers.htm#mpt">MPT</a> to constrain a variable to be inside |
---|
2430 | at least one |
---|
2431 | of several polytopes.</p> |
---|
2432 | <table cellpadding="10" width="100%" id="table122"> |
---|
2433 | <tr> |
---|
2434 | <td class="xmpcode"> |
---|
2435 | <pre>x = sdpvar(3,1); |
---|
2436 | P1 = polytope(randn(10,3),rand(10,1)); |
---|
2437 | P2 = polytope(randn(10,3),rand(10,1)); |
---|
2438 | F = set(ismember(x,[P1 P2]));</pre> |
---|
2439 | </td> |
---|
2440 | </tr> |
---|
2441 | </table> |
---|
2442 | <p>Note that <a href="#ismember">ismember</a> will introduce binary variables if the |
---|
2443 | cardinality of the set <b>Y</b> is larger than 1</td> |
---|
2444 | </tr> |
---|
2445 | <tr> |
---|
2446 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2447 | Related commands</th> |
---|
2448 | </tr> |
---|
2449 | <tr> |
---|
2450 | <td class="tabxpl"><a href="reference.htm#set">set</a></td> |
---|
2451 | </tr> |
---|
2452 | </table> |
---|
2453 | |
---|
2454 | </td> |
---|
2455 | </tr> |
---|
2456 | </table> |
---|
2457 | <p> </p> |
---|
2458 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
2459 | <tr> |
---|
2460 | <td class="tableheader"> |
---|
2461 | <p class="tableheader"><a name="jacobian">JACOBIAN</a></p> |
---|
2462 | </td> |
---|
2463 | </tr> |
---|
2464 | <tr> |
---|
2465 | <td> |
---|
2466 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
2467 | <tr> |
---|
2468 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2469 | Syntax</th> |
---|
2470 | <td class="code" valign="top" nowrap width="100%"><code>J = jacobian(f,x)</code></td> |
---|
2471 | </tr> |
---|
2472 | <tr> |
---|
2473 | <td class="tabxpl"> |
---|
2474 | <table border="0"> |
---|
2475 | <tr> |
---|
2476 | <td> |
---|
2477 | <p align="right"><font face="Courier New" size="2">J:</font></p> |
---|
2478 | </td> |
---|
2479 | <td>sdpvar object</td> |
---|
2480 | </tr> |
---|
2481 | <tr> |
---|
2482 | <td> |
---|
2483 | <p align="right"><font face="Courier New" size="2">f:</font></p> |
---|
2484 | </td> |
---|
2485 | <td>sdpvar object </td> |
---|
2486 | </tr> |
---|
2487 | <tr> |
---|
2488 | <td> |
---|
2489 | <p align="right"><font face="Courier New" size="2">x:</font></p> |
---|
2490 | </td> |
---|
2491 | <td>sdpvar object</td> |
---|
2492 | </tr> |
---|
2493 | </table> |
---|
2494 | </td> |
---|
2495 | </tr> |
---|
2496 | <tr> |
---|
2497 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2498 | Description</th> |
---|
2499 | </tr> |
---|
2500 | <tr> |
---|
2501 | <td class="tabxpl">jacobian calculates the Jacobian df/dx.</td> |
---|
2502 | </tr> |
---|
2503 | <tr> |
---|
2504 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2505 | Examples</th> |
---|
2506 | </tr> |
---|
2507 | <tr> |
---|
2508 | <td class="tabxpl">With only 1 argument, the differentiation is performed |
---|
2509 | with respect to all involved variables (more precisely, with respect |
---|
2510 | to the variables <a href="reference.htm#recover">recover</a>(<a href="reference.htm#depends">depends</a>(f)))<table cellpadding="10" width="100%"> |
---|
2511 | <tr> |
---|
2512 | <td class="xmpcode"> |
---|
2513 | <pre>x1 = sdpvar(1,1); |
---|
2514 | x2 = sdpvar(1,1); |
---|
2515 | f = x1^2+5*x2^2; |
---|
2516 | sdisplay(jacobian(f))</pre> |
---|
2517 | <pre><font color="#000000">ans = </font></pre> |
---|
2518 | <pre><font color="#000000"> '2x1' '10x2'</font></pre> |
---|
2519 | </td> |
---|
2520 | </tr> |
---|
2521 | </table> |
---|
2522 | <p>Giving a second argument controls what variables to differentiate |
---|
2523 | with respect to </p> |
---|
2524 | <table cellpadding="10" width="100%"> |
---|
2525 | <tr> |
---|
2526 | <td class="xmpcode"> |
---|
2527 | <pre>sdisplay(jacobian(f,x2)) |
---|
2528 | <font color="#000000">ans = </font></pre> |
---|
2529 | <pre><font color="#000000"> '10x2'</font></pre> |
---|
2530 | </td> |
---|
2531 | </tr> |
---|
2532 | </table> |
---|
2533 | </td> |
---|
2534 | </tr> |
---|
2535 | <tr> |
---|
2536 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2537 | Related commands</th> |
---|
2538 | </tr> |
---|
2539 | <tr> |
---|
2540 | <td class="tabxpl"><a href="reference.htm#hessian">hessian</a>, |
---|
2541 | <a href="reference.htm#sdisplay">sdisplay</a>, |
---|
2542 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
2543 | </tr> |
---|
2544 | </table> |
---|
2545 | </td> |
---|
2546 | </tr> |
---|
2547 | </table> |
---|
2548 | <p> </p> |
---|
2549 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
2550 | <tr> |
---|
2551 | <td class="tableheader"> |
---|
2552 | <p class="tableheader"><a name="kyp">KYP</a></p> |
---|
2553 | </td> |
---|
2554 | </tr> |
---|
2555 | <tr> |
---|
2556 | <td> |
---|
2557 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
2558 | <tr> |
---|
2559 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2560 | Syntax</th> |
---|
2561 | <td class="code" valign="top" nowrap width="100%"><code>x = kyp(A,B,P,M)</code></td> |
---|
2562 | </tr> |
---|
2563 | <tr> |
---|
2564 | <td class="tabxpl"> |
---|
2565 | <table border="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0"> |
---|
2566 | <tr> |
---|
2567 | <td> |
---|
2568 | <p align="right"><font face="Courier New" size="2">x:</font></p> |
---|
2569 | </td> |
---|
2570 | <td>sdpvar object (only useful in set)</td> |
---|
2571 | </tr> |
---|
2572 | <tr> |
---|
2573 | <td> |
---|
2574 | <p align="right"><font face="Courier New" size="2">A:</font></p> |
---|
2575 | </td> |
---|
2576 | <td>double (square matrix)</td> |
---|
2577 | </tr> |
---|
2578 | <tr> |
---|
2579 | <td> |
---|
2580 | <p align="right"><font face="Courier New" size="2">B:</font></p> |
---|
2581 | </td> |
---|
2582 | <td>double</td> |
---|
2583 | </tr> |
---|
2584 | <tr> |
---|
2585 | <td> |
---|
2586 | <p align="right"><font face="Courier New" size="2">P:</font></p> |
---|
2587 | </td> |
---|
2588 | <td>sdpvar object (symmetric)</td> |
---|
2589 | </tr> |
---|
2590 | <tr> |
---|
2591 | <td> |
---|
2592 | <p align="right"><font face="Courier New" size="2">M:</font></p> |
---|
2593 | </td> |
---|
2594 | <td>sdpvar object (symmetric)</td> |
---|
2595 | </tr> |
---|
2596 | </table> |
---|
2597 | </td> |
---|
2598 | </tr> |
---|
2599 | <tr> |
---|
2600 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2601 | Description</th> |
---|
2602 | </tr> |
---|
2603 | <tr> |
---|
2604 | <td class="tabxpl">kyp is used to define LMIs related to the KYP-lemma |
---|
2605 | and Lyapunov equations</td> |
---|
2606 | </tr> |
---|
2607 | <tr> |
---|
2608 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2609 | Examples</th> |
---|
2610 | </tr> |
---|
2611 | <tr> |
---|
2612 | <td class="tabxpl">Defining the Lyapunov constraint <b> |
---|
2613 | <font face="Tahoma">A<sup>T</sup>P+PA<0</font></b> can be done using |
---|
2614 | <a href="reference.htm#kyp">kyp</a><table cellpadding="10" width="100%"> |
---|
2615 | <tr> |
---|
2616 | <td class="xmpcode"> |
---|
2617 | <pre>F = set(kyp(A,[],P) < 0)</pre> |
---|
2618 | </td> |
---|
2619 | </tr> |
---|
2620 | </table> |
---|
2621 | <p>Tthe following command is equivalent </p> |
---|
2622 | <table cellpadding="10" width="100%"> |
---|
2623 | <tr> |
---|
2624 | <td class="xmpcode"> |
---|
2625 | <pre>F = set(A'*P+P*A < 0)</pre> |
---|
2626 | </td> |
---|
2627 | </tr> |
---|
2628 | </table> |
---|
2629 | <p>but the difference is that YALMIP does not know that the constraint |
---|
2630 | is a Lyapunov equation, hence it will not be able to use the dedicated |
---|
2631 | solver <a href="solvers.htm#kypd">KYPD</a>.<br /> |
---|
2632 | <br /> |
---|
2633 | <a href="reference.htm#kyp">kyp </a>can also be used to define more |
---|
2634 | complex constraints. The following two commands generate the constraint |
---|
2635 | <b><font face="Tahoma">[A<sup>T</sup>P+PA PB;B<sup>T</sup>P 0] + M(x) |
---|
2636 | < 0 </font></b>(<b>P</b> and <b>x</b> are decision variables). </p> |
---|
2637 | <table cellpadding="10" width="100%"> |
---|
2638 | <tr> |
---|
2639 | <td class="xmpcode"> |
---|
2640 | <pre>F = set([A'*P+P*A P*B;B'*P zeros(size(B,2))]+M < 0); |
---|
2641 | F = set(kyp(A,B,P,M) < 0);</pre> |
---|
2642 | </td> |
---|
2643 | </tr> |
---|
2644 | </table> |
---|
2645 | <p>The dedicated solver <a href="solvers.htm#kypd">KYPD</a> can only |
---|
2646 | be used if the variable <b>P</b> is symmetric matrix, obtained directly |
---|
2647 | from <font color="#0000ff"><a href="reference.htm#sdpvar">sdpvar</a></font>, |
---|
2648 | used only in 1 constraint. This means that you cannot use |
---|
2649 | <a href="solvers.htm#kypd">KYPD</a> if you want to impose explicit |
---|
2650 | constraints (including positive definiteness) on <b>P</b>. However, |
---|
2651 | positive definiteness of <b>P </b>is in some cases implied by the |
---|
2652 | KYP constraint</p> |
---|
2653 | </td> |
---|
2654 | </tr> |
---|
2655 | <tr> |
---|
2656 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2657 | Related commands</th> |
---|
2658 | </tr> |
---|
2659 | <tr> |
---|
2660 | <td class="tabxpl"><font color="#0000ff"> |
---|
2661 | <a href="reference.htm#sdpvar">sdpvar</a>, |
---|
2662 | <a href="reference.htm#set">set</a></font></td> |
---|
2663 | </tr> |
---|
2664 | </table> |
---|
2665 | </td> |
---|
2666 | </tr> |
---|
2667 | </table> |
---|
2668 | <p> </p> |
---|
2669 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
2670 | <tr> |
---|
2671 | <td class="tableheader"> |
---|
2672 | <p class="tableheader"><a name="linearize">LINEARIZE</a></p> |
---|
2673 | </td> |
---|
2674 | </tr> |
---|
2675 | <tr> |
---|
2676 | <td> |
---|
2677 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
2678 | <tr> |
---|
2679 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2680 | Syntax</th> |
---|
2681 | <td class="code" valign="top" nowrap width="100%"><code>h = linearize(p)</code></td> |
---|
2682 | </tr> |
---|
2683 | <tr> |
---|
2684 | <td class="tabxpl"> |
---|
2685 | <table border="0"> |
---|
2686 | <tr> |
---|
2687 | <td> |
---|
2688 | <p align="right"><font face="Courier New" size="2">h:</font></p> |
---|
2689 | </td> |
---|
2690 | <td>sdpvar object </td> |
---|
2691 | </tr> |
---|
2692 | <tr> |
---|
2693 | <td> |
---|
2694 | <p align="right"><font face="Courier New" size="2">p:</font></p> |
---|
2695 | </td> |
---|
2696 | <td>sdpvar object</td> |
---|
2697 | </tr> |
---|
2698 | </table> |
---|
2699 | </td> |
---|
2700 | </tr> |
---|
2701 | <tr> |
---|
2702 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2703 | Description</th> |
---|
2704 | </tr> |
---|
2705 | <tr> |
---|
2706 | <td class="tabxpl">Returns linearization p(double(x)) + dp(double(x))*(x-double(x)) |
---|
2707 | where x is the <a href="reference.htm#sdpvar">sdpvar</a> variables |
---|
2708 | defining the polynomial p(x).</td> |
---|
2709 | </tr> |
---|
2710 | <tr> |
---|
2711 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2712 | Examples</th> |
---|
2713 | </tr> |
---|
2714 | <tr> |
---|
2715 | <td class="tabxpl">The linearization is performed at the current value |
---|
2716 | of <a href="reference.htm#double">double</a>(x)<table cellpadding="10" width="100%"> |
---|
2717 | <tr> |
---|
2718 | <td class="xmpcode"> |
---|
2719 | <pre>x = sdpvar(1,1); |
---|
2720 | f = x^2; |
---|
2721 | assign(x,1); |
---|
2722 | sdisplay(linearize(f)) |
---|
2723 | <font color="#000000">ans = </font></pre> |
---|
2724 | <pre><font color="#000000"> '-1+2x'</font> |
---|
2725 | |
---|
2726 | assign(x,3); |
---|
2727 | sdisplay(linearize(f)) |
---|
2728 | <font color="#000000">ans = </font></pre> |
---|
2729 | <pre><font color="#000000"> '-9+6x'</font></pre> |
---|
2730 | </td> |
---|
2731 | </tr> |
---|
2732 | </table> |
---|
2733 | <p>The command of-course applies to matrices as well </p> |
---|
2734 | <table cellpadding="10" width="100%"> |
---|
2735 | <tr> |
---|
2736 | <td class="xmpcode"> |
---|
2737 | <pre>p11 = sdpvar(1,1);p12 = sdpvar(1,1);p22 = sdpvar(1,1); |
---|
2738 | P = [p11 p12;p12 p22]; |
---|
2739 | assign(P,[3 2;2 5])</pre> |
---|
2740 | <pre>sdisplay(linearize(P*P))<font color="#000000"> |
---|
2741 | ans = </font></pre> |
---|
2742 | <pre><font color="#000000"> '-13+6p11+4p12' '-16+2p11+8p12+2p22' |
---|
2743 | '-16+2p11+8p12+2p22' '-29+4p12+10p22' </font> </pre> |
---|
2744 | </td> |
---|
2745 | </tr> |
---|
2746 | </table> |
---|
2747 | </td> |
---|
2748 | </tr> |
---|
2749 | <tr> |
---|
2750 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2751 | Related commands</th> |
---|
2752 | </tr> |
---|
2753 | <tr> |
---|
2754 | <td class="tabxpl"><a href="reference.htm#jacobian">jacobian</a>, |
---|
2755 | <a href="reference.htm#hessian">hessian</a>, |
---|
2756 | <a href="reference.htm#sdisplay">sdisplay</a>, |
---|
2757 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
2758 | </tr> |
---|
2759 | </table> |
---|
2760 | </td> |
---|
2761 | </tr> |
---|
2762 | </table> |
---|
2763 | <p> </p> |
---|
2764 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
2765 | <tr> |
---|
2766 | <td class="tableheader"> |
---|
2767 | <p class="tableheader"><a name="logdet">LOGDET</a></p> |
---|
2768 | </td> |
---|
2769 | </tr> |
---|
2770 | <tr> |
---|
2771 | <td> |
---|
2772 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
2773 | <tr> |
---|
2774 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2775 | Syntax</th> |
---|
2776 | <td class="code" valign="top" nowrap width="100%"><code>p = logdet(x)</code></td> |
---|
2777 | </tr> |
---|
2778 | <tr> |
---|
2779 | <td class="tabxpl"> |
---|
2780 | <table border="0"> |
---|
2781 | <tr> |
---|
2782 | <td> |
---|
2783 | <p align="right"><font face="Courier New" size="2">p:</font></p> |
---|
2784 | </td> |
---|
2785 | <td>sdpvar object (only useful in |
---|
2786 | <a href="reference.htm#logdet">solvesdp</a>)</td> |
---|
2787 | </tr> |
---|
2788 | <tr> |
---|
2789 | <td> |
---|
2790 | <p align="right"><font face="Courier New" size="2">x:</font></p> |
---|
2791 | </td> |
---|
2792 | <td>sdpvar object</td> |
---|
2793 | </tr> |
---|
2794 | </table> |
---|
2795 | </td> |
---|
2796 | </tr> |
---|
2797 | <tr> |
---|
2798 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2799 | Description</th> |
---|
2800 | </tr> |
---|
2801 | <tr> |
---|
2802 | <td class="tabxpl">logdet is used to define objective functions in |
---|
2803 | MAXDET problems. This command will likely become obsolete in a |
---|
2804 | future version.</td> |
---|
2805 | </tr> |
---|
2806 | <tr> |
---|
2807 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2808 | Examples</th> |
---|
2809 | </tr> |
---|
2810 | <tr> |
---|
2811 | <td class="tabxpl">See <a href="ellipsoidal.htm">MAXDET example</a>.</td> |
---|
2812 | </tr> |
---|
2813 | <tr> |
---|
2814 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2815 | Related commands</th> |
---|
2816 | </tr> |
---|
2817 | <tr> |
---|
2818 | <td class="tabxpl"><a href="reference.htm#solvesdp">solvesdp</a>, |
---|
2819 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
2820 | </tr> |
---|
2821 | </table> |
---|
2822 | </td> |
---|
2823 | </tr> |
---|
2824 | </table> |
---|
2825 | <p> </p> |
---|
2826 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
2827 | <tr> |
---|
2828 | <td class="tableheader"> |
---|
2829 | <p class="tableheader"><a name="lowrank">LOWRANK</a></p> |
---|
2830 | </td> |
---|
2831 | </tr> |
---|
2832 | <tr> |
---|
2833 | <td> |
---|
2834 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
2835 | <tr> |
---|
2836 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2837 | Syntax</th> |
---|
2838 | <td class="code" valign="top" nowrap width="100%"><code>H = lowrank(F,x)</code></td> |
---|
2839 | </tr> |
---|
2840 | <tr> |
---|
2841 | <td class="tabxpl"> |
---|
2842 | <table border="0"> |
---|
2843 | <tr> |
---|
2844 | <td> |
---|
2845 | <p align="right"><font face="Courier New">H</font><font face="Courier New" size="2">:</font></p> |
---|
2846 | </td> |
---|
2847 | <td>set object (only useful in |
---|
2848 | <a href="reference.htm#logdet">solvesdp</a>)</td> |
---|
2849 | </tr> |
---|
2850 | <tr> |
---|
2851 | <td> |
---|
2852 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
2853 | </td> |
---|
2854 | <td>sdpvar object</td> |
---|
2855 | </tr> |
---|
2856 | <tr> |
---|
2857 | <td> |
---|
2858 | <font face="Courier New">x:</font></td> |
---|
2859 | <td>sdpvar object</td> |
---|
2860 | </tr> |
---|
2861 | </table> |
---|
2862 | </td> |
---|
2863 | </tr> |
---|
2864 | <tr> |
---|
2865 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2866 | Description</th> |
---|
2867 | </tr> |
---|
2868 | <tr> |
---|
2869 | <td class="tabxpl">lowrank is used to declare that a semidefinite |
---|
2870 | constraint uses <b>data</b> with low rank.</td> |
---|
2871 | </tr> |
---|
2872 | <tr> |
---|
2873 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2874 | Examples</th> |
---|
2875 | </tr> |
---|
2876 | <tr> |
---|
2877 | <td class="tabxpl"><p>Define a semidefinite constraint |
---|
2878 | with low-rank data matrices (both variables in <b>x</b> enter the |
---|
2879 | constraint via rank-2 matrices)</p> |
---|
2880 | <table cellpadding="10" width="100%"> |
---|
2881 | <tr> |
---|
2882 | <td class="xmpcode"> |
---|
2883 | <pre>x = sdpvar(2,1); |
---|
2884 | C = randn(10,10);C = C*C'; |
---|
2885 | R = randn(10,2); |
---|
2886 | F = set(C-R*diag(x)*R' > 0);</pre> |
---|
2887 | </td> |
---|
2888 | </tr> |
---|
2889 | </table> |
---|
2890 | <p>If a low-rank data exploiting solver is available (currently |
---|
2891 | only<a target="_blank" href="http://dollar.biz.uiowa.edu/~burer/software/SDPLR/"> |
---|
2892 | SDPLR</a>), we can ask YALMIP to extract low-rank |
---|
2893 | information and pass this to the solver. </p> |
---|
2894 | <table cellpadding="10" width="100%"> |
---|
2895 | <tr> |
---|
2896 | <td class="xmpcode"> |
---|
2897 | <pre>solvesdp(F + lowrank(F),-sum(x),sdpsettings('solver','sdplr'));</pre> |
---|
2898 | </td> |
---|
2899 | </tr> |
---|
2900 | </table> |
---|
2901 | <p>In some cases, the low-rank structure is only with respect to |
---|
2902 | some variables, as here where <b>y</b> enters via a full rank matrix. |
---|
2903 | In this cases, it might be counter productive to try to exploit |
---|
2904 | the (non-existing) low rank.</p> |
---|
2905 | <table cellpadding="10" width="100%"> |
---|
2906 | <tr> |
---|
2907 | <td class="xmpcode"> |
---|
2908 | <pre>x = sdpvar(2,1); |
---|
2909 | y = sdpvar(1,1); |
---|
2910 | C = randn(10,10);C = C*C'; |
---|
2911 | R = randn(10,2); |
---|
2912 | S = randn(10,10);S = S+S'; |
---|
2913 | F = set(C-R*diag(x)*R'-y*S > 0);</pre> |
---|
2914 | </td> |
---|
2915 | </tr> |
---|
2916 | </table> |
---|
2917 | <p>In this case, it is possible to tell YALMIP which variables |
---|
2918 | enter in a low-rank fashion, here <b>x</b>.<p> |
---|
2919 | </p><table cellpadding="10" width="100%"> |
---|
2920 | <tr> |
---|
2921 | <td class="xmpcode"> |
---|
2922 | <pre>solvesdp(F+lowrank(F,x),-sum(x)-y,sdpsettings('solver','sdplr'));</pre> |
---|
2923 | </td> |
---|
2924 | </tr> |
---|
2925 | </table> |
---|
2926 | <p>An alternative way to work with low rank data matrices is to |
---|
2927 | use the option sdpsettings('sdprl.maxrank'). By changing this |
---|
2928 | setting from it default value of 0, YALMIP will automatically |
---|
2929 | check all data matrices for low rank structure, and send low rank |
---|
2930 | data to the solver if the rank is less than the value of |
---|
2931 | sdpsettings('sdprl.maxrank'). Hence, YALMIP will exploit low rank |
---|
2932 | w.r.t <b>x</b> but not <b>y</b> in the following solution. </p> |
---|
2933 | <table cellpadding="10" width="100%"> |
---|
2934 | <tr> |
---|
2935 | <td class="xmpcode"> |
---|
2936 | <pre>solvesdp(F,-sum(x)-y,sdpsettings('solver','sdplr','sdplr.maxrank',2));</pre> |
---|
2937 | </td> |
---|
2938 | </tr> |
---|
2939 | </table> |
---|
2940 | </td> |
---|
2941 | </tr> |
---|
2942 | <tr> |
---|
2943 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2944 | Related commandss</th> |
---|
2945 | </tr> |
---|
2946 | <tr> |
---|
2947 | <td class="tabxpl"><a href="reference.htm#solvesdp">solvesdp</a></td> |
---|
2948 | </tr> |
---|
2949 | </table> |
---|
2950 | </td> |
---|
2951 | </tr> |
---|
2952 | </table> |
---|
2953 | <p> </p> |
---|
2954 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table10"> |
---|
2955 | <tr> |
---|
2956 | <td class="tableheader"> |
---|
2957 | <p class="tableheader"><a name="monolist">MONOLIST</a></p> |
---|
2958 | </td> |
---|
2959 | </tr> |
---|
2960 | <tr> |
---|
2961 | <td> |
---|
2962 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table11"> |
---|
2963 | <tr> |
---|
2964 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2965 | Syntax </th> |
---|
2966 | <td class="code" valign="top" nowrap width="100%"><code>v = |
---|
2967 | monolist(x,d)</code></td> |
---|
2968 | </tr> |
---|
2969 | <tr> |
---|
2970 | <td class="tabxpl"> |
---|
2971 | <table border="0" id="table12"> |
---|
2972 | <tr> |
---|
2973 | <td> |
---|
2974 | <p align="right"><font face="Courier New">x</font><font face="Courier New" size="2">:</font></p> |
---|
2975 | </td> |
---|
2976 | <td>sdpvar object </td> |
---|
2977 | </tr> |
---|
2978 | <tr> |
---|
2979 | <td> |
---|
2980 | <p align="right"><font face="Courier New">d</font><font face="Courier New" size="2">:</font></p> |
---|
2981 | </td> |
---|
2982 | <td>Maximum degrees</td> |
---|
2983 | </tr> |
---|
2984 | </table> |
---|
2985 | </td> |
---|
2986 | </tr> |
---|
2987 | <tr> |
---|
2988 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2989 | Description</th> |
---|
2990 | </tr> |
---|
2991 | <tr> |
---|
2992 | <td class="tabxpl">monolist is used to generate monomials</td> |
---|
2993 | </tr> |
---|
2994 | <tr> |
---|
2995 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
2996 | Examples</th> |
---|
2997 | </tr> |
---|
2998 | <tr> |
---|
2999 | <td class="tabxpl">Create all monomials of degree less than 2<table cellpadding="10" width="100%" id="table13"> |
---|
3000 | <tr> |
---|
3001 | <td class="xmpcode"> |
---|
3002 | <pre>sdpvar x y |
---|
3003 | v = monolist([x y],2); |
---|
3004 | sdisplay(v') |
---|
3005 | |
---|
3006 | <font color="#000000">ans = </font></pre> |
---|
3007 | <pre><font color="#000000"> '1' 'x' 'y' 'x^2' 'xy' 'y^2'</font></pre> |
---|
3008 | </td> |
---|
3009 | </tr> |
---|
3010 | </table> |
---|
3011 | <p>The command support different degrees on different variables<br> |
---|
3012 | </p><table cellpadding="10" width="100%" id="table14"> |
---|
3013 | <tr> |
---|
3014 | <td class="xmpcode"> |
---|
3015 | <pre>sdpvar x y |
---|
3016 | v = monolist([x y],[2 3]); |
---|
3017 | sdisplay(v') |
---|
3018 | |
---|
3019 | <font color="#000000">ans = </font></pre> |
---|
3020 | <pre><font color="#000000"> '1' 'x' 'y' 'x^2' 'xy' 'y^2' 'x^2y' 'xy^2' 'y^3'</font></pre> |
---|
3021 | </td> |
---|
3022 | </tr> |
---|
3023 | </table> |
---|
3024 | </td> |
---|
3025 | </tr> |
---|
3026 | <tr> |
---|
3027 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3028 | Related commands</th> |
---|
3029 | </tr> |
---|
3030 | <tr> |
---|
3031 | <td class="tabxpl"><a href="reference.htm#sdisplay">sdisplay</a>, |
---|
3032 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
3033 | </tr> |
---|
3034 | </table> |
---|
3035 | </td> |
---|
3036 | </tr> |
---|
3037 | </table> |
---|
3038 | <p> </p> |
---|
3039 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
3040 | <tr> |
---|
3041 | <td class="tableheader"> |
---|
3042 | <p class="tableheader"><a name="plot">PLOT</font></a></p> |
---|
3043 | </td> |
---|
3044 | </tr> |
---|
3045 | <tr> |
---|
3046 | <td> |
---|
3047 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
3048 | <tr> |
---|
3049 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3050 | Syntax<p></p> |
---|
3051 | </th> |
---|
3052 | <td class="code" valign="top" nowrap width="100%"><code>p = plot(F,x,c,n,options)</code></td> |
---|
3053 | </tr> |
---|
3054 | <tr> |
---|
3055 | <td class="tabxpl"> |
---|
3056 | <table border="0"> |
---|
3057 | <tr> |
---|
3058 | <td> |
---|
3059 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
3060 | </td> |
---|
3061 | <td>set object</td> |
---|
3062 | </tr> |
---|
3063 | <tr> |
---|
3064 | <td> |
---|
3065 | <p align="right"><font face="Courier New">x</font><font face="Courier New" size="2">:</font></p> |
---|
3066 | </td> |
---|
3067 | <td>sdpvar variable</td> |
---|
3068 | </tr> |
---|
3069 | <tr> |
---|
3070 | <td> |
---|
3071 | <p align="right"><font face="Courier New" size="2">c:</font></p> |
---|
3072 | </td> |
---|
3073 | <td>char or double</td> |
---|
3074 | </tr> |
---|
3075 | <tr> |
---|
3076 | <td> |
---|
3077 | <p align="right"><font face="Courier New">n</font><font face="Courier New" size="2">:</font></p> |
---|
3078 | </td> |
---|
3079 | <td>double</td> |
---|
3080 | </tr> |
---|
3081 | <tr> |
---|
3082 | <td><font face="Courier New">options:</font></td> |
---|
3083 | <td>options structure from <a href="#sdpsettings">sdpsettings</a></td> |
---|
3084 | </tr> |
---|
3085 | </table> |
---|
3086 | </td> |
---|
3087 | </tr> |
---|
3088 | <tr> |
---|
3089 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3090 | Description</th> |
---|
3091 | </tr> |
---|
3092 | <tr> |
---|
3093 | <td class="tabxpl">plot is used to plot the (projection) of the feasible |
---|
3094 | set</td> |
---|
3095 | </tr> |
---|
3096 | <tr> |
---|
3097 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3098 | Examples</th> |
---|
3099 | </tr> |
---|
3100 | <tr> |
---|
3101 | <td class="tabxpl">Define a set in <b>R<sup>3</sup></b><table cellpadding="10" width="100%"> |
---|
3102 | <tr> |
---|
3103 | <td class="xmpcode"> |
---|
3104 | <pre>x = sdpvar(3,1); |
---|
3105 | |
---|
3106 | F = set([1 x(2);x(2) x(1)])+set(3 > x); |
---|
3107 | F = F + set([1 x';x eye(3)]>0) + set(sum(x)>x'*x);</pre> |
---|
3108 | </td> |
---|
3109 | </tr> |
---|
3110 | </table> |
---|
3111 | <p>Plot the feasible set, projected on <b>(x<sub>1</sub>,x<sub>3</sub>)</b></p> |
---|
3112 | <table cellpadding="10" width="100%"> |
---|
3113 | <tr> |
---|
3114 | <td class="xmpcode"> |
---|
3115 | <pre>plot(F,[x(1);x(3)])</pre> |
---|
3116 | </td> |
---|
3117 | </tr> |
---|
3118 | </table> |
---|
3119 | <p>By default, the feasible set is projected to <b>R<sup>3</sup></b> |
---|
3120 | (the three variables with lowest index in YALMIP) </p> |
---|
3121 | <table cellpadding="10" width="100%"> |
---|
3122 | <tr> |
---|
3123 | <td class="xmpcode"> |
---|
3124 | <pre>plot(F)</pre> |
---|
3125 | </td> |
---|
3126 | </tr> |
---|
3127 | </table> |
---|
3128 | <p>Why not the feasible set on <b>x<sub>1</sub>=0.5</b></p> |
---|
3129 | <table cellpadding="10" width="100%"> |
---|
3130 | <tr> |
---|
3131 | <td class="xmpcode"> |
---|
3132 | <pre>plot(replace(F,x(1),0.5))</pre> |
---|
3133 | </td> |
---|
3134 | </tr> |
---|
3135 | </table> |
---|
3136 | <p>A third argument can be used to control the color </p> |
---|
3137 | <table cellpadding="10" width="100%"> |
---|
3138 | <tr> |
---|
3139 | <td class="xmpcode"> |
---|
3140 | <pre>plot(F,[],'b')</pre> |
---|
3141 | </td> |
---|
3142 | </tr> |
---|
3143 | </table> |
---|
3144 | <p>A fourth argument can be used to control the accuracy</p> |
---|
3145 | <table cellpadding="10" width="100%"> |
---|
3146 | <tr> |
---|
3147 | <td class="xmpcode"> |
---|
3148 | <pre>plot(F,[],[],150)</pre> |
---|
3149 | </td> |
---|
3150 | </tr> |
---|
3151 | </table> |
---|
3152 | <p>The fifth argument can be used to pass an options structure for |
---|
3153 | the solver</p> |
---|
3154 | <table cellpadding="10" width="100%"> |
---|
3155 | <tr> |
---|
3156 | <td class="xmpcode"> |
---|
3157 | <pre>plot(F,[],[],[],sdpsettings('solver','sedumi','verbose',0));</pre> |
---|
3158 | </td> |
---|
3159 | </tr> |
---|
3160 | </table> |
---|
3161 | <p>To avoid strange looking plots, you should ensure that your |
---|
3162 | feasible set is bounded. One way to that is to add bounds on on |
---|
3163 | variables.</p> |
---|
3164 | <table cellpadding="10" width="100%" id="table86"> |
---|
3165 | <tr> |
---|
3166 | <td class="xmpcode"> |
---|
3167 | <pre>plot(F+set(-100 < recover(depends(F)) < 100));</pre> |
---|
3168 | </td> |
---|
3169 | </tr> |
---|
3170 | </table> |
---|
3171 | <p>Note that plotting the feasible set requires solving the |
---|
3172 | associated optimization problem repeatedly. Hence, for feasible |
---|
3173 | sets defined by a lot of constraints and variables, it may take a |
---|
3174 | long time to generate the figure (controlled by the accuracy level |
---|
3175 | in the fourth argument, 25 points is default for 2D and 100 for 3D |
---|
3176 | figures, although much more is recommended for smooth figures). For small problems, a large portion of |
---|
3177 | the solution time can easily be dominated by overhead costs. |
---|
3178 | Hence, it is recommended to use a solver with low overhead (for |
---|
3179 | SDP problems, <a href="solvers.htm#pensdp">PENSDP</a> is |
---|
3180 | recommended)<p>Also note that when you plot sets with constraints involving |
---|
3181 | <a href="extoperators.htm">nonlinear |
---|
3182 | operators</a> and polynomials, it is recommended that you specify the variables |
---|
3183 | of interest in the second argument (YALMIP may otherwise plot the set |
---|
3184 | with respect to auxiliary variables introduced during the construction |
---|
3185 | of the conic model.)</td> |
---|
3186 | </tr> |
---|
3187 | <tr> |
---|
3188 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3189 | Related commands</th> |
---|
3190 | </tr> |
---|
3191 | <tr> |
---|
3192 | <td class="tabxpl"><a href="reference.htm#set">set</a>,<a href="#plotsdpvar"> plot</a></td> |
---|
3193 | </tr> |
---|
3194 | </table> |
---|
3195 | </td> |
---|
3196 | </tr> |
---|
3197 | </table> |
---|
3198 | <p> </p> |
---|
3199 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table88"> |
---|
3200 | <tr> |
---|
3201 | <td class="tableheader"> |
---|
3202 | <p class="tableheader"><a name="plotsdpvar">PLOT</font></a></p> |
---|
3203 | </td> |
---|
3204 | </tr> |
---|
3205 | <tr> |
---|
3206 | <td> |
---|
3207 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table89"> |
---|
3208 | <tr> |
---|
3209 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3210 | Syntax<p></p> |
---|
3211 | </th> |
---|
3212 | <td class="code" valign="top" nowrap width="100%"><code>plot(t)</code></td> |
---|
3213 | </tr> |
---|
3214 | <tr> |
---|
3215 | <td class="tabxpl"> |
---|
3216 | <table border="0" id="table90"> |
---|
3217 | <tr> |
---|
3218 | <td> |
---|
3219 | <p align="right"><font face="Courier New">t</font><font face="Courier New" size="2">:</font></p> |
---|
3220 | </td> |
---|
3221 | <td>sdpvar object</td> |
---|
3222 | </tr> |
---|
3223 | </table> |
---|
3224 | </td> |
---|
3225 | </tr> |
---|
3226 | <tr> |
---|
3227 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3228 | Description</th> |
---|
3229 | </tr> |
---|
3230 | <tr> |
---|
3231 | <td class="tabxpl">plot is used to plot the PWA model of a |
---|
3232 | variable generated using <a href="extoperators.htm">nonlinear |
---|
3233 | operators</a> that can be modeled with linear constraints</td> |
---|
3234 | </tr> |
---|
3235 | <tr> |
---|
3236 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3237 | Examples</th> |
---|
3238 | </tr> |
---|
3239 | <tr> |
---|
3240 | <td class="tabxpl">Plot the L<sub>1</sub> norm<table cellpadding="10" width="100%" id="table91"> |
---|
3241 | <tr> |
---|
3242 | <td class="xmpcode"> |
---|
3243 | <pre>x = sdpvar(2,1); |
---|
3244 | clf;plot(norm(x,1))</pre> |
---|
3245 | </td> |
---|
3246 | </tr> |
---|
3247 | </table> |
---|
3248 | <p>Or a more complex PWA expression</p> |
---|
3249 | <table cellpadding="10" width="100%" id="table99"> |
---|
3250 | <tr> |
---|
3251 | <td class="xmpcode"> |
---|
3252 | <pre>x = sdpvar(2,1); |
---|
3253 | clf;plot(norm(randn(5,2)*x,1)+ max(x)-5*x(2))</pre> |
---|
3254 | </td> |
---|
3255 | </tr> |
---|
3256 | </table> |
---|
3257 | <p>Notice that the command by default plots the function over a |
---|
3258 | grid from -100 to 100. This can currently not be changed. |
---|
3259 | However, we can easily circumvent this by using the main |
---|
3260 | function used in plot. </p> |
---|
3261 | <table cellpadding="10" width="100%" id="table92"> |
---|
3262 | <tr> |
---|
3263 | <td class="xmpcode"> |
---|
3264 | <pre>p = pwa(norm(randn(5,2)*x,1)+ max(x)-5*x(2),set(-1<x<1)); |
---|
3265 | clf;plot(p)</pre> |
---|
3266 | </td> |
---|
3267 | </tr> |
---|
3268 | </table> |
---|
3269 | </td> |
---|
3270 | </tr> |
---|
3271 | <tr> |
---|
3272 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3273 | Related commands</th> |
---|
3274 | </tr> |
---|
3275 | <tr> |
---|
3276 | <td class="tabxpl"><a href="reference.htm#plot">plot</a> </td> |
---|
3277 | </tr> |
---|
3278 | </table> |
---|
3279 | </td> |
---|
3280 | </tr> |
---|
3281 | </table> |
---|
3282 | <p> </p> |
---|
3283 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
3284 | <tr> |
---|
3285 | <td class="tableheader"> |
---|
3286 | <p class="tableheader"><a name="polyprint">POLYPRINT</a></p> |
---|
3287 | </td> |
---|
3288 | </tr> |
---|
3289 | <tr> |
---|
3290 | <td> |
---|
3291 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
3292 | <tr> |
---|
3293 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3294 | Description</th> |
---|
3295 | </tr> |
---|
3296 | <tr> |
---|
3297 | <td class="tabxpl">Polyprint is obsolete and replaced with |
---|
3298 | <a href="reference.htm#sdisplay">sdisplay</a></td> |
---|
3299 | </tr> |
---|
3300 | </table> |
---|
3301 | </td> |
---|
3302 | </tr> |
---|
3303 | </table> |
---|
3304 | <p> </p> |
---|
3305 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table1"> |
---|
3306 | <tr> |
---|
3307 | <td class="tableheader"> |
---|
3308 | <p class="tableheader"><a name="primalize">PRIMALIZE</a></p> |
---|
3309 | </td> |
---|
3310 | </tr> |
---|
3311 | <tr> |
---|
3312 | <td> |
---|
3313 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table2"> |
---|
3314 | <tr> |
---|
3315 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3316 | Syntax</th> |
---|
3317 | <td class="code" valign="top" nowrap width="100%"><code> |
---|
3318 | [Fp,objp,y] = primalize(F,obj)</code></td> |
---|
3319 | </tr> |
---|
3320 | <tr> |
---|
3321 | <td class="tabxpl"> |
---|
3322 | <table border="0" id="table3"> |
---|
3323 | <tr> |
---|
3324 | <td> |
---|
3325 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
3326 | </td> |
---|
3327 | <td>set object in dual SDP form</td> |
---|
3328 | </tr> |
---|
3329 | <tr> |
---|
3330 | <td> |
---|
3331 | <p align="right"><font face="Courier New" size="2">obj:</font></p> |
---|
3332 | </td> |
---|
3333 | <td>sdpvar object (primal cost)</td> |
---|
3334 | </tr> |
---|
3335 | <tr> |
---|
3336 | <td> |
---|
3337 | <p align="right"><font face="Courier New" size="2">Fp:</font></p> |
---|
3338 | </td> |
---|
3339 | <td>set object in primal SDP form</td> |
---|
3340 | </tr> |
---|
3341 | <tr> |
---|
3342 | <td> |
---|
3343 | <p align="right"><font face="Courier New">objd</font><font face="Courier New" size="2">:</font></p> |
---|
3344 | </td> |
---|
3345 | <td>sdpvar object (primal cost)</td> |
---|
3346 | </tr> |
---|
3347 | <tr> |
---|
3348 | <td> |
---|
3349 | <p align="right"><font face="Courier New">y</font><font face="Courier New" size="2">:</font></p> |
---|
3350 | </td> |
---|
3351 | <td>sdpvar object (detected dual variables)</td> |
---|
3352 | </tr> |
---|
3353 | </table> |
---|
3354 | </td> |
---|
3355 | </tr> |
---|
3356 | <tr> |
---|
3357 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3358 | Description</th> |
---|
3359 | </tr> |
---|
3360 | <tr> |
---|
3361 | <td class="tabxpl">dualize is used to convert a SDP problem given |
---|
3362 | in primal form to the corresponding dual problem.</td> |
---|
3363 | </tr> |
---|
3364 | <tr> |
---|
3365 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3366 | Examples</th> |
---|
3367 | </tr> |
---|
3368 | <tr> |
---|
3369 | <td class="tabxpl">See <a href="dual.htm">examples</a>.</td> |
---|
3370 | </tr> |
---|
3371 | <tr> |
---|
3372 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3373 | Related commands</th> |
---|
3374 | </tr> |
---|
3375 | <tr> |
---|
3376 | <td class="tabxpl"> |
---|
3377 | <a href="reference.htm#dualize">dualize</a></td> |
---|
3378 | </tr> |
---|
3379 | </table> |
---|
3380 | </td> |
---|
3381 | </tr> |
---|
3382 | </table> |
---|
3383 | <p> </p> |
---|
3384 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table81"> |
---|
3385 | <tr> |
---|
3386 | <td class="tableheader"> |
---|
3387 | <p class="tableheader"><a name="pwf">PWF</a></p> |
---|
3388 | </td> |
---|
3389 | </tr> |
---|
3390 | <tr> |
---|
3391 | <td> |
---|
3392 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table82"> |
---|
3393 | <tr> |
---|
3394 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3395 | Syntax</th> |
---|
3396 | <td class="code" valign="top" nowrap width="100%"><code>t = double(f1,F1,f2,F2,...,fn,Fn)</code></td> |
---|
3397 | </tr> |
---|
3398 | <tr> |
---|
3399 | <td class="tabxpl"> |
---|
3400 | <table border="0" id="table83"> |
---|
3401 | <tr> |
---|
3402 | <td> |
---|
3403 | <p align="right"><font face="Courier New">t</font><font face="Courier New" size="2">:</font></p> |
---|
3404 | </td> |
---|
3405 | <td>sdpvar object</td> |
---|
3406 | </tr> |
---|
3407 | <tr> |
---|
3408 | <td> |
---|
3409 | <p align="right"><font face="Courier New" size="2">fi:</font></p> |
---|
3410 | </td> |
---|
3411 | <td>sdpvar object (function value)</td> |
---|
3412 | </tr> |
---|
3413 | <tr> |
---|
3414 | <td> |
---|
3415 | <font face="Courier New">F</font><font face="Courier New" size="2">i</font></td> |
---|
3416 | <td>set object (region guard)</td> |
---|
3417 | </tr> |
---|
3418 | <tr> |
---|
3419 | <td> |
---|
3420 | </td> |
---|
3421 | <td> </td> |
---|
3422 | </tr> |
---|
3423 | </table> |
---|
3424 | </td> |
---|
3425 | </tr> |
---|
3426 | <tr> |
---|
3427 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3428 | Description</th> |
---|
3429 | </tr> |
---|
3430 | <tr> |
---|
3431 | <td class="tabxpl">pwf is used to define piece-wise functions.</td> |
---|
3432 | </tr> |
---|
3433 | <tr> |
---|
3434 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3435 | Examples</th> |
---|
3436 | </tr> |
---|
3437 | <tr> |
---|
3438 | <td class="tabxpl">Consider a model where the function has the |
---|
3439 | value <b>f1(x)</b> when the constraint <b>F1(x)</b> holds and <b> |
---|
3440 | f2(x)</b> when the constraint <b>F2(x)</b> holds. This can be |
---|
3441 | modeled as<table cellpadding="10" width="100%" id="table84"> |
---|
3442 | <tr> |
---|
3443 | <td class="xmpcode"> |
---|
3444 | <pre>sdpvar x y |
---|
3445 | F1 = set(x+y<0); |
---|
3446 | F2 = set(x+y>0); |
---|
3447 | f1 = (x+3)^2+(y+2)^2+7; |
---|
3448 | f2 = (x+3)^2+(y-2)^2+9; |
---|
3449 | t = pwf(f1,F1,f2,F2);</pre> |
---|
3450 | </td> |
---|
3451 | </tr> |
---|
3452 | </table> |
---|
3453 | <p>The variable returned from the function is a so called |
---|
3454 | <a href="extoperators.htm">nonlinear operator</a>. To minimize |
---|
3455 | the piece-wise function, we use the variable <b>t</b> as usual and |
---|
3456 | simply call <a href="reference.htm#solvesdp">solvesdp</a>. YALMIP |
---|
3457 | will automatically try to construct a model that can be |
---|
3458 | solved. In this case, YALMIP will derive a mixed integer second |
---|
3459 | order cone problem. </p> |
---|
3460 | <table cellpadding="10" width="100%" id="table85"> |
---|
3461 | <tr> |
---|
3462 | <td class="xmpcode"> |
---|
3463 | <pre>solvesdp([],t);</pre> |
---|
3464 | </td> |
---|
3465 | </tr> |
---|
3466 | </table> |
---|
3467 | <p>Support for piece-wise functions is still limited, but can |
---|
3468 | easily be improved if wanted. At the moment, the function can be |
---|
3469 | defined using arbitrary functions and sets, but when it comes down to |
---|
3470 | computing things, only convex quadratic functions and regions |
---|
3471 | defined by convex quadratic constraints are allowed.</td> |
---|
3472 | </tr> |
---|
3473 | <tr> |
---|
3474 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3475 | Related commands</th> |
---|
3476 | </tr> |
---|
3477 | <tr> |
---|
3478 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a>, |
---|
3479 | <a href="reference.htm#solvesdp">solvesdp</a></td> |
---|
3480 | </tr> |
---|
3481 | </table> |
---|
3482 | </td> |
---|
3483 | </tr> |
---|
3484 | </table> |
---|
3485 | <p> </p> |
---|
3486 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table15"> |
---|
3487 | <tr> |
---|
3488 | <td class="tableheader"> |
---|
3489 | <p class="tableheader"><a name="rank">RANK</a></p> |
---|
3490 | </td> |
---|
3491 | </tr> |
---|
3492 | <tr> |
---|
3493 | <td> |
---|
3494 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table16"> |
---|
3495 | <tr> |
---|
3496 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3497 | Syntax</th> |
---|
3498 | <td class="code" valign="top" nowrap width="100%"><code>r = rank(x)</code></td> |
---|
3499 | </tr> |
---|
3500 | <tr> |
---|
3501 | <td class="tabxpl"> |
---|
3502 | <table border="0" id="table17"> |
---|
3503 | <tr> |
---|
3504 | <td> |
---|
3505 | <p align="right"><font face="Courier New">r</font><font face="Courier New" size="2">:</font></p> |
---|
3506 | </td> |
---|
3507 | <td>sdpvar object (only useful in set object)</td> |
---|
3508 | </tr> |
---|
3509 | <tr> |
---|
3510 | <td> |
---|
3511 | <p align="right"><font face="Courier New">x</font><font face="Courier New" size="2">:</font></p> |
---|
3512 | </td> |
---|
3513 | <td>sdpvar object</td> |
---|
3514 | </tr> |
---|
3515 | </table> |
---|
3516 | </td> |
---|
3517 | </tr> |
---|
3518 | <tr> |
---|
3519 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3520 | Description</th> |
---|
3521 | </tr> |
---|
3522 | <tr> |
---|
3523 | <td class="tabxpl">rank is mainly used for creating rank |
---|
3524 | constraints.</td> |
---|
3525 | </tr> |
---|
3526 | <tr> |
---|
3527 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3528 | Examples</th> |
---|
3529 | </tr> |
---|
3530 | <tr> |
---|
3531 | <td class="tabxpl">The <a href="extoperators.htm">nonlinear |
---|
3532 | operator</a> rank is used to add rank constraints to SDP |
---|
3533 | problems. <table cellpadding="10" width="100%" id="table18"> |
---|
3534 | <tr> |
---|
3535 | <td class="xmpcode"> |
---|
3536 | <pre>F = F + set(rank(X)<=1)</pre> |
---|
3537 | </td> |
---|
3538 | </tr> |
---|
3539 | </table> |
---|
3540 | <p>For more information, please study the <a href="ranksdp.htm"> |
---|
3541 | rank constrained</a> example.</td> |
---|
3542 | </tr> |
---|
3543 | <tr> |
---|
3544 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3545 | Related commands</th> |
---|
3546 | </tr> |
---|
3547 | <tr> |
---|
3548 | <td class="tabxpl"><a href="#set">set</a></td> |
---|
3549 | </tr> |
---|
3550 | </table> |
---|
3551 | </td> |
---|
3552 | </tr> |
---|
3553 | </table> |
---|
3554 | <p> </p> |
---|
3555 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
3556 | <tr> |
---|
3557 | <td class="tableheader"> |
---|
3558 | <p class="tableheader"><a name="rcone">RCONE</a></p> |
---|
3559 | </td> |
---|
3560 | </tr> |
---|
3561 | <tr> |
---|
3562 | <td> |
---|
3563 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
3564 | <tr> |
---|
3565 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3566 | Syntax<p> </p> |
---|
3567 | </th> |
---|
3568 | <td class="code" valign="top" nowrap width="100%"><code>c = rcone(x,y,z)</code></td> |
---|
3569 | </tr> |
---|
3570 | <tr> |
---|
3571 | <td class="tabxpl"> |
---|
3572 | <table border="0"> |
---|
3573 | <tr> |
---|
3574 | <td> |
---|
3575 | <p align="right"><font face="Courier New" size="2">c:</font></p> |
---|
3576 | </td> |
---|
3577 | <td>sdpvar object (only useful in set object)</td> |
---|
3578 | </tr> |
---|
3579 | <tr> |
---|
3580 | <td> |
---|
3581 | <p align="right"><font face="Courier New" size="2">x:</font></p> |
---|
3582 | </td> |
---|
3583 | <td>sdpvar object (vector)</td> |
---|
3584 | </tr> |
---|
3585 | <tr> |
---|
3586 | <td> |
---|
3587 | <p align="right"><font face="Courier New" size="2">y:</font></p> |
---|
3588 | </td> |
---|
3589 | <td>sdpvar object (scalar)</td> |
---|
3590 | </tr> |
---|
3591 | <tr> |
---|
3592 | <td> |
---|
3593 | <p align="right"><font face="Courier New" size="2">z:</font></p> |
---|
3594 | </td> |
---|
3595 | <td>sdpvar object (scalar)</td> |
---|
3596 | </tr> |
---|
3597 | </table> |
---|
3598 | </td> |
---|
3599 | </tr> |
---|
3600 | <tr> |
---|
3601 | <th class="doc" valign="top" align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3602 | Description</th> |
---|
3603 | </tr> |
---|
3604 | <tr> |
---|
3605 | <td class="tabxpl">rcone is used to define the constraints <b>z<sup>T</sup>z<2xy</b>, |
---|
3606 | <b>x</b>,<b>y>0</b> (The rotated Lorentz cone)</td> |
---|
3607 | </tr> |
---|
3608 | <tr> |
---|
3609 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3610 | Examples</th> |
---|
3611 | </tr> |
---|
3612 | <tr> |
---|
3613 | <td class="tabxpl">Constraining the squared Euclidean norm of a vector |
---|
3614 | to be less than 2 is done with<table cellpadding="10" width="100%"> |
---|
3615 | <tr> |
---|
3616 | <td class="xmpcode"> |
---|
3617 | <pre>x = sdpvar(n,1); |
---|
3618 | F = set(rcone(x,1,1));</pre> |
---|
3619 | </td> |
---|
3620 | </tr> |
---|
3621 | </table> |
---|
3622 | </td> |
---|
3623 | </tr> |
---|
3624 | <tr> |
---|
3625 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3626 | Related commands</th> |
---|
3627 | </tr> |
---|
3628 | <tr> |
---|
3629 | <td class="tabxpl"><a href="reference.htm#cone">cone</a>, |
---|
3630 | <a href="reference.htm#set">set</a>, |
---|
3631 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
3632 | </tr> |
---|
3633 | </table> |
---|
3634 | </td> |
---|
3635 | </tr> |
---|
3636 | </table> |
---|
3637 | <p> </p> |
---|
3638 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
3639 | <tr> |
---|
3640 | <td class="tableheader"> |
---|
3641 | <p class="tableheader"><a name="saveampl">SAVEAMPL</a></p> |
---|
3642 | </td> |
---|
3643 | </tr> |
---|
3644 | <tr> |
---|
3645 | <td> |
---|
3646 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
3647 | <tr> |
---|
3648 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3649 | Syntax<p> </p> |
---|
3650 | </th> |
---|
3651 | <td class="code" valign="top" nowrap width="100%"><code>saveampl(F,h,filename)</code></td> |
---|
3652 | </tr> |
---|
3653 | <tr> |
---|
3654 | <td class="tabxpl"> |
---|
3655 | <table border="0"> |
---|
3656 | <tr> |
---|
3657 | <td> |
---|
3658 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
3659 | </td> |
---|
3660 | <td>set object describing the constraints</td> |
---|
3661 | </tr> |
---|
3662 | <tr> |
---|
3663 | <td> |
---|
3664 | <p align="right"><font face="Courier New">h</font><font face="Courier New" size="2">:</font></p> |
---|
3665 | </td> |
---|
3666 | <td>sdpvar object describing the objective function</td> |
---|
3667 | </tr> |
---|
3668 | <tr> |
---|
3669 | <td> |
---|
3670 | <p align="right"><font face="Courier New">filename</font><font face="Courier New" size="2">:</font></p> |
---|
3671 | </td> |
---|
3672 | <td>char (can be [])</td> |
---|
3673 | </tr> |
---|
3674 | </table> |
---|
3675 | </td> |
---|
3676 | </tr> |
---|
3677 | <tr> |
---|
3678 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3679 | Description</th> |
---|
3680 | </tr> |
---|
3681 | <tr> |
---|
3682 | <td class="tabxpl">saveampl exports a YALMIP model to an AMPL model.</td> |
---|
3683 | </tr> |
---|
3684 | <tr> |
---|
3685 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3686 | Examples</th> |
---|
3687 | </tr> |
---|
3688 | <tr> |
---|
3689 | <td class="tabxpl">Well, not much to say. Here is a simple MILP exported |
---|
3690 | to an AMPL model<table cellpadding="10" width="100%"> |
---|
3691 | <tr> |
---|
3692 | <td class="xmpcode"> |
---|
3693 | <pre>x = sdpvar(3,1); |
---|
3694 | A = randn(5,3); |
---|
3695 | b = randn(5,1); |
---|
3696 | c = randn(3,1); |
---|
3697 | F = set(A*x < b) + set(integer(x(2:3))); |
---|
3698 | saveampl(F,c'*x,'myamplmodel.mod');</pre> |
---|
3699 | </td> |
---|
3700 | </tr> |
---|
3701 | </table> |
---|
3702 | </td> |
---|
3703 | </tr> |
---|
3704 | <tr> |
---|
3705 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3706 | Related commands</th> |
---|
3707 | </tr> |
---|
3708 | <tr> |
---|
3709 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a>, |
---|
3710 | <a href="reference.htm#solvesdp">solvesdp</a></td> |
---|
3711 | </tr> |
---|
3712 | </table> |
---|
3713 | </td> |
---|
3714 | </tr> |
---|
3715 | </table> |
---|
3716 | <p> </p> |
---|
3717 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table26"> |
---|
3718 | <tr> |
---|
3719 | <td class="tableheader"> |
---|
3720 | <p class="tableheader"><a name="savesdpafile">SAVESDPAFILE</a></p> |
---|
3721 | </td> |
---|
3722 | </tr> |
---|
3723 | <tr> |
---|
3724 | <td> |
---|
3725 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table27"> |
---|
3726 | <tr> |
---|
3727 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3728 | Syntax<p> </p> |
---|
3729 | </th> |
---|
3730 | <td class="code" valign="top" nowrap width="100%"><code>savesdpafile(F,h,filename)</code></td> |
---|
3731 | </tr> |
---|
3732 | <tr> |
---|
3733 | <td class="tabxpl"> |
---|
3734 | <table border="0" id="table28"> |
---|
3735 | <tr> |
---|
3736 | <td> |
---|
3737 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
3738 | </td> |
---|
3739 | <td>set object describing the constraints</td> |
---|
3740 | </tr> |
---|
3741 | <tr> |
---|
3742 | <td> |
---|
3743 | <p align="right"><font face="Courier New">h</font><font face="Courier New" size="2">:</font></p> |
---|
3744 | </td> |
---|
3745 | <td>sdpvar object describing the objective function</td> |
---|
3746 | </tr> |
---|
3747 | <tr> |
---|
3748 | <td> |
---|
3749 | <p align="right"><font face="Courier New">filename</font><font face="Courier New" size="2">:</font></p> |
---|
3750 | </td> |
---|
3751 | <td>char (can be [])</td> |
---|
3752 | </tr> |
---|
3753 | </table> |
---|
3754 | </td> |
---|
3755 | </tr> |
---|
3756 | <tr> |
---|
3757 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3758 | Description</th> |
---|
3759 | </tr> |
---|
3760 | <tr> |
---|
3761 | <td class="tabxpl">savesdpafile exports a YALMIP model to an SDPA |
---|
3762 | ASCII format</td> |
---|
3763 | </tr> |
---|
3764 | <tr> |
---|
3765 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3766 | Examples</th> |
---|
3767 | </tr> |
---|
3768 | <tr> |
---|
3769 | <td class="tabxpl">Export SDP problem to ASCII file.<table cellpadding="10" width="100%" id="table29"> |
---|
3770 | <tr> |
---|
3771 | <td class="xmpcode"> |
---|
3772 | <pre>A = randn(3,3);A = -A*A'; |
---|
3773 | P = sdpvar(3,3); |
---|
3774 | F = set(P>0) + set(A'*P+P*A < -eye(3)); |
---|
3775 | saveampl(F,trace(P),'mysdpamodel');</pre> |
---|
3776 | </td> |
---|
3777 | </tr> |
---|
3778 | </table> |
---|
3779 | </td> |
---|
3780 | </tr> |
---|
3781 | <tr> |
---|
3782 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3783 | Related commands</th> |
---|
3784 | </tr> |
---|
3785 | <tr> |
---|
3786 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a>, |
---|
3787 | <a href="reference.htm#solvesdp">solvesdp</a></td> |
---|
3788 | </tr> |
---|
3789 | </table> |
---|
3790 | </td> |
---|
3791 | </tr> |
---|
3792 | </table> |
---|
3793 | <p> </p> |
---|
3794 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
3795 | <tr> |
---|
3796 | <td class="tableheader"> |
---|
3797 | <p class="tableheader"><a name="sdisplay">SDISPLAY</a></p> |
---|
3798 | </td> |
---|
3799 | </tr> |
---|
3800 | <tr> |
---|
3801 | <td> |
---|
3802 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
3803 | <tr> |
---|
3804 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3805 | Syntax</th> |
---|
3806 | <td class="code" valign="top" nowrap width="100%"><code>t = |
---|
3807 | sdisplay(p)</code></td> |
---|
3808 | </tr> |
---|
3809 | <tr> |
---|
3810 | <td class="tabxpl"> |
---|
3811 | <table border="0"> |
---|
3812 | <tr> |
---|
3813 | <td> |
---|
3814 | <p align="right"><font face="Courier New" size="2">t:</font></p> |
---|
3815 | </td> |
---|
3816 | <td>cell array of chars</td> |
---|
3817 | </tr> |
---|
3818 | <tr> |
---|
3819 | <td> |
---|
3820 | <p align="right"><font face="Courier New" size="2">p:</font></p> |
---|
3821 | </td> |
---|
3822 | <td>sdpvar object</td> |
---|
3823 | </tr> |
---|
3824 | </table> |
---|
3825 | </td> |
---|
3826 | </tr> |
---|
3827 | <tr> |
---|
3828 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3829 | Description</th> |
---|
3830 | </tr> |
---|
3831 | <tr> |
---|
3832 | <td class="tabxpl">Tries to display an sdpvar object in symbolic |
---|
3833 | MATLAB |
---|
3834 | form</td> |
---|
3835 | </tr> |
---|
3836 | <tr> |
---|
3837 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3838 | Examples</th> |
---|
3839 | </tr> |
---|
3840 | <tr> |
---|
3841 | <td class="tabxpl">The command is useful for displaying polynomial |
---|
3842 | <a href="reference.htm#sdpvar">sdpvar</a> objects<table cellpadding="10" width="100%"> |
---|
3843 | <tr> |
---|
3844 | <td class="xmpcode"> |
---|
3845 | <pre>x = sdpvar(1,1);y = sdpvar(1,1); |
---|
3846 | f = [x;x^2+y+x*y]; |
---|
3847 | sdisplay(f) |
---|
3848 | |
---|
3849 | <font color="#000000">ans = </font></pre> |
---|
3850 | <pre><font color="#000000"> 'x' |
---|
3851 | 'y+x^2+xy'</font></pre> |
---|
3852 | </td> |
---|
3853 | </tr> |
---|
3854 | </table> |
---|
3855 | <p>The command tries to find the symbolic names of variables, but |
---|
3856 | if this fails, the variable name <b>internal</b> will be used. |
---|
3857 | Additionally, variables defined using nonlinear operators can |
---|
3858 | currently not be displayed.</p> |
---|
3859 | </td> |
---|
3860 | </tr> |
---|
3861 | <tr> |
---|
3862 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3863 | Related commands</th> |
---|
3864 | </tr> |
---|
3865 | <tr> |
---|
3866 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a>, |
---|
3867 | <a href="reference.htm#jacobian">jacobian</a>, |
---|
3868 | <a href="reference.htm#hessian">hessian</a></td> |
---|
3869 | </tr> |
---|
3870 | </table> |
---|
3871 | </td> |
---|
3872 | </tr> |
---|
3873 | </table> |
---|
3874 | <p> </p> |
---|
3875 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
3876 | <tr> |
---|
3877 | <td class="tableheader"> |
---|
3878 | <p class="tableheader"><a name="sdpsettings">SDPSETTINGS</font></a></p> |
---|
3879 | </td> |
---|
3880 | </tr> |
---|
3881 | <tr> |
---|
3882 | <td> |
---|
3883 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
3884 | <tr> |
---|
3885 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3886 | Syntax<p> </p> |
---|
3887 | </th> |
---|
3888 | <td class="code" valign="top" nowrap width="100%"><code>options = |
---|
3889 | sdpsettings('field',value,'field','value',...)</code></td> |
---|
3890 | </tr> |
---|
3891 | <tr> |
---|
3892 | <td class="tabxpl"> |
---|
3893 | <table border="0"> |
---|
3894 | <tr> |
---|
3895 | <td> |
---|
3896 | <p align="right"><font face="Courier New" size="2">'field':</font></p> |
---|
3897 | </td> |
---|
3898 | <td>Option to be modified</td> |
---|
3899 | </tr> |
---|
3900 | <tr> |
---|
3901 | <td> |
---|
3902 | <p align="right"><font face="Courier New" size="2">'value':</font></p> |
---|
3903 | </td> |
---|
3904 | <td>New setting</td> |
---|
3905 | </tr> |
---|
3906 | </table> |
---|
3907 | </td> |
---|
3908 | </tr> |
---|
3909 | <tr> |
---|
3910 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3911 | Description</th> |
---|
3912 | </tr> |
---|
3913 | <tr> |
---|
3914 | <td class="tabxpl">sdpsettings is used to set parameters to control |
---|
3915 | the behavior of solvers and YALMIP</td> |
---|
3916 | </tr> |
---|
3917 | <tr> |
---|
3918 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
3919 | Examples</th> |
---|
3920 | </tr> |
---|
3921 | <tr> |
---|
3922 | <td class="tabxpl">The easiest way to see what the possible options |
---|
3923 | are is to define a options structure and display it<table cellpadding="10" width="100%"> |
---|
3924 | <tr> |
---|
3925 | <td class="xmpcode"> |
---|
3926 | <pre>ops = sdpsettings</pre> |
---|
3927 | <pre><font color="#000000">ops = </font></pre> |
---|
3928 | <pre><font color="#000000"> solver: '' |
---|
3929 | verbose: 1 |
---|
3930 | warning: 1 |
---|
3931 | cachesolvers: 0 |
---|
3932 | beeponproblem: [-5 -4 -3 -2 -1] |
---|
3933 | showprogress: 0 |
---|
3934 | saveduals: 1 |
---|
3935 | removeequalities: 0 |
---|
3936 | savesolveroutput: 0 |
---|
3937 | savesolverinput: 0 |
---|
3938 | convertconvexquad: 1 |
---|
3939 | radius: Inf |
---|
3940 | relax: 0 |
---|
3941 | usex0: 0 |
---|
3942 | shift: 0 |
---|
3943 | savedebug: 0 |
---|
3944 | sos: [1x1 struct] |
---|
3945 | moment: [1x1 struct] |
---|
3946 | bnb: [1x1 struct] |
---|
3947 | bpmpd: [1x1 struct] |
---|
3948 | bmibnb: [1x1 struct] |
---|
3949 | cutsdp: [1x1 struct] |
---|
3950 | global: [1x1 struct] |
---|
3951 | cdd: [1x1 struct] |
---|
3952 | clp: [1x1 struct] |
---|
3953 | cplex: [1x1 struct] |
---|
3954 | csdp: [1x1 struct] |
---|
3955 | dsdp: [1x1 struct] |
---|
3956 | glpk: [1x1 struct] |
---|
3957 | kypd: [1x1 struct] |
---|
3958 | lmilab: [1x1 struct] |
---|
3959 | lmirank: [1x1 struct] |
---|
3960 | lpsolve: [1x1 struct] |
---|
3961 | maxdet: [1x1 struct] |
---|
3962 | nag: [1x1 struct] |
---|
3963 | penbmi: [1x1 struct] |
---|
3964 | pennlp: [1x1 struct] |
---|
3965 | pensdp: [1x1 struct] |
---|
3966 | sdpa: [1x1 struct] |
---|
3967 | sdplr: [1x1 struct] |
---|
3968 | sdpt3: [1x1 struct] |
---|
3969 | sedumi: [1x1 struct] |
---|
3970 | qsopt: [1x1 struct] |
---|
3971 | xpress: [1x1 struct] |
---|
3972 | quadprog: [1x1 struct] |
---|
3973 | linprog: [1x1 struct] |
---|
3974 | bintprog: [1x1 struct] |
---|
3975 | fmincon: [1x1 struct] |
---|
3976 | fminsearch: [1x1 struct]</font></pre> |
---|
3977 | </td> |
---|
3978 | </tr> |
---|
3979 | </table> |
---|
3980 | <p>Changing a value from the default settings is done as</p> |
---|
3981 | <table cellpadding="10" width="100%"> |
---|
3982 | <tr> |
---|
3983 | <td class="xmpcode"> |
---|
3984 | <pre>ops = sdpsettings('solver','dsdp','verbose',0)</pre> |
---|
3985 | </td> |
---|
3986 | </tr> |
---|
3987 | </table> |
---|
3988 | <p><b><a name="sdpsettings_solver"></a>solver</b></p> |
---|
3989 | <p>In the code above, we told YALMIP to use the solver DSDP, and to |
---|
3990 | run in silent mode. The possible values to give to the field <code> |
---|
3991 | solver </code>can be found in the <a href="solvers.htm">introduction |
---|
3992 | to the solvers</a>. If the solver DSDP not is found, an error |
---|
3993 | message will be reported. To let YALMIP select the solver, use |
---|
3994 | the solver tag <code>''</code>. If you give a comma-separated list of solvers |
---|
3995 | such as <code>'dsdp,csdp,sdpa'</code>, YALMIP will select based |
---|
3996 | on this preference. If you add a wildcard in the end <code>'dsdp,csdp,sdpa,*'</code>, |
---|
3997 | YALMIP will select another solver if none of the solvers in the |
---|
3998 | list were found. </p> |
---|
3999 | <p><b>verbose</b></p> |
---|
4000 | <p>By setting <code>verbose</code> to 0, the solvers will run with |
---|
4001 | minimal display. By increasing the value, the display level is controlled |
---|
4002 | (typically 1 gives modest display level while 2 gives an awful amount |
---|
4003 | of information printed). </p> |
---|
4004 | <p><b>warning</b></p> |
---|
4005 | <p>The <code>warning</code> option can be used |
---|
4006 | to get a warning displayed when a solver has run into some kind of |
---|
4007 | problem (recommended to be used if the solver is run in silent mode). |
---|
4008 | </p> |
---|
4009 | <p><b>beeponproblem</b></p> |
---|
4010 | <p>The field <code>beeponproblem</code> contains a list of error codes |
---|
4011 | (see yalmiperror). YALMIP will beep if any of these errors occurs |
---|
4012 | (nice feature if you're taking a coffee break during heavy calculations).</p> |
---|
4013 | <p><b>showprogress</b></p> |
---|
4014 | <p>When the field <code>showprogress</code> is set to 1, the user |
---|
4015 | can see what YALMIP currently is doing (might be a good idea for large-scale |
---|
4016 | problems). </p> |
---|
4017 | <p><b>cachesolvers</b></p> |
---|
4018 | <p>Everytime <a href="#solvesdp">solvesdp</a> is called, YALMIP checks |
---|
4019 | for available solvers. This can take a while on some systems (some |
---|
4020 | networks), so it is possible to avoid doing this check every call. |
---|
4021 | Set <code>cachesolvers</code> to 1, and YALMIP will remember the solvers |
---|
4022 | (using a persistent variable) found in the first call to |
---|
4023 | <a href="#solvesdp">solvesdp</a>. If solvers are added to the path |
---|
4024 | after the first call, YALMIP will not detect this. Hence, after adding |
---|
4025 | a solver to the path the work-space must be cleared or |
---|
4026 | <a href="#solvesdp">solvesdp</a> must be called once with <code>cachesolvers</code> |
---|
4027 | set to 0.</p> |
---|
4028 | <p><b>removeequalities</b></p> |
---|
4029 | <p>When the field <code>removeequalities</code> is set to 1, YALMIP |
---|
4030 | removes equality constraints using a QR decomposition and reformulates |
---|
4031 | the problem using a smaller set of variables. If <code>removeequalities</code> is set to |
---|
4032 | 2, YALMIP |
---|
4033 | removes equality constraints using a basis derived directly from |
---|
4034 | independent columns of the equality constraints (higher |
---|
4035 | possibility of maintaining sparsity than the QR approach, but |
---|
4036 | may lead to a numerically poor basis). With <code>removeequalities</code> |
---|
4037 | set to -1, equalities are removed by YALMIP by converting them to |
---|
4038 | double-sided inequalities. When set to 0, YALMIP does nothing if |
---|
4039 | the solver supports equalities. If the solver does not support |
---|
4040 | equalities, YALMIP uses double-sided inequalities.</p> |
---|
4041 | <p><b>saveduals</b></p> |
---|
4042 | <p>If the field <code>saveduals</code> is set to 0, the dual variables |
---|
4043 | will not be saved in YALMIP. This might be useful for large sparse |
---|
4044 | problems with a dense dual variable. Setting the field to 0 will then |
---|
4045 | save some memory.</p> |
---|
4046 | <p><b>savesolverinput, savesolveroutput</b></p> |
---|
4047 | <p>The fields <code>savesolverinput</code> and <code>savesolveroutput</code> |
---|
4048 | can be used to see what is actually sent to and returned from the |
---|
4049 | solver. This data will then be available in the output structure from |
---|
4050 | solvesdp.</p> |
---|
4051 | <p><b>convertconvexquad</b></p> |
---|
4052 | <p>With <code>convertconvexquad</code> set to 1, YALMIP will try to |
---|
4053 | convert quadratic constraints to second order cones.</p> |
---|
4054 | <p>A constraint <b><font face="Tahoma">||x||≤radius</font><font face="Times New Roman"> |
---|
4055 | </font></b>on the vector of all involved decision variables can be |
---|
4056 | added by changing the field <code>radius</code> to a finite positive |
---|
4057 | value. This can improve numerical performance in some cases. In fact, |
---|
4058 | the field <code>radius</code> may be an <a href="#sdpvar">sdpvar</a> |
---|
4059 | object. If you work with semidefinite programs and standard convex |
---|
4060 | programming, it is recommended to keep the feature on. However, |
---|
4061 | if you work with more general nonlinear optimization problem, it |
---|
4062 | is most often recommended to turn the conversion off.</p> |
---|
4063 | <p><b>shift</b></p> |
---|
4064 | <p>Strict inequalities can be modeled in YALMIP by using the > and |
---|
4065 | < when defining constraints. The behaviour of this feature can be |
---|
4066 | altered using the option <code>shift</code>. For constraints |
---|
4067 | defined |
---|
4068 | with strict constraints, a small perturbation is added (semidefinite |
---|
4069 | constraints <b><font face="Tahoma">F(x)>0</font></b> are changed to |
---|
4070 | <b><font face="Tahoma">F(x)≥shift*I</font></b>, while element-wise |
---|
4071 | constraints are changed from <b><font face="Tahoma">F(x)>0 </font> |
---|
4072 | </b>to <b><font face="Tahoma">F(x)≥shift</font></b>). Note that the |
---|
4073 | use of this feature does not guarantee a strictly feasible solution. |
---|
4074 | This depends on the solver.</p> |
---|
4075 | <p><b>relax</b></p> |
---|
4076 | <p>If <code>relax</code> is set to 1, all nonlinearities and integrality |
---|
4077 | constraints will be disregarded. Integer variables are relaxed to |
---|
4078 | continuous variables and nonlinear variables are treated as independent |
---|
4079 | variables (i.e., <b>x</b> and <b>x</b><sup><b>2</b></sup> will be |
---|
4080 | treated as two separate variables).</p> |
---|
4081 | <p><b>usex0</b></p> |
---|
4082 | <p>The current solution (the value returned from the |
---|
4083 | <a href="#double">double</a> command) can be used as an initial guess |
---|
4084 | when solving an optimization problem. Setting the field <code>usex0</code> |
---|
4085 | to 1 tells YALMIP to supply the current values as an initial guess |
---|
4086 | to the solver.</p> |
---|
4087 | <p><b>solver options</b></p> |
---|
4088 | <p>The options structure also contains a number of structures with |
---|
4089 | parameters used in the specific solver. As an example, the following |
---|
4090 | parameters can be tuned for SeDuMi (for details, the user is referred |
---|
4091 | to the manual of the specific solver).</p> |
---|
4092 | <table cellpadding="10" width="100%"> |
---|
4093 | <tr> |
---|
4094 | <td class="xmpcode"> |
---|
4095 | <pre>ops.sedumi |
---|
4096 | <font color="#000000">ans = |
---|
4097 | alg: 2 |
---|
4098 | theta: 0.2500 |
---|
4099 | beta: 0.5000 |
---|
4100 | eps: 1.0000e-009 |
---|
4101 | bigeps: 0.0010 |
---|
4102 | numtol: 1.0000e-005 |
---|
4103 | denq: 0.7500 |
---|
4104 | denf: 10 |
---|
4105 | vplot: 0 |
---|
4106 | maxiter: 100 |
---|
4107 | stepdif: 1 |
---|
4108 | w: [1 1] |
---|
4109 | stopat: -1 |
---|
4110 | cg: [1x1 struct] |
---|
4111 | chol: [1x1 struct]</font></pre> |
---|
4112 | </td> |
---|
4113 | </tr> |
---|
4114 | </table> |
---|
4115 | <p>Finally, a convenient way to alter a lot of options is to send |
---|
4116 | an existing options structure as the first input argument.</p> |
---|
4117 | <table cellpadding="10" width="100%"> |
---|
4118 | <tr> |
---|
4119 | <td class="xmpcode"> |
---|
4120 | <pre>ops = sdpsettings('solver','sdpa'); |
---|
4121 | ops = sdpsettings(ops,'verbose',0);</pre> |
---|
4122 | </td> |
---|
4123 | </tr> |
---|
4124 | </table> |
---|
4125 | </td> |
---|
4126 | </tr> |
---|
4127 | <tr> |
---|
4128 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4129 | Related commands</th> |
---|
4130 | </tr> |
---|
4131 | <tr> |
---|
4132 | <td class="tabxpl"><a href="reference.htm#solvesdp">solvesdp</a></td> |
---|
4133 | </tr> |
---|
4134 | </table> |
---|
4135 | </td> |
---|
4136 | </tr> |
---|
4137 | </table> |
---|
4138 | <p> </p> |
---|
4139 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
4140 | <tr> |
---|
4141 | <td class="tableheader"> |
---|
4142 | <p class="tableheader"><a name="sdpvar">SDPVAR</font></a></p> |
---|
4143 | </td> |
---|
4144 | </tr> |
---|
4145 | <tr> |
---|
4146 | <td> |
---|
4147 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
4148 | <tr> |
---|
4149 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4150 | Syntax<p> </p> |
---|
4151 | </th> |
---|
4152 | <td class="code" valign="top" nowrap width="100%"><code>x = sdpvar(n,m,'field','type')</code></td> |
---|
4153 | </tr> |
---|
4154 | <tr> |
---|
4155 | <td class="tabxpl"> |
---|
4156 | <table border="0"> |
---|
4157 | <tr> |
---|
4158 | <td> |
---|
4159 | <p align="right"><font face="Courier New" size="2">n:</font></p> |
---|
4160 | </td> |
---|
4161 | <td>Height(s)</td> |
---|
4162 | </tr> |
---|
4163 | <tr> |
---|
4164 | <td> |
---|
4165 | <p align="right"><font face="Courier New" size="2">m:</font></p> |
---|
4166 | </td> |
---|
4167 | <td>Width(s)</td> |
---|
4168 | </tr> |
---|
4169 | <tr> |
---|
4170 | <td> |
---|
4171 | <p align="right"><font face="Courier New" size="2">'field':</font></p> |
---|
4172 | </td> |
---|
4173 | <td>char {'real','complex'}</td> |
---|
4174 | </tr> |
---|
4175 | <tr> |
---|
4176 | <td> |
---|
4177 | <p align="right"><font face="Courier New" size="2">'type':</font></p> |
---|
4178 | </td> |
---|
4179 | <td>char {'symmetric','full','hermitian','toeplitz','hankel','skew'}</td> |
---|
4180 | </tr> |
---|
4181 | </table> |
---|
4182 | </td> |
---|
4183 | </tr> |
---|
4184 | <tr> |
---|
4185 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4186 | Description</th> |
---|
4187 | </tr> |
---|
4188 | <tr> |
---|
4189 | <td class="tabxpl">sdpvar is used to define symbolic decision variables.</td> |
---|
4190 | </tr> |
---|
4191 | <tr> |
---|
4192 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4193 | Examples</th> |
---|
4194 | </tr> |
---|
4195 | <tr> |
---|
4196 | <td class="tabxpl">A scalar real-valued variable is defined with<table cellpadding="10" width="100%"> |
---|
4197 | <tr> |
---|
4198 | <td class="xmpcode"> |
---|
4199 | <pre>P = sdpvar(1,1)</pre> |
---|
4200 | </td> |
---|
4201 | </tr> |
---|
4202 | </table> |
---|
4203 | <p>A square real-valued symmetric matrix is obtained with </p> |
---|
4204 | <table cellpadding="10" width="100%"> |
---|
4205 | <tr> |
---|
4206 | <td class="xmpcode"> |
---|
4207 | <pre>P = sdpvar(n,n)</pre> |
---|
4208 | </td> |
---|
4209 | </tr> |
---|
4210 | </table> |
---|
4211 | <p>The commands above can be simplified by only giving one argument |
---|
4212 | when defining a symmetric matrix or a scalar (this might not work |
---|
4213 | on MATLAB 5.3 and earlier version). </p> |
---|
4214 | <table cellpadding="10" width="100%"> |
---|
4215 | <tr> |
---|
4216 | <td class="xmpcode"> |
---|
4217 | <pre>P = sdpvar(n)</pre> |
---|
4218 | </td> |
---|
4219 | </tr> |
---|
4220 | </table> |
---|
4221 | <p>We can also define the same matrix using a more verbose notation. |
---|
4222 | </p> |
---|
4223 | <table cellpadding="10" width="100%"> |
---|
4224 | <tr> |
---|
4225 | <td class="xmpcode"> |
---|
4226 | <pre>P = sdpvar(n,n,'symmetric')</pre> |
---|
4227 | </td> |
---|
4228 | </tr> |
---|
4229 | </table> |
---|
4230 | <p>A fully parameterized square matrix requires a third argument.</p> |
---|
4231 | <table cellpadding="10" width="100%"> |
---|
4232 | <tr> |
---|
4233 | <td class="xmpcode"> |
---|
4234 | <pre>P = sdpvar(n,n,'full')</pre> |
---|
4235 | </td> |
---|
4236 | </tr> |
---|
4237 | </table> |
---|
4238 | <p>A square complex-valued fully parameterized matrix is obtained |
---|
4239 | with </p> |
---|
4240 | <table cellpadding="10" width="100%"> |
---|
4241 | <tr> |
---|
4242 | <td class="xmpcode"> |
---|
4243 | <pre>P = sdpvar(n,n,'full','complex')</pre> |
---|
4244 | </td> |
---|
4245 | </tr> |
---|
4246 | </table> |
---|
4247 | <p>YALMIP tries to complete the third and fourth argument, so an equivalent |
---|
4248 | command is </p> |
---|
4249 | <table cellpadding="10" width="100%"> |
---|
4250 | <tr> |
---|
4251 | <td class="xmpcode"> |
---|
4252 | <pre>P = sdpvar(n,n,'sy','co')</pre> |
---|
4253 | </td> |
---|
4254 | </tr> |
---|
4255 | </table> |
---|
4256 | <p>Variables can alternatively be defined using command |
---|
4257 | line syntax.</p> |
---|
4258 | <table cellpadding="10" width="100%"> |
---|
4259 | <tr> |
---|
4260 | <td class="xmpcode"> |
---|
4261 | <pre>sdpvar x y z(1,1) u(2,2) v(2,3,'full','complex')</pre> |
---|
4262 | </td> |
---|
4263 | </tr> |
---|
4264 | </table> |
---|
4265 | <p>A lot of users seem to get stuck initially on simple things |
---|
4266 | such as defining a diagonal matrix. The most important thing to |
---|
4267 | remember when working with YALMIP is that almost all MATLAB |
---|
4268 | operators can be applied also on sdpvar objects. Hence, we |
---|
4269 | create diagonal matrices with </p> |
---|
4270 | <table cellpadding="10" width="100%" id="table104"> |
---|
4271 | <tr> |
---|
4272 | <td class="xmpcode"> |
---|
4273 | <pre>X = diag(sdpvar(n,1));</pre> |
---|
4274 | </td> |
---|
4275 | </tr> |
---|
4276 | </table> |
---|
4277 | <p>Or Hankel...</p> |
---|
4278 | <table cellpadding="10" width="100%" id="table105"> |
---|
4279 | <tr> |
---|
4280 | <td class="xmpcode"> |
---|
4281 | <pre>X = hankel(sdpvar(n,1));</pre> |
---|
4282 | </td> |
---|
4283 | </tr> |
---|
4284 | </table> |
---|
4285 | <p>A typical situation is that several identical variables are |
---|
4286 | needed, and the most straightforward way to code this is to use |
---|
4287 | a loop.</p> |
---|
4288 | <table cellpadding="10" width="100%" id="table67"> |
---|
4289 | <tr> |
---|
4290 | <td class="xmpcode"> |
---|
4291 | <pre>for i = 1:100; X{i} = sdpvar(5,5);end</pre> |
---|
4292 | </td> |
---|
4293 | </tr> |
---|
4294 | </table> |
---|
4295 | <p>However, a much more efficient way to implement this is to use |
---|
4296 | vector valued dimensions (this currently only works if all |
---|
4297 | matrices are symmetric or full)</p> |
---|
4298 | <table cellpadding="10" width="100%" id="table68"> |
---|
4299 | <tr> |
---|
4300 | <td class="xmpcode"> |
---|
4301 | <pre>X = sdpvar(5*ones(1,100),5*ones(1,100));</pre> |
---|
4302 | </td> |
---|
4303 | </tr> |
---|
4304 | </table> |
---|
4305 | <p>Another way to create multi-dimensional matrices is to use more |
---|
4306 | than 2 dimension arguments</p> |
---|
4307 | <table cellpadding="10" width="100%" id="table141"> |
---|
4308 | <tr> |
---|
4309 | <td class="xmpcode"> |
---|
4310 | <pre>X = sdpvar(5,5,100);</pre> |
---|
4311 | </td> |
---|
4312 | </tr> |
---|
4313 | </table> |
---|
4314 | <p>The benefit with this approach is that this variable can be |
---|
4315 | manipulated as standard 1D and 2D sdpvar objects.</td> |
---|
4316 | </tr> |
---|
4317 | <tr> |
---|
4318 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4319 | Related commands</th> |
---|
4320 | </tr> |
---|
4321 | <tr> |
---|
4322 | <td class="tabxpl"><a href="reference.htm#assign">assign</a>, |
---|
4323 | <a href="reference.htm#binvar">binvar</a>, |
---|
4324 | <a href="reference.htm#intvar">intvar</a>, |
---|
4325 | <a href="reference.htm#set">set</a></td> |
---|
4326 | </tr> |
---|
4327 | </table> |
---|
4328 | </td> |
---|
4329 | </tr> |
---|
4330 | </table> |
---|
4331 | <p> </p> |
---|
4332 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
4333 | <tr> |
---|
4334 | <td class="tableheader"> |
---|
4335 | <p class="tableheader"><a name="see">SEE</a></p> |
---|
4336 | </td> |
---|
4337 | </tr> |
---|
4338 | <tr> |
---|
4339 | <td> |
---|
4340 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
4341 | <tr> |
---|
4342 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4343 | Syntax</th> |
---|
4344 | <td class="code" valign="top" nowrap width="100%"><code>see(x)</code></td> |
---|
4345 | </tr> |
---|
4346 | <tr> |
---|
4347 | <td class="tabxpl"> |
---|
4348 | <table border="0"> |
---|
4349 | <tr> |
---|
4350 | <td><font face="Courier New" size="2">x:</font></td> |
---|
4351 | <td>sdpvar object</td> |
---|
4352 | </tr> |
---|
4353 | </table> |
---|
4354 | </td> |
---|
4355 | </tr> |
---|
4356 | <tr> |
---|
4357 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4358 | Description</th> |
---|
4359 | </tr> |
---|
4360 | <tr> |
---|
4361 | <td class="tabxpl">see is used to print the base matrices of an |
---|
4362 | <a href="#sdpvar">sdpvar</a> object.</td> |
---|
4363 | </tr> |
---|
4364 | <tr> |
---|
4365 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4366 | Examples</th> |
---|
4367 | </tr> |
---|
4368 | <tr> |
---|
4369 | <td class="tabxpl">A symmetric 2x2 matrix has the following base matrices<table cellpadding="10" width="100%"> |
---|
4370 | <tr> |
---|
4371 | <td class="xmpcode"> |
---|
4372 | <pre>x = sdpvar(2,2); |
---|
4373 | see(x) |
---|
4374 | <font color="#000000"> |
---|
4375 | Constant matrix |
---|
4376 | |
---|
4377 | 0 0 |
---|
4378 | 0 0</font></pre> |
---|
4379 | <pre><font color="#000000">Base matrices |
---|
4380 | |
---|
4381 | 1 0 |
---|
4382 | 0 0</font></pre> |
---|
4383 | <pre><font color="#000000"> |
---|
4384 | 0 1 |
---|
4385 | 1 0</font></pre> |
---|
4386 | <pre><font color="#000000"> |
---|
4387 | 0 0 |
---|
4388 | 0 1</font></pre> |
---|
4389 | <pre><font color="#000000"> |
---|
4390 | Used variables |
---|
4391 | |
---|
4392 | 1 2 3</font></pre> |
---|
4393 | </td> |
---|
4394 | </tr> |
---|
4395 | </table> |
---|
4396 | <p>When an <a href="reference.htm#sdpvar">sdpvar</a> object is altered, |
---|
4397 | the base matrices change </p> |
---|
4398 | <table cellpadding="10" width="100%"> |
---|
4399 | <tr> |
---|
4400 | <td class="xmpcode"> |
---|
4401 | <pre> </pre> |
---|
4402 | <pre>x = sdpvar(1,1); |
---|
4403 | see(2*x-3) |
---|
4404 | Constant matrix |
---|
4405 | |
---|
4406 | <font color="#000000"> -3</font></pre> |
---|
4407 | <pre><font color="#000000">Base matrices |
---|
4408 | |
---|
4409 | 2</font></pre> |
---|
4410 | <pre><font color="#000000"> |
---|
4411 | Used variables |
---|
4412 | |
---|
4413 | 4</font></pre> |
---|
4414 | <pre> </pre> |
---|
4415 | </td> |
---|
4416 | </tr> |
---|
4417 | </table> |
---|
4418 | </td> |
---|
4419 | </tr> |
---|
4420 | <tr> |
---|
4421 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4422 | Related commands</th> |
---|
4423 | </tr> |
---|
4424 | <tr> |
---|
4425 | <td class="tabxpl"><a href="reference.htm#getbase">getbase</a>, |
---|
4426 | <a href="reference.htm#getbasematrix">getbasematrix</a>, |
---|
4427 | <a href="reference.htm#getvariables">getvariables</a>, |
---|
4428 | <a href="reference.htm#recover">recover</a>, |
---|
4429 | <a href="reference.htm#sdpvar">sdpvar</a></td> |
---|
4430 | </tr> |
---|
4431 | </table> |
---|
4432 | </td> |
---|
4433 | </tr> |
---|
4434 | </table> |
---|
4435 | <p> </p> |
---|
4436 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
4437 | <tr> |
---|
4438 | <td class="tableheader"> |
---|
4439 | <p class="tableheader"><a name="set">SET</a></p> |
---|
4440 | </td> |
---|
4441 | </tr> |
---|
4442 | <tr> |
---|
4443 | <td> |
---|
4444 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
4445 | <tr> |
---|
4446 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4447 | Syntax<p> </p> |
---|
4448 | </th> |
---|
4449 | <td class="code" valign="top" nowrap width="100%"><code>F = set(X,'tag')</code></td> |
---|
4450 | </tr> |
---|
4451 | <tr> |
---|
4452 | <td class="tabxpl"> |
---|
4453 | <table border="0"> |
---|
4454 | <tr> |
---|
4455 | <td> |
---|
4456 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
4457 | </td> |
---|
4458 | <td>set object</td> |
---|
4459 | </tr> |
---|
4460 | <tr> |
---|
4461 | <td> |
---|
4462 | <p align="right"><font face="Courier New" size="2">X:</font></p> |
---|
4463 | </td> |
---|
4464 | <td>sdpvar or constraint object, or string</td> |
---|
4465 | </tr> |
---|
4466 | <tr> |
---|
4467 | <td> |
---|
4468 | <p align="right"><font face="Courier New" size="2">'tag':</font></p> |
---|
4469 | </td> |
---|
4470 | <td>char</td> |
---|
4471 | </tr> |
---|
4472 | </table> |
---|
4473 | </td> |
---|
4474 | </tr> |
---|
4475 | <tr> |
---|
4476 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4477 | Description</th> |
---|
4478 | </tr> |
---|
4479 | <tr> |
---|
4480 | <td class="tabxpl">set is used to define the constraints in a problem</td> |
---|
4481 | </tr> |
---|
4482 | <tr> |
---|
4483 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4484 | Example</th> |
---|
4485 | </tr> |
---|
4486 | <tr> |
---|
4487 | <td class="tabxpl">To begin with, note that it is possible to create |
---|
4488 | an empty <a href="reference.htm#lmi">set</a> object (this can be useful |
---|
4489 | in some loop-constructs).<table cellpadding="10" width="100%"> |
---|
4490 | <tr> |
---|
4491 | <td class="xmpcode"> |
---|
4492 | <pre>F = set([]);</pre> |
---|
4493 | </td> |
---|
4494 | </tr> |
---|
4495 | </table> |
---|
4496 | <p>Secondly, do not confuse the <a href="reference.htm#lmi">set</a> |
---|
4497 | object with the standard command set in MATLAB. Yes, it is confusing, |
---|
4498 | but set was the only relevant short word for defining the feasible |
---|
4499 | set that I could come up with...</p> |
---|
4500 | <p>Constraining a scalar variable to be larger than 5 is done with |
---|
4501 | </p> |
---|
4502 | <table cellpadding="10" width="100%"> |
---|
4503 | <tr> |
---|
4504 | <td class="xmpcode"> |
---|
4505 | <pre>x = sdpvar(1,1) |
---|
4506 | F = set(x > 5)</pre> |
---|
4507 | </td> |
---|
4508 | </tr> |
---|
4509 | </table> |
---|
4510 | <p>The variable <code>F</code> serves as a container for all constraints |
---|
4511 | here. Defining a matrix to be both positive definite and elementwise |
---|
4512 | positive is done with </p> |
---|
4513 | <table cellpadding="10" width="100%"> |
---|
4514 | <tr> |
---|
4515 | <td class="xmpcode"> |
---|
4516 | <pre>P = sdpvar(n,n); |
---|
4517 | F = set(P > 0) + set(P(:) > 0);</pre> |
---|
4518 | </td> |
---|
4519 | </tr> |
---|
4520 | </table> |
---|
4521 | <p>A string-notation can also be used </p> |
---|
4522 | <table cellpadding="10" width="100%"> |
---|
4523 | <tr> |
---|
4524 | <td class="xmpcode"> |
---|
4525 | <pre>F = set('P > 0') + set('P(:) > 0')</pre> |
---|
4526 | </td> |
---|
4527 | </tr> |
---|
4528 | </table> |
---|
4529 | <p>A <a href="reference.htm#set">set</a> object can be tagged with |
---|
4530 | a description (which can be useful for referencing a particular constraint |
---|
4531 | in, e.g., <a href="reference.htm#dual">dual</a>) </p> |
---|
4532 | <table cellpadding="10" width="100%"> |
---|
4533 | <tr> |
---|
4534 | <td class="xmpcode"> |
---|
4535 | <pre>F = set(P > 0,'positive definite'); |
---|
4536 | F = F + set(P(:)>0,'positive elements')</pre> |
---|
4537 | </td> |
---|
4538 | </tr> |
---|
4539 | </table> |
---|
4540 | <p>Second order cone constraints <b><font face="Tahoma">||Ax+b||<c<sup>T</sup>x+d</font></b> |
---|
4541 | can be added with the function <a href="reference.htm#cone">cone</a> |
---|
4542 | </p> |
---|
4543 | <table cellpadding="10" width="100%"> |
---|
4544 | <tr> |
---|
4545 | <td class="xmpcode"> |
---|
4546 | <pre>F = set(cone(A*x+b,c'*x+d))</pre> |
---|
4547 | </td> |
---|
4548 | </tr> |
---|
4549 | </table> |
---|
4550 | <p>Equality constraints can also be defined. A constraint that the |
---|
4551 | sum of the vector components is equal to 1 is obtained with </p> |
---|
4552 | <table cellpadding="10" width="100%"> |
---|
4553 | <tr> |
---|
4554 | <td class="xmpcode"> |
---|
4555 | <pre>F = set(sum(x) == 1)</pre> |
---|
4556 | </td> |
---|
4557 | </tr> |
---|
4558 | </table> |
---|
4559 | <p>In general, it should be remembered that YALMIP uses MATLAB standard |
---|
4560 | when it comes to comparison of matrices and scalars. Hence, the following |
---|
4561 | code will constrain all diagonal elements to be larger than 1. </p> |
---|
4562 | <table cellpadding="10" width="100%"> |
---|
4563 | <tr> |
---|
4564 | <td class="xmpcode"> |
---|
4565 | <pre>F = set(diag(P) > 1))</pre> |
---|
4566 | </td> |
---|
4567 | </tr> |
---|
4568 | </table> |
---|
4569 | <p>Double-sided constraints and extensions can easily be defined.</p> |
---|
4570 | <table cellpadding="10" width="100%"> |
---|
4571 | <tr> |
---|
4572 | <td class="xmpcode"> |
---|
4573 | <pre>F = set(2 > diag(P) > 1 > sum(sum(P)))</pre> |
---|
4574 | </td> |
---|
4575 | </tr> |
---|
4576 | </table> |
---|
4577 | <p>It is possible to have complex and integer valued constraints. |
---|
4578 | No special code is necessary. To create a complex-valued integer Hermitian |
---|
4579 | matrix and constrain it to be positive definite, we write </p> |
---|
4580 | <table cellpadding="10" width="100%"> |
---|
4581 | <tr> |
---|
4582 | <td class="xmpcode"> |
---|
4583 | <pre>P = intvar(3,3,'hermitian','complex'); |
---|
4584 | F = set(P > 0)</pre> |
---|
4585 | </td> |
---|
4586 | </tr> |
---|
4587 | </table> |
---|
4588 | <p>Notice that <a href="reference.htm#lmi">set</a> objects |
---|
4589 | can be referenced </p> |
---|
4590 | <table cellpadding="10" width="100%"> |
---|
4591 | <tr> |
---|
4592 | <td class="xmpcode"> |
---|
4593 | <pre>F = set(P > 0) + set(A'*P+P*A < 0) + set(P(1,1) > 0)+set(P(1,:) > 0); |
---|
4594 | F_lmi = F(1:2) |
---|
4595 | F_element = F(find(is(F,'element-wise')))</pre> |
---|
4596 | </td> |
---|
4597 | </tr> |
---|
4598 | </table> |
---|
4599 | <p>Finally, note that YALMIP does essentially not distinguish |
---|
4600 | between strict and non-strict inequalities. Hence, the following |
---|
4601 | two constraints are in almost all cases the same.</p> |
---|
4602 | <table cellpadding="10" width="100%" id="table123"> |
---|
4603 | <tr> |
---|
4604 | <td class="xmpcode"> |
---|
4605 | <pre>F = set(P > 0) + set(trace(P) < 1); |
---|
4606 | G = set(P >= 0) + set(trace(P) <= 1);</pre> |
---|
4607 | </td> |
---|
4608 | </tr> |
---|
4609 | </table> |
---|
4610 | <p>Please read the <a href="#reallystrict">FAQ</a> for more |
---|
4611 | information on the difference.</td> |
---|
4612 | </tr> |
---|
4613 | <tr> |
---|
4614 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4615 | Related commands</th> |
---|
4616 | </tr> |
---|
4617 | <tr> |
---|
4618 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a>, |
---|
4619 | <a href="reference.htm#integer">integer</a>, |
---|
4620 | <a href="reference.htm#binary">binary</a>, |
---|
4621 | <a href="reference.htm#solvesdp">solvesdp</a></td> |
---|
4622 | </tr> |
---|
4623 | </table> |
---|
4624 | </td> |
---|
4625 | </tr> |
---|
4626 | </table> |
---|
4627 | <p> </p> |
---|
4628 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
4629 | <tr> |
---|
4630 | <td class="tableheader"> |
---|
4631 | <p class="tableheader"><a name="setsdpvar">SETSDPVAR</font></a></p> |
---|
4632 | </td> |
---|
4633 | </tr> |
---|
4634 | <tr> |
---|
4635 | <td> |
---|
4636 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
4637 | <tr> |
---|
4638 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4639 | Syntax</th> |
---|
4640 | <td class="code" valign="top" nowrap width="100%"><code>assign(X,Y)</code></td> |
---|
4641 | </tr> |
---|
4642 | <tr> |
---|
4643 | <td class="tabxpl"> |
---|
4644 | <table border="0"> |
---|
4645 | <tr> |
---|
4646 | <td> |
---|
4647 | <p align="right"><font face="Courier New" size="2">X:</font></p> |
---|
4648 | </td> |
---|
4649 | <td>sdpvar object</td> |
---|
4650 | </tr> |
---|
4651 | <tr> |
---|
4652 | <td> |
---|
4653 | <p align="right"><font face="Courier New" size="2">Y:</font></p> |
---|
4654 | </td> |
---|
4655 | <td>double</td> |
---|
4656 | </tr> |
---|
4657 | </table> |
---|
4658 | </td> |
---|
4659 | </tr> |
---|
4660 | <tr> |
---|
4661 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4662 | Description</th> |
---|
4663 | </tr> |
---|
4664 | <tr> |
---|
4665 | <td class="tabxpl">setsdpvar is obsolete. Use <a href="reference.htm#assign">assign</a> |
---|
4666 | instead.</td> |
---|
4667 | </tr> |
---|
4668 | <tr> |
---|
4669 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4670 | Related commands</th> |
---|
4671 | </tr> |
---|
4672 | <tr> |
---|
4673 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a>, <a href="reference.htm#assign">assign</a></td> |
---|
4674 | </tr> |
---|
4675 | </table> |
---|
4676 | </td> |
---|
4677 | </tr> |
---|
4678 | </table> |
---|
4679 | <p> </p> |
---|
4680 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
4681 | <tr> |
---|
4682 | <td class="tableheader"> |
---|
4683 | <p class="tableheader"><a name="solvemp">SOLVEMP</font></a></p> |
---|
4684 | </td> |
---|
4685 | </tr> |
---|
4686 | <tr> |
---|
4687 | <td> |
---|
4688 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
4689 | <tr> |
---|
4690 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4691 | Syntax<p> </p> |
---|
4692 | </th> |
---|
4693 | <td class="code" valign="top" nowrap width="100%"><code>[mpsolution,diagnostic] |
---|
4694 | = solvemp(F,h,ops,x)</code></td> |
---|
4695 | </tr> |
---|
4696 | <tr> |
---|
4697 | <td class="tabxpl"> |
---|
4698 | <table border="0"> |
---|
4699 | <tr> |
---|
4700 | <td> |
---|
4701 | <p align="right"><font face="Courier New" size="2">mpsolution:</font></p> |
---|
4702 | </td> |
---|
4703 | <td>Multiparametric solution</td> |
---|
4704 | </tr> |
---|
4705 | <tr> |
---|
4706 | <td> |
---|
4707 | <p align="right"><font face="Courier New" size="2">diagnostic:</font></p> |
---|
4708 | </td> |
---|
4709 | <td>Output structure</td> |
---|
4710 | </tr> |
---|
4711 | <tr> |
---|
4712 | <td> |
---|
4713 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
4714 | </td> |
---|
4715 | <td>set object describing the constraints. Can be [].</td> |
---|
4716 | </tr> |
---|
4717 | <tr> |
---|
4718 | <td> |
---|
4719 | <p align="right"><font face="Courier New" size="2">h:</font></p> |
---|
4720 | </td> |
---|
4721 | <td>sdpvar-object describing the objective function. Can be [].</td> |
---|
4722 | </tr> |
---|
4723 | <tr> |
---|
4724 | <td> |
---|
4725 | <p align="right"><font face="Courier New" size="2">ops:</font></p> |
---|
4726 | </td> |
---|
4727 | <td>options structure from sdpsettings. Can be [].</td> |
---|
4728 | </tr> |
---|
4729 | <tr> |
---|
4730 | <td> |
---|
4731 | <p align="right"><font face="Courier New">x</font><font face="Courier New" size="2">:</font></p> |
---|
4732 | </td> |
---|
4733 | <td>parametric variables.</td> |
---|
4734 | </tr> |
---|
4735 | </table> |
---|
4736 | </td> |
---|
4737 | </tr> |
---|
4738 | <tr> |
---|
4739 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4740 | Description</th> |
---|
4741 | </tr> |
---|
4742 | <tr> |
---|
4743 | <td class="tabxpl">solvemp is used for solving multiparametric problems.</td> |
---|
4744 | </tr> |
---|
4745 | <tr> |
---|
4746 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4747 | Examples</th> |
---|
4748 | </tr> |
---|
4749 | <tr> |
---|
4750 | <td class="tabxpl">solvemp is used in the same way as |
---|
4751 | <a href="#solvesdp">solvesdp</a>, the only difference being the fourth |
---|
4752 | additional argument to define the parametric variables. See the |
---|
4753 | <a href="mp.htm">multiparametric example</a> for details.</td> |
---|
4754 | </tr> |
---|
4755 | <tr> |
---|
4756 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4757 | Related commands</th> |
---|
4758 | </tr> |
---|
4759 | <tr> |
---|
4760 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a>, |
---|
4761 | <a href="reference.htm#set">set</a>, |
---|
4762 | <a href="reference.htm#sdpsettings">sdpsettings</a>, |
---|
4763 | <a href="reference.htm#solvemoment">solvemoment</a>, |
---|
4764 | <a href="#solvesdp">solvesdp</a>, <a href="reference.htm#solvesos"> |
---|
4765 | solvesos</a></td> |
---|
4766 | </tr> |
---|
4767 | </table> |
---|
4768 | </td> |
---|
4769 | </tr> |
---|
4770 | </table> |
---|
4771 | <p> </p> |
---|
4772 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
4773 | <tr> |
---|
4774 | <td class="tableheader"> |
---|
4775 | <p class="tableheader"><a name="solvemoment">SOLVEMOMENT</font></a></p> |
---|
4776 | </td> |
---|
4777 | </tr> |
---|
4778 | <tr> |
---|
4779 | <td> |
---|
4780 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
4781 | <tr> |
---|
4782 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4783 | Syntax<p> </p> |
---|
4784 | </th> |
---|
4785 | <td class="code" valign="top" nowrap width="100%"><code>[sol,xoptimal,momentdata,sos] = solvemoment(F,h,options,d)</code></td> |
---|
4786 | </tr> |
---|
4787 | <tr> |
---|
4788 | <td class="tabxpl"> |
---|
4789 | <table border="0"> |
---|
4790 | <tr> |
---|
4791 | <td> |
---|
4792 | <p align="right"><font face="Courier New" size="2">sol:</font></p> |
---|
4793 | </td> |
---|
4794 | <td>diagnostics structure from solvesdp</td> |
---|
4795 | </tr> |
---|
4796 | <tr> |
---|
4797 | <td> |
---|
4798 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
4799 | </td> |
---|
4800 | <td>set object describing the constraints</td> |
---|
4801 | </tr> |
---|
4802 | <tr> |
---|
4803 | <td> |
---|
4804 | <p align="right"><font face="Courier New">xoptimal</font><font face="Courier New" size="2">:</font></p> |
---|
4805 | </td> |
---|
4806 | <td>Extracted global solutions</td> |
---|
4807 | </tr> |
---|
4808 | <tr> |
---|
4809 | <td> |
---|
4810 | <p align="right"><font face="Courier New">momentdata</font><font face="Courier New" size="2">:</font></p> |
---|
4811 | </td> |
---|
4812 | <td>Moment matrices etc.</td> |
---|
4813 | </tr> |
---|
4814 | <tr> |
---|
4815 | <td> |
---|
4816 | <p align="right"><font face="Courier New">sos</font><font face="Courier New" size="2">:</font></p> |
---|
4817 | </td> |
---|
4818 | <td>Associated sum-of-squares decompositions</td> |
---|
4819 | </tr> |
---|
4820 | <tr> |
---|
4821 | <td> |
---|
4822 | <p align="right"><font face="Courier New" size="2">h:</font></p> |
---|
4823 | </td> |
---|
4824 | <td>sdpvar object describing objective</td> |
---|
4825 | </tr> |
---|
4826 | <tr> |
---|
4827 | <td> |
---|
4828 | <p align="right"><font face="Courier New" size="2">options:</font></p> |
---|
4829 | </td> |
---|
4830 | <td>structure from sdpsettings</td> |
---|
4831 | </tr> |
---|
4832 | <tr> |
---|
4833 | <td> |
---|
4834 | <p align="right"><font face="Courier New" size="2">d:</font></p> |
---|
4835 | </td> |
---|
4836 | <td>integer>0</td> |
---|
4837 | </tr> |
---|
4838 | </table> |
---|
4839 | </td> |
---|
4840 | </tr> |
---|
4841 | <tr> |
---|
4842 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4843 | Description</th> |
---|
4844 | </tr> |
---|
4845 | <tr> |
---|
4846 | <td class="tabxpl">solvemoment computes lower bounds to polynomial |
---|
4847 | programs using Lasserre's moment-method.</td> |
---|
4848 | </tr> |
---|
4849 | <tr> |
---|
4850 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4851 | Examples</th> |
---|
4852 | </tr> |
---|
4853 | <tr> |
---|
4854 | <td class="tabxpl">The command is used for finding lower bounds on |
---|
4855 | a polynomial h(x), subject to constraints F(x), where F(x) is a collection |
---|
4856 | of polynomial inequalities. The following example is taken from [?].<table cellpadding="10" width="100%"> |
---|
4857 | <tr> |
---|
4858 | <td class="xmpcode"> |
---|
4859 | <pre>x1 = sdpvar(1,1);x2 = sdpvar(1,1);x3 = sdpvar(1,1); |
---|
4860 | h = -2*x1+x2-x3; |
---|
4861 | F = set(x1*(4*x1-4*x2+4*x3-20)+x2*(2*x2-2*x3+9)+x3*(2*x3-13)+24>0) |
---|
4862 | F = F + set(4-(x1+x2+x3)>0); |
---|
4863 | F = F + set(6-(3*x2+x3)>0); |
---|
4864 | F = F + set(2-x1>0); |
---|
4865 | F = F + set(3-x3>0); |
---|
4866 | F = F + set(x1>0); |
---|
4867 | F = F + set(x2>0); |
---|
4868 | F = F + set(x3>0); |
---|
4869 | solvemoment(F,h); |
---|
4870 | <font color="#000000">double(h) |
---|
4871 | ans =</font></pre> |
---|
4872 | <pre><font color="#000000"> -6.0000</font></pre> |
---|
4873 | </td> |
---|
4874 | </tr> |
---|
4875 | </table> |
---|
4876 | <p>In the code above, we solved the problem with the lowest possible |
---|
4877 | lifting (decided by YALMIP), and the lower bound turned out to be |
---|
4878 | -6. A higher order relaxation gives better bounds. </p> |
---|
4879 | <table cellpadding="10" width="100%"> |
---|
4880 | <tr> |
---|
4881 | <td class="xmpcode"> |
---|
4882 | <pre>solvemoment(F,h,[],2); |
---|
4883 | double(h) |
---|
4884 | <font color="#000000">ans =</font></pre> |
---|
4885 | <pre><font color="#000000"> -5.69</font> |
---|
4886 | </pre> |
---|
4887 | <pre>solvemoment(F,h,[],3); |
---|
4888 | double(h) |
---|
4889 | <font color="#000000">ans =</font></pre> |
---|
4890 | <pre><font color="#000000"> -4.0685</font> |
---|
4891 | </pre> |
---|
4892 | <pre>solvemoment(F,h,[],4); |
---|
4893 | double(h) |
---|
4894 | <font color="#000000">ans =</font></pre> |
---|
4895 | <pre><font color="#000000"> -4.0000</font></pre> |
---|
4896 | <pre> </pre> |
---|
4897 | <pre> </pre> |
---|
4898 | </td> |
---|
4899 | </tr> |
---|
4900 | </table> |
---|
4901 | <p>For a more complete introduction, please study the extensive |
---|
4902 | <a href="moment.htm">examples</a>.</td> |
---|
4903 | </tr> |
---|
4904 | <tr> |
---|
4905 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4906 | Related commands</th> |
---|
4907 | </tr> |
---|
4908 | <tr> |
---|
4909 | <td class="tabxpl"><a href="reference.htm#solvesdp">solvesdp</a>, |
---|
4910 | <a href="reference.htm#solvesos">solvesos</a>, |
---|
4911 | <a href="reference.htm#sdpvar">sdpvar</a>, |
---|
4912 | <a href="reference.htm#set">set</a></td> |
---|
4913 | </tr> |
---|
4914 | </table> |
---|
4915 | </td> |
---|
4916 | </tr> |
---|
4917 | </table> |
---|
4918 | <p> </p> |
---|
4919 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
4920 | <tr> |
---|
4921 | <td class="tableheader"> |
---|
4922 | <p class="tableheader"><a name="solvesdp">SOLVESDP</font></a></p> |
---|
4923 | </td> |
---|
4924 | </tr> |
---|
4925 | <tr> |
---|
4926 | <td> |
---|
4927 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
4928 | <tr> |
---|
4929 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4930 | Syntax<p> </p> |
---|
4931 | </th> |
---|
4932 | <td class="code" valign="top" nowrap width="100%"><code>diagnostics |
---|
4933 | = solvesdp(F,h,ops)</code></td> |
---|
4934 | </tr> |
---|
4935 | <tr> |
---|
4936 | <td class="tabxpl"> |
---|
4937 | <table border="0"> |
---|
4938 | <tr> |
---|
4939 | <td> |
---|
4940 | <p align="right"><font face="Courier New" size="2">diagnostic:</font></p> |
---|
4941 | </td> |
---|
4942 | <td>Output structure</td> |
---|
4943 | </tr> |
---|
4944 | <tr> |
---|
4945 | <td> |
---|
4946 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
4947 | </td> |
---|
4948 | <td>set object describing the constraints. Can be [].</td> |
---|
4949 | </tr> |
---|
4950 | <tr> |
---|
4951 | <td> |
---|
4952 | <p align="right"><font face="Courier New" size="2">h:</font></p> |
---|
4953 | </td> |
---|
4954 | <td>sdpvar-object describing the objective function. Can be [].</td> |
---|
4955 | </tr> |
---|
4956 | <tr> |
---|
4957 | <td> |
---|
4958 | <p align="right"><font face="Courier New" size="2">ops:</font></p> |
---|
4959 | </td> |
---|
4960 | <td>options structure from sdpsettings. Can be [].</td> |
---|
4961 | </tr> |
---|
4962 | </table> |
---|
4963 | </td> |
---|
4964 | </tr> |
---|
4965 | <tr> |
---|
4966 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4967 | Description</th> |
---|
4968 | </tr> |
---|
4969 | <tr> |
---|
4970 | <td class="tabxpl">solvesdp is the common function for solving all |
---|
4971 | optimization problems.</td> |
---|
4972 | </tr> |
---|
4973 | <tr> |
---|
4974 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
4975 | Examples</th> |
---|
4976 | </tr> |
---|
4977 | <tr> |
---|
4978 | <td class="tabxpl">A linear program <font face="Tahoma"><b>{min c'x |
---|
4979 | </b>subject to<b> Ax<= b}</b></font> can be solved with the following |
---|
4980 | piece of code<table cellpadding="10" width="100%"> |
---|
4981 | <tr> |
---|
4982 | <td class="xmpcode"> |
---|
4983 | <pre>x = sdpvar(length(c),1); |
---|
4984 | F = set(A*x<b) |
---|
4985 | solvesdp(F,c'*x);</pre> |
---|
4986 | </td> |
---|
4987 | </tr> |
---|
4988 | </table> |
---|
4989 | <p>If we only look for a feasible solution, we can omit the objective |
---|
4990 | function </p> |
---|
4991 | <table cellpadding="10" width="100%"> |
---|
4992 | <tr> |
---|
4993 | <td class="xmpcode"> |
---|
4994 | <pre>solvesdp(F);</pre> |
---|
4995 | </td> |
---|
4996 | </tr> |
---|
4997 | </table> |
---|
4998 | <p>Solving the feasibility problem with the solver |
---|
4999 | <a href="solvers.htm#quadprog">QUADPROG</a> can be done with </p> |
---|
5000 | <table cellpadding="10" width="100%"> |
---|
5001 | <tr> |
---|
5002 | <td class="xmpcode"> |
---|
5003 | <pre>solvesdp(F,[],sdpsettings('solver','quadprog'));</pre> |
---|
5004 | </td> |
---|
5005 | </tr> |
---|
5006 | </table> |
---|
5007 | <p>Minimizing an objective function is done by passiing a second argument</p> |
---|
5008 | <table cellpadding="10" width="100%"> |
---|
5009 | <tr> |
---|
5010 | <td class="xmpcode"> |
---|
5011 | <pre>solvesdp(F,sum(x));</pre> |
---|
5012 | </td> |
---|
5013 | </tr> |
---|
5014 | </table> |
---|
5015 | <p>For more examples, run <a href="reference.htm#yalmipdemo">yalmipdemo</a> |
---|
5016 | and check out all the |
---|
5017 | <a target="contents" href="mnl_cnt_examples.htm">examples</a>.</p> |
---|
5018 | </td> |
---|
5019 | </tr> |
---|
5020 | <tr> |
---|
5021 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5022 | Related commands</th> |
---|
5023 | </tr> |
---|
5024 | <tr> |
---|
5025 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a>, |
---|
5026 | <a href="reference.htm#set">set</a>, |
---|
5027 | <a href="reference.htm#logdet">logdet</a>, |
---|
5028 | <a href="reference.htm#sdpsettings">sdpsettings</a>, |
---|
5029 | <a href="reference.htm#solvemoment">solvemoment</a>, |
---|
5030 | <a href="reference.htm#solvemp">solvemp</a>, |
---|
5031 | <a href="reference.htm#solvesos">solvesos</a></td> |
---|
5032 | </tr> |
---|
5033 | </table> |
---|
5034 | </td> |
---|
5035 | </tr> |
---|
5036 | </table> |
---|
5037 | <p> </p> |
---|
5038 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
5039 | <tr> |
---|
5040 | <td class="tableheader"> |
---|
5041 | <p class="tableheader"><a name="solvesos">SOLVESOS</a></p> |
---|
5042 | </td> |
---|
5043 | </tr> |
---|
5044 | <tr> |
---|
5045 | <td> |
---|
5046 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
5047 | <tr> |
---|
5048 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5049 | Syntax<p> </p> |
---|
5050 | </th> |
---|
5051 | <td class="code" valign="top" nowrap width="100%"><code>[sol,m,B] |
---|
5052 | = solvesos(F,h,options,params)</code></td> |
---|
5053 | </tr> |
---|
5054 | <tr> |
---|
5055 | <td class="tabxpl"> |
---|
5056 | <table border="0"> |
---|
5057 | <tr> |
---|
5058 | <td> |
---|
5059 | <p align="right"><font face="Courier New" size="2">sol:</font></p> |
---|
5060 | </td> |
---|
5061 | <td>diagnostics structure from solvesdp</td> |
---|
5062 | </tr> |
---|
5063 | <tr> |
---|
5064 | <td> |
---|
5065 | <p align="right"><font face="Courier New" size="2">m:</font></p> |
---|
5066 | </td> |
---|
5067 | <td>sdpvar object</td> |
---|
5068 | </tr> |
---|
5069 | <tr> |
---|
5070 | <td> |
---|
5071 | <p align="right"><font face="Courier New" size="2">B:</font></p> |
---|
5072 | </td> |
---|
5073 | <td>cell with double</td> |
---|
5074 | </tr> |
---|
5075 | <tr> |
---|
5076 | <td> |
---|
5077 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
5078 | </td> |
---|
5079 | <td>set object (Constraints on parametric variables and SOS constraints)</td> |
---|
5080 | </tr> |
---|
5081 | <tr> |
---|
5082 | <td> |
---|
5083 | <p align="right"><font face="Courier New" size="2">h:</font></p> |
---|
5084 | </td> |
---|
5085 | <td>sdpvar object (Objective function)</td> |
---|
5086 | </tr> |
---|
5087 | <tr> |
---|
5088 | <td> |
---|
5089 | <p align="right"><font face="Courier New" size="2">options:</font></p> |
---|
5090 | </td> |
---|
5091 | <td>structure from sdpsettings</td> |
---|
5092 | </tr> |
---|
5093 | <tr> |
---|
5094 | <td><font face="Courier New" size="2">params:</font></td> |
---|
5095 | <td>sdpvar object (The parametric variables)</td> |
---|
5096 | </tr> |
---|
5097 | </table> |
---|
5098 | </td> |
---|
5099 | </tr> |
---|
5100 | <tr> |
---|
5101 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5102 | Description</th> |
---|
5103 | </tr> |
---|
5104 | <tr> |
---|
5105 | <td class="tabxpl">solvesos calculates SOS (sum-of-squares) decompositions.</td> |
---|
5106 | </tr> |
---|
5107 | <tr> |
---|
5108 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5109 | Examples</th> |
---|
5110 | </tr> |
---|
5111 | <tr> |
---|
5112 | <td class="tabxpl">In its most simple form, |
---|
5113 | <a href="reference.htm#solvesos">solvesos</a> takes a SOS constrained |
---|
5114 | polynomial and calculates the SOS decomposition.<table cellpadding="10" width="100%"> |
---|
5115 | <tr> |
---|
5116 | <td class="xmpcode"> |
---|
5117 | <pre>x = sdpvar(1,1); |
---|
5118 | p = x^4+x+5; |
---|
5119 | F = set(sos(p)); % Constrain p to be a SOS |
---|
5120 | solvesos(F);</pre> |
---|
5121 | </td> |
---|
5122 | </tr> |
---|
5123 | </table> |
---|
5124 | <p>The SOS-decompositions should give <strong>p(x)=v(x)<sup>T</sup>v(x)</strong> |
---|
5125 | </p> |
---|
5126 | <table cellpadding="10" width="100%"> |
---|
5127 | <tr> |
---|
5128 | <td class="xmpcode"> |
---|
5129 | <pre>v = sosd(F); |
---|
5130 | sdisplay(p-v'*v) |
---|
5131 | <font color="#000000">ans = </font></pre> |
---|
5132 | <pre><font color="#000000"> '-1.7764e-015+7.7716e-016x-1.1102e-015x^4'</font></pre> |
---|
5133 | </td> |
---|
5134 | </tr> |
---|
5135 | </table> |
---|
5136 | <p>Obviously, not entirely true. However the coefficients are small |
---|
5137 | and most likely due to numerical inaccuracy. Remove all terms with |
---|
5138 | coeffients smaller than 1e-6 using the command |
---|
5139 | <a href="reference.htm#clean">clean</a> </p> |
---|
5140 | <table cellpadding="10" width="100%"> |
---|
5141 | <tr> |
---|
5142 | <td class="xmpcode"> |
---|
5143 | <pre>sdisplay(clean(p-v'*v,1e-6)) |
---|
5144 | <font color="#000000">ans = |
---|
5145 | '0'</font></pre> |
---|
5146 | </td> |
---|
5147 | </tr> |
---|
5148 | </table> |
---|
5149 | <p>Parameterized SOS problems are also possible. As an example, |
---|
5150 | a lower bound on the global minimum of <b><font face="Tahoma">p</font></b> |
---|
5151 | is obtained by finding a SOS decomposition of <b> |
---|
5152 | <font face="Tahoma">p-t</font></b>, while maximizing <b> |
---|
5153 | <font face="Tahoma">t</font></b>. The full syntax is </p> |
---|
5154 | <table cellpadding="10" width="100%"> |
---|
5155 | <tr> |
---|
5156 | <td class="xmpcode"> |
---|
5157 | <pre>t = sdpvar(1,1); |
---|
5158 | F = set(sos(p-t)); |
---|
5159 | solvesos(F,-t,[],t); |
---|
5160 | double(t) |
---|
5161 | <font color="#000000">ans =</font></pre> |
---|
5162 | <pre><font color="#000000"> 4.5275</font></pre> |
---|
5163 | </td> |
---|
5164 | </tr> |
---|
5165 | </table> |
---|
5166 | <p>Parametric variables (the last argument in the code above) are |
---|
5167 | automatically detected if they are part of the objective function |
---|
5168 | or part of non-SOS constraints. Hence, the problem above can be simplified.</p> |
---|
5169 | <table cellpadding="10" width="100%"> |
---|
5170 | <tr> |
---|
5171 | <td class="xmpcode"> |
---|
5172 | <pre>t = sdpvar(1,1); |
---|
5173 | F = set(sos(p-t)); |
---|
5174 | solvesos(F,-t); |
---|
5175 | double(t) |
---|
5176 | <font color="#000000">ans =</font></pre> |
---|
5177 | <pre><font color="#000000"> 4.5275</font></pre> |
---|
5178 | </td> |
---|
5179 | </tr> |
---|
5180 | </table> |
---|
5181 | <p>For more examples, run <a href="reference.htm#yalmipdemo">yalmipdemo</a> |
---|
5182 | and check out the <a target="contents" href="mnl_cnt_examples.htm"> |
---|
5183 | examples</a> in this manual.</p> |
---|
5184 | </td> |
---|
5185 | </tr> |
---|
5186 | <tr> |
---|
5187 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5188 | Related commands</th> |
---|
5189 | </tr> |
---|
5190 | <tr> |
---|
5191 | <td class="tabxpl"><a href="reference.htm#sdpvar">sdpvar</a>, |
---|
5192 | <a href="reference.htm#solvesdp">solvesdp</a>, |
---|
5193 | <a href="reference.htm#solvemoment">solvemoment</a>, |
---|
5194 | <a href="reference.htm#sdisplay">sdisplay</a>, |
---|
5195 | <a href="reference.htm#clean">clean</a></td> |
---|
5196 | </tr> |
---|
5197 | </table> |
---|
5198 | </td> |
---|
5199 | </tr> |
---|
5200 | </table> |
---|
5201 | <p> </p> |
---|
5202 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
5203 | <tr> |
---|
5204 | <td class="tableheader"> |
---|
5205 | <p class="tableheader"><a name="sos">SOS</a></p> |
---|
5206 | </td> |
---|
5207 | </tr> |
---|
5208 | <tr> |
---|
5209 | <td> |
---|
5210 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
5211 | <tr> |
---|
5212 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5213 | Syntax</th> |
---|
5214 | <td class="code" valign="top" nowrap width="100%"><code>s = sos(p)</code></td> |
---|
5215 | </tr> |
---|
5216 | <tr> |
---|
5217 | <td class="tabxpl"> |
---|
5218 | <table border="0"> |
---|
5219 | <tr> |
---|
5220 | <td> |
---|
5221 | <p align="right">s:</p> |
---|
5222 | </td> |
---|
5223 | <td>sdpvar object (only useful in <a href="reference.htm#lmi"> |
---|
5224 | set</a>)</td> |
---|
5225 | </tr> |
---|
5226 | <tr> |
---|
5227 | <td> |
---|
5228 | <p align="right">p:</p> |
---|
5229 | </td> |
---|
5230 | <td>polynomial scalar sdpvar object</td> |
---|
5231 | </tr> |
---|
5232 | </table> |
---|
5233 | </td> |
---|
5234 | </tr> |
---|
5235 | <tr> |
---|
5236 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5237 | Description</th> |
---|
5238 | </tr> |
---|
5239 | <tr> |
---|
5240 | <td class="tabxpl">sos is used to define sum-of-squares (SOS) constraints</td> |
---|
5241 | </tr> |
---|
5242 | <tr> |
---|
5243 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5244 | Examples</th> |
---|
5245 | </tr> |
---|
5246 | <tr> |
---|
5247 | <td class="tabxpl">Solving a simple SOS problem and extracting the |
---|
5248 | decomposition is done as<table cellpadding="10" width="100%"> |
---|
5249 | <tr> |
---|
5250 | <td class="xmpcode"> |
---|
5251 | <pre>x = sdpvar(1,1); |
---|
5252 | p = x^8+x^7+1; |
---|
5253 | F = set(sos(p)); |
---|
5254 | solvesos(F); |
---|
5255 | sdisplay(sosd(F))</pre> |
---|
5256 | <pre><font color="#000000">ans = </font></pre> |
---|
5257 | <pre><font color="#000000"> '0.12828-0.062411x+0.12427x^2-0.49555x^3-0.99602x^4' |
---|
5258 | '0.99174+0.008073x-0.018071x^2+0.072068x^3+0.089115x^4'</font></pre> |
---|
5259 | </td> |
---|
5260 | </tr> |
---|
5261 | </table> |
---|
5262 | </td> |
---|
5263 | </tr> |
---|
5264 | <tr> |
---|
5265 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5266 | Related commands</th> |
---|
5267 | </tr> |
---|
5268 | <tr> |
---|
5269 | <td class="tabxpl"><a href="reference.htm#solvesos">solvesos</a>, |
---|
5270 | <a href="reference.htm#sdpvar">sdpvar</a>, |
---|
5271 | <a href="reference.htm#sosd">sosd</a></td> |
---|
5272 | </tr> |
---|
5273 | </table> |
---|
5274 | </td> |
---|
5275 | </tr> |
---|
5276 | </table> |
---|
5277 | <p> </p> |
---|
5278 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
5279 | <tr> |
---|
5280 | <td class="tableheader"> |
---|
5281 | <p class="tableheader"><a name="sosd">SOSD</a></p> |
---|
5282 | </td> |
---|
5283 | </tr> |
---|
5284 | <tr> |
---|
5285 | <td> |
---|
5286 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
5287 | <tr> |
---|
5288 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5289 | Syntax</th> |
---|
5290 | <td class="code" valign="top" nowrap width="100%"><code>v = sosd(F)</code></td> |
---|
5291 | </tr> |
---|
5292 | <tr> |
---|
5293 | <td class="tabxpl"> |
---|
5294 | <table border="0"> |
---|
5295 | <tr> |
---|
5296 | <td> |
---|
5297 | <p align="right"><font face="Courier New">v:</font></p> |
---|
5298 | </td> |
---|
5299 | <td>sdpvar object</td> |
---|
5300 | </tr> |
---|
5301 | <tr> |
---|
5302 | <td> |
---|
5303 | <p align="right"><font face="Courier New">F:</font></p> |
---|
5304 | </td> |
---|
5305 | <td>set object with a <a href="reference.htm#sos">sos</a> constraint</td> |
---|
5306 | </tr> |
---|
5307 | </table> |
---|
5308 | </td> |
---|
5309 | </tr> |
---|
5310 | <tr> |
---|
5311 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5312 | Description</th> |
---|
5313 | </tr> |
---|
5314 | <tr> |
---|
5315 | <td class="tabxpl">sosd is used to extract the SOS decomposition from |
---|
5316 | a sum-of-squares (SOS) constraint.</td> |
---|
5317 | </tr> |
---|
5318 | <tr> |
---|
5319 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5320 | Examples</th> |
---|
5321 | </tr> |
---|
5322 | <tr> |
---|
5323 | <td class="tabxpl">Solving a simple SOS problem and extracting the |
---|
5324 | decomposition is done as<table cellpadding="10" width="100%"> |
---|
5325 | <tr> |
---|
5326 | <td class="xmpcode"> |
---|
5327 | <pre>x = sdpvar(1,1); |
---|
5328 | p = x^8+x^7+1; |
---|
5329 | F = set(sos(p)); |
---|
5330 | solvesos(F); |
---|
5331 | sdisplay(sosd(F))</pre> |
---|
5332 | <pre><font color="#000000">ans = </font></pre> |
---|
5333 | <pre><font color="#000000"> '0.12828-0.062411x+0.12427x^2-0.49555x^3-0.99602x^4' |
---|
5334 | '0.99174+0.008073x-0.018071x^2+0.072068x^3+0.089115x^4'</font></pre> |
---|
5335 | </td> |
---|
5336 | </tr> |
---|
5337 | </table> |
---|
5338 | </td> |
---|
5339 | </tr> |
---|
5340 | <tr> |
---|
5341 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5342 | Related commands</th> |
---|
5343 | </tr> |
---|
5344 | <tr> |
---|
5345 | <td class="tabxpl"><a href="reference.htm#solvesos">solvesos</a>, |
---|
5346 | <a href="reference.htm#sdpvar">sdpvar</a>, |
---|
5347 | <a href="reference.htm#sos">sos</a></td> |
---|
5348 | </tr> |
---|
5349 | </table> |
---|
5350 | </td> |
---|
5351 | </tr> |
---|
5352 | </table> |
---|
5353 | <p> </p> |
---|
5354 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
5355 | <tr> |
---|
5356 | <td class="tableheader"> |
---|
5357 | <p class="tableheader"><a name="sparse">SPARSE</font></a></p> |
---|
5358 | </td> |
---|
5359 | </tr> |
---|
5360 | <tr> |
---|
5361 | <td> |
---|
5362 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
5363 | <tr> |
---|
5364 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5365 | Syntax</th> |
---|
5366 | <td class="code" valign="top" nowrap width="100%"><code>x = sparse(i,j,s,n,m)</code></td> |
---|
5367 | </tr> |
---|
5368 | <tr> |
---|
5369 | <td class="tabxpl"> |
---|
5370 | <table border="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0"> |
---|
5371 | <tr> |
---|
5372 | <td> |
---|
5373 | <p align="right"><font face="Courier New" size="2">x:</font></p> |
---|
5374 | </td> |
---|
5375 | <td>sdpvar object</td> |
---|
5376 | </tr> |
---|
5377 | <tr> |
---|
5378 | <td> |
---|
5379 | <p align="right"><font face="Courier New">i</font><font face="Courier New" size="2">:</font></p> |
---|
5380 | </td> |
---|
5381 | <td>double </td> |
---|
5382 | </tr> |
---|
5383 | <tr> |
---|
5384 | <td> |
---|
5385 | <p align="right"><font face="Courier New">j</font><font face="Courier New" size="2">:</font></p> |
---|
5386 | </td> |
---|
5387 | <td>double</td> |
---|
5388 | </tr> |
---|
5389 | <tr> |
---|
5390 | <td> |
---|
5391 | <p align="right"><font face="Courier New">s</font><font face="Courier New" size="2">:</font></p> |
---|
5392 | </td> |
---|
5393 | <td>sdpvar object</td> |
---|
5394 | </tr> |
---|
5395 | <tr> |
---|
5396 | <td> |
---|
5397 | <p align="right"><font face="Courier New">n</font><font face="Courier New" size="2">:</font></p> |
---|
5398 | </td> |
---|
5399 | <td>sdpvar object</td> |
---|
5400 | </tr> |
---|
5401 | <tr> |
---|
5402 | <td><font face="Courier New">m:</font></td> |
---|
5403 | <td>double</td> |
---|
5404 | </tr> |
---|
5405 | </table> |
---|
5406 | </td> |
---|
5407 | </tr> |
---|
5408 | <tr> |
---|
5409 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5410 | Description</th> |
---|
5411 | </tr> |
---|
5412 | <tr> |
---|
5413 | <td class="tabxpl">sparse is used to create <font color="#0000ff"> |
---|
5414 | <a href="reference.htm#sdpvar"> |
---|
5415 | sdpvar</a> </font>objects with a certain structure.</td> |
---|
5416 | </tr> |
---|
5417 | <tr> |
---|
5418 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5419 | Examples</th> |
---|
5420 | </tr> |
---|
5421 | <tr> |
---|
5422 | <td class="tabxpl">Creating a diagonal matrix with every second diagonal |
---|
5423 | element zero can be done as<table cellpadding="10" width="100%"> |
---|
5424 | <tr> |
---|
5425 | <td class="xmpcode"> |
---|
5426 | <pre>x = sparse(1:2:2*n,1:2:2*n,sdpvar(n,1))</pre> |
---|
5427 | </td> |
---|
5428 | </tr> |
---|
5429 | </table> |
---|
5430 | </td> |
---|
5431 | </tr> |
---|
5432 | <tr> |
---|
5433 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5434 | Related commands</th> |
---|
5435 | </tr> |
---|
5436 | <tr> |
---|
5437 | <td class="tabxpl"><a href="reference.htm#sdpvar"> |
---|
5438 | sdpvar</a></td> |
---|
5439 | </tr> |
---|
5440 | </table> |
---|
5441 | </td> |
---|
5442 | </tr> |
---|
5443 | </table> |
---|
5444 | <p> </p> |
---|
5445 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933" id="table60"> |
---|
5446 | <tr> |
---|
5447 | <td class="tableheader"> |
---|
5448 | <p class="tableheader"><a name="unblkdiag">UNBLKDIAG</font></a></p> |
---|
5449 | </td> |
---|
5450 | </tr> |
---|
5451 | <tr> |
---|
5452 | <td> |
---|
5453 | <table cellspacing="0" cellpadding="4" width="100%" border="0" id="table61"> |
---|
5454 | <tr> |
---|
5455 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5456 | Syntax</th> |
---|
5457 | <td class="code" valign="top" nowrap width="100%"><code>F = |
---|
5458 | unblkdiag(X)</code></td> |
---|
5459 | </tr> |
---|
5460 | <tr> |
---|
5461 | <td class="tabxpl"> |
---|
5462 | <table border="0" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0" id="table62"> |
---|
5463 | <tr> |
---|
5464 | <td> |
---|
5465 | <p align="right"><font face="Courier New" size="2">F:</font></p> |
---|
5466 | </td> |
---|
5467 | <td>set object or cell with sdpvar objects</td> |
---|
5468 | </tr> |
---|
5469 | <tr> |
---|
5470 | <td> |
---|
5471 | <p align="right"><font face="Courier New" size="2">X:</font></p> |
---|
5472 | </td> |
---|
5473 | <td>set object </td> |
---|
5474 | </tr> |
---|
5475 | </table> |
---|
5476 | </td> |
---|
5477 | </tr> |
---|
5478 | <tr> |
---|
5479 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5480 | Description</th> |
---|
5481 | </tr> |
---|
5482 | <tr> |
---|
5483 | <td class="tabxpl">unblkdiag is used to detect and extract block |
---|
5484 | diagonal terms.</td> |
---|
5485 | </tr> |
---|
5486 | <tr> |
---|
5487 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5488 | Examples</th> |
---|
5489 | </tr> |
---|
5490 | <tr> |
---|
5491 | <td class="tabxpl">Create a block diagonal matrix<table cellpadding="10" width="100%" id="table63"> |
---|
5492 | <tr> |
---|
5493 | <td class="xmpcode"> |
---|
5494 | <pre>A = sdpvar(2,2); |
---|
5495 | B = sdpvar(3,3); |
---|
5496 | C = diag(sdpvar(3,1)); |
---|
5497 | X = blkdiag(A,B,C);</pre> |
---|
5498 | </td> |
---|
5499 | </tr> |
---|
5500 | </table> |
---|
5501 | <p>Now destroy the block diagonal structure</p> |
---|
5502 | <table cellpadding="10" width="100%" id="table64"> |
---|
5503 | <tr> |
---|
5504 | <td class="xmpcode"> |
---|
5505 | <pre>p = randperm(8); |
---|
5506 | X = X(p,p); |
---|
5507 | spy(X)</pre> |
---|
5508 | </td> |
---|
5509 | </tr> |
---|
5510 | </table> |
---|
5511 | <p>The blocks are easily recovered (note that scalar terms are |
---|
5512 | returned one by one)</p> |
---|
5513 | <table cellpadding="10" width="100%" id="table65"> |
---|
5514 | <tr> |
---|
5515 | <td class="xmpcode"> |
---|
5516 | <pre>blocks = unblkdiag(X) |
---|
5517 | [3x3 sdpvar] [1x1 sdpvar] [2x2 sdpvar] [1x1 sdpvar] [1x1 sdpvar]</pre> |
---|
5518 | </td> |
---|
5519 | </tr> |
---|
5520 | </table> |
---|
5521 | <p>The command is most efficiently used on |
---|
5522 | <a href="reference.htm#set"> |
---|
5523 | set</a> objects (the function will go through all |
---|
5524 | constraints in the <a href="reference.htm#set"> |
---|
5525 | set</a> object and try to detect blocked terms)</p> |
---|
5526 | <table cellpadding="10" width="100%" id="table66"> |
---|
5527 | <tr> |
---|
5528 | <td class="xmpcode"> |
---|
5529 | <pre>F = set(X); |
---|
5530 | F = unblkdiag(F) |
---|
5531 | +++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
5532 | | ID| Constraint| Type| |
---|
5533 | +++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
5534 | | #1| Numeric value| Matrix inequality 3x3| |
---|
5535 | | #2| Numeric value| Matrix inequality 2x2| |
---|
5536 | | #3| Numeric value| Element-wise 3x1| |
---|
5537 | +++++++++++++++++++++++++++++++++++++++++++++++++</pre> |
---|
5538 | </td> |
---|
5539 | </tr> |
---|
5540 | </table> |
---|
5541 | </td> |
---|
5542 | </tr> |
---|
5543 | <tr> |
---|
5544 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5545 | Related commands</th> |
---|
5546 | </tr> |
---|
5547 | <tr> |
---|
5548 | <td class="tabxpl"> <a href="reference.htm#sdpvar"> |
---|
5549 | sdpvar</a>, <a href="reference.htm#dissect"> |
---|
5550 | dissect</a></td> |
---|
5551 | </tr> |
---|
5552 | </table> |
---|
5553 | </td> |
---|
5554 | </tr> |
---|
5555 | </table> |
---|
5556 | <p> </p> |
---|
5557 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
5558 | <tr> |
---|
5559 | <td class="tableheader"> |
---|
5560 | <p class="tableheader"><a name="yalmip">YALMIP</a></p> |
---|
5561 | </td> |
---|
5562 | </tr> |
---|
5563 | <tr> |
---|
5564 | <td> |
---|
5565 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
5566 | <tr> |
---|
5567 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5568 | Syntax</th> |
---|
5569 | <td class="code" valign="top" nowrap width="100%"><code>yalmip(command)</code></td> |
---|
5570 | </tr> |
---|
5571 | <tr> |
---|
5572 | <td class="tabxpl"> |
---|
5573 | <table border="0"> |
---|
5574 | <tr> |
---|
5575 | <td><font face="Courier New">command</font><font face="Courier New" size="2">:</font></td> |
---|
5576 | <td>char {'clear','info','version'}</td> |
---|
5577 | </tr> |
---|
5578 | </table> |
---|
5579 | </td> |
---|
5580 | </tr> |
---|
5581 | <tr> |
---|
5582 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5583 | Description</th> |
---|
5584 | </tr> |
---|
5585 | <tr> |
---|
5586 | <td class="tabxpl">yalmip can be used to perform some adminstrative |
---|
5587 | stuff.</td> |
---|
5588 | </tr> |
---|
5589 | <tr> |
---|
5590 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5591 | Examples</th> |
---|
5592 | </tr> |
---|
5593 | <tr> |
---|
5594 | <td class="tabxpl">To clear the internals of YALMIP<table cellpadding="10" width="100%"> |
---|
5595 | <tr> |
---|
5596 | <td class="xmpcode"> |
---|
5597 | <pre>yalmip('clear')</pre> |
---|
5598 | </td> |
---|
5599 | </tr> |
---|
5600 | </table> |
---|
5601 | <p>Version number and release-date can be obtained</p> |
---|
5602 | <table cellpadding="10" width="100%"> |
---|
5603 | <tr> |
---|
5604 | <td class="xmpcode"> |
---|
5605 | <pre>[vernum,reldate] = yalmip('version');</pre> |
---|
5606 | </td> |
---|
5607 | </tr> |
---|
5608 | </table> |
---|
5609 | <p>Additional information can be displayed using the 'info' tag</p> |
---|
5610 | <table cellpadding="10" width="100%"> |
---|
5611 | <tr> |
---|
5612 | <td class="xmpcode"> |
---|
5613 | <pre>ver = yalmip('info') |
---|
5614 | <font color="#000000">********************************** |
---|
5615 | - - - - YALMIP 3 - - - - - - - - - |
---|
5616 | ********************************** |
---|
5617 | |
---|
5618 | Variable Size |
---|
5619 | No SDPVAR objects found |
---|
5620 | |
---|
5621 | SET |
---|
5622 | No SET objects found</font> |
---|
5623 | </pre> |
---|
5624 | </td> |
---|
5625 | </tr> |
---|
5626 | </table> |
---|
5627 | </td> |
---|
5628 | </tr> |
---|
5629 | <tr> |
---|
5630 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5631 | Related commands</th> |
---|
5632 | </tr> |
---|
5633 | <tr> |
---|
5634 | <td class="tabxpl"><a href="reference.htm#sdpsettings">sdpsettings</a></td> |
---|
5635 | </tr> |
---|
5636 | </table> |
---|
5637 | </td> |
---|
5638 | </tr> |
---|
5639 | </table> |
---|
5640 | <p> </p> |
---|
5641 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
5642 | <tr> |
---|
5643 | <td class="tableheader"> |
---|
5644 | <p class="tableheader"><a name="yalmipdemo">YALMIPDEMO</font></a></p> |
---|
5645 | </td> |
---|
5646 | </tr> |
---|
5647 | <tr> |
---|
5648 | <td> |
---|
5649 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
5650 | <tr> |
---|
5651 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> </th> |
---|
5652 | <td class="code" valign="top" nowrap width="100%"><code>yalmipdemo</code></td> |
---|
5653 | </tr> |
---|
5654 | <tr> |
---|
5655 | <td class="tabxpl"> </td> |
---|
5656 | </tr> |
---|
5657 | <tr> |
---|
5658 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5659 | Description</th> |
---|
5660 | </tr> |
---|
5661 | <tr> |
---|
5662 | <td class="tabxpl">yalmipdemo runs a set of tutorial problems</td> |
---|
5663 | </tr> |
---|
5664 | <tr> |
---|
5665 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5666 | Examples</th> |
---|
5667 | </tr> |
---|
5668 | <tr> |
---|
5669 | <td class="tabxpl">To start the tutorial<table cellpadding="10" width="100%"> |
---|
5670 | <tr> |
---|
5671 | <td class="xmpcode"> |
---|
5672 | <pre>yalmipdemo</pre> |
---|
5673 | </td> |
---|
5674 | </tr> |
---|
5675 | </table> |
---|
5676 | </td> |
---|
5677 | </tr> |
---|
5678 | <tr> |
---|
5679 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5680 | Related commands</th> |
---|
5681 | </tr> |
---|
5682 | <tr> |
---|
5683 | <td class="tabxpl"><a href="#yalmiptest">yalmiptest</a></td> |
---|
5684 | </tr> |
---|
5685 | </table> |
---|
5686 | </td> |
---|
5687 | </tr> |
---|
5688 | </table> |
---|
5689 | <p> </p> |
---|
5690 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
5691 | <tr> |
---|
5692 | <td class="tableheader"> |
---|
5693 | <p class="tableheader"><a name="yalmiperror">YALMIPERROR</a></p> |
---|
5694 | </td> |
---|
5695 | </tr> |
---|
5696 | <tr> |
---|
5697 | <td> |
---|
5698 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
5699 | <tr> |
---|
5700 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5701 | Syntax</th> |
---|
5702 | <td class="code" valign="top" nowrap width="100%"><code>yalmiperror(x)</code></td> |
---|
5703 | </tr> |
---|
5704 | <tr> |
---|
5705 | <td class="tabxpl"> |
---|
5706 | <table border="0"> |
---|
5707 | <tr> |
---|
5708 | <td><font face="Courier New" size="2">x:</font></td> |
---|
5709 | <td>double</td> |
---|
5710 | </tr> |
---|
5711 | </table> |
---|
5712 | </td> |
---|
5713 | </tr> |
---|
5714 | <tr> |
---|
5715 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5716 | Description</th> |
---|
5717 | </tr> |
---|
5718 | <tr> |
---|
5719 | <td class="tabxpl">yalmiperror returns the error-text for a error-code.</td> |
---|
5720 | </tr> |
---|
5721 | <tr> |
---|
5722 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5723 | Examples</th> |
---|
5724 | </tr> |
---|
5725 | <tr> |
---|
5726 | <td class="tabxpl">To se all available error codes,<table cellpadding="10" width="100%"> |
---|
5727 | <tr> |
---|
5728 | <td class="xmpcode"> |
---|
5729 | <pre>yalmiperror |
---|
5730 | |
---|
5731 | <font color="#000000"> Error codes |
---|
5732 | |
---|
5733 | -5 License problems in solver |
---|
5734 | -4 Solver not applicable |
---|
5735 | -3 Solver not found |
---|
5736 | -2 No suitable solver |
---|
5737 | -1 Unknown error |
---|
5738 | 0 No problems detected |
---|
5739 | 1 Infeasible problem |
---|
5740 | 2 Unbounded objective function |
---|
5741 | 3 Maximum iterations exceeded |
---|
5742 | 4 Numerical problems |
---|
5743 | 5 Lack of progress |
---|
5744 | 6 Initial solution infeasible |
---|
5745 | 7 YALMIP sent incorrect input to solver |
---|
5746 | 8 Feasibility cannot be determined |
---|
5747 | 9 Unknown problem in solver |
---|
5748 | 10 bigM failed (increase sp.Mfactor) |
---|
5749 | 11 Other identified error |
---|
5750 | 12 Infeasible or unbounded |
---|
5751 | 13 YALMIP cannot determine status in solver</font></pre> |
---|
5752 | </td> |
---|
5753 | </tr> |
---|
5754 | </table> |
---|
5755 | <p>To see a particular error message, </p> |
---|
5756 | <table cellpadding="10" width="100%"> |
---|
5757 | <tr> |
---|
5758 | <td class="xmpcode"> |
---|
5759 | <pre>yalmiperror(3) |
---|
5760 | <font color="#000000"> ans =</font></pre> |
---|
5761 | <pre><font color="#000000"> Maximum iterations exceeded</font> </pre> |
---|
5762 | </td> |
---|
5763 | </tr> |
---|
5764 | </table> |
---|
5765 | </td> |
---|
5766 | </tr> |
---|
5767 | <tr> |
---|
5768 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5769 | Related commands</th> |
---|
5770 | </tr> |
---|
5771 | <tr> |
---|
5772 | <td class="tabxpl"><a href="reference.htm#solvesdp">solvesdp</a></td> |
---|
5773 | </tr> |
---|
5774 | </table> |
---|
5775 | </td> |
---|
5776 | </tr> |
---|
5777 | </table> |
---|
5778 | <p> </p> |
---|
5779 | <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933"> |
---|
5780 | <tr> |
---|
5781 | <td class="tableheader"> |
---|
5782 | <p class="tableheader"><a name="yalmiptest">YALMIPTEST</a></p> |
---|
5783 | </td> |
---|
5784 | </tr> |
---|
5785 | <tr> |
---|
5786 | <td> |
---|
5787 | <table cellspacing="0" cellpadding="4" width="100%" border="0"> |
---|
5788 | <tr> |
---|
5789 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5790 | Syntax</th> |
---|
5791 | <td class="code" valign="top" nowrap width="100%"><code>yalmiptest(ops)</code></td> |
---|
5792 | </tr> |
---|
5793 | <tr> |
---|
5794 | <td class="tabxpl"> |
---|
5795 | <table border="0"> |
---|
5796 | <tr> |
---|
5797 | <td><font face="Courier New" size="2">ops:</font></td> |
---|
5798 | <td>sdpsettings structure</td> |
---|
5799 | </tr> |
---|
5800 | </table> |
---|
5801 | </td> |
---|
5802 | </tr> |
---|
5803 | <tr> |
---|
5804 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5805 | Description</th> |
---|
5806 | </tr> |
---|
5807 | <tr> |
---|
5808 | <td class="tabxpl">yalmiptest runs a set of test examples to test |
---|
5809 | the installation</td> |
---|
5810 | </tr> |
---|
5811 | <tr> |
---|
5812 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5813 | Examples</th> |
---|
5814 | </tr> |
---|
5815 | <tr> |
---|
5816 | <td class="tabxpl">To test the default installation<table cellpadding="10" width="100%"> |
---|
5817 | <tr> |
---|
5818 | <td class="xmpcode"> |
---|
5819 | <pre>yalmiptest</pre> |
---|
5820 | </td> |
---|
5821 | </tr> |
---|
5822 | </table> |
---|
5823 | <p>To test a particular solver </p> |
---|
5824 | <table cellpadding="10" width="100%"> |
---|
5825 | <tr> |
---|
5826 | <td class="xmpcode"> |
---|
5827 | <pre>yalmiptest(sdpsettings('solver','sdpt3'))</pre> |
---|
5828 | </td> |
---|
5829 | </tr> |
---|
5830 | </table> |
---|
5831 | </td> |
---|
5832 | </tr> |
---|
5833 | <tr> |
---|
5834 | <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2"> |
---|
5835 | Related commands</th> |
---|
5836 | </tr> |
---|
5837 | <tr> |
---|
5838 | <td class="tabxpl"><a href="reference.htm#sdpsettings">sdpsettings</a></td> |
---|
5839 | </tr> |
---|
5840 | </table> |
---|
5841 | </td> |
---|
5842 | </tr> |
---|
5843 | </table> |
---|
5844 | <p> </p> |
---|
5845 | <p> </p> |
---|
5846 | <p> </p> |
---|
5847 | <p> </p> |
---|
5848 | <p> </p> |
---|
5849 | <p> </p> |
---|
5850 | <p> </p> |
---|
5851 | <p> </p> |
---|
5852 | <p> </p> |
---|
5853 | <p> </p> |
---|
5854 | <p> </p> |
---|
5855 | <p> </p> |
---|
5856 | <p> </p> |
---|
5857 | <p> </p> |
---|
5858 | <p> </p> |
---|
5859 | <p> </p> |
---|
5860 | <p> </p> |
---|
5861 | <p> </p> |
---|
5862 | <p> </p> |
---|
5863 | </td> |
---|
5864 | </tr> |
---|
5865 | </table> |
---|
5866 | </div> |
---|
5867 | |
---|
5868 | </body> |
---|
5869 | |
---|
5870 | </html> |
---|