⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reference.htm

📁 optimization toolbox
💻 HTM
📖 第 1 页 / 共 5 页
字号:
              <p>Giving a second argument controls what variables to differentiate 
              with respect to </p>
              <table cellpadding="10" width="100%" id="table80">
                <tr>
                  <td class="xmpcode">
                  <pre>sdisplay(hessian(f,x1))
<font color="#000000">ans = </font></pre>
                  <pre><font color="#000000">    &#39;12x1^2&#39;</font></pre>
                  </td>
                </tr>
              </table>
              </td>
            </tr>
            <tr>
              <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2">
              Related commands</th>
            </tr>
            <tr>
              <td class="tabxpl"><a href="reference.htm#jacobian">jacobian</a>,
              <a href="reference.htm#sdisplay">sdisplay</a>,
              <a href="reference.htm#sdpvar">sdpvar</a></td>
            </tr>
          </table>
          </td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933">
        <tr>
          <td class="tableheader">
          <p class="tableheader"><a name="dual">DUAL</a></p>
          </td>
        </tr>
        <tr>
          <td>
          <table cellspacing="0" cellpadding="4" width="100%" border="0">
            <tr>
              <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2">
              Syntax</th>
              <td class="code" valign="top" nowrap width="100%"><code>Z = dual(F)</code></td>
            </tr>
            <tr>
              <td class="tabxpl">
              <table border="0">
                <tr>
                  <td>
                  <p align="right"><font face="Courier New" size="2">Z:</font></p>
                  </td>
                  <td>double</td>
                </tr>
                <tr>
                  <td>
                  <p align="right"><font face="Courier New" size="2">F:</font></p>
                  </td>
                  <td>set object (with one constraint)</td>
                </tr>
              </table>
              </td>
            </tr>
            <tr>
              <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2">
              Description</th>
            </tr>
            <tr>
              <td class="tabxpl">dual is used to extract the dual variable related 
              to a constraint</td>
            </tr>
            <tr>
              <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2">
              Examples</th>
            </tr>
            <tr>
              <td class="tabxpl"><p>After solving an optimization problem we might, 
              e.g., extract the dual variable of the 2nd constraint.</p><table cellpadding="10" width="100%">
                <tr>
                  <td class="xmpcode">
                  <pre>solvesdp(F,obj);
Z2 = dual(F(2));</pre>
                  </td>
                </tr>
              </table>
              <p>If the constraints in the set object have been tagged, we can use 
              the tag instead </p>
              <table cellpadding="10" width="100%">
                <tr>
                  <td class="xmpcode">
                  <pre>solvesdp(F,obj);
Z2 = dual(F(&#39;Lyapunov constraint&#39;));</pre>
                  </td>
                </tr>
              </table>
              </td>
            </tr>
            <tr>
              <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2">
              Related commands</th>
            </tr>
            <tr>
              <td class="tabxpl"><a href="reference.htm#set">set</a>,
              <a href="reference.htm#solvesdp">solvesdp</a>,
              <a href="reference.htm#sdpvar">sdpvar</a></td>
            </tr>
          </table>
          </td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933">
        <tr>
          <td class="tableheader">
          <p class="tableheader"><a name="dualize">DUALIZE</a></p>
          </td>
        </tr>
        <tr>
          <td>
          <table cellspacing="0" cellpadding="4" width="100%" border="0">
            <tr>
              <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2">
              Syntax</th>
              <td class="code" valign="top" nowrap width="100%"><code>
              [Fd,objd,X,free] = dualize(F,obj)</code></td>
            </tr>
            <tr>
              <td class="tabxpl">
              <table border="0">
                <tr>
                  <td>
                  <p align="right"><font face="Courier New" size="2">F:</font></p>
                  </td>
                  <td>set object in primal SDP form</td>
                </tr>
                <tr>
                  <td>
                  <p align="right"><font face="Courier New" size="2">obj:</font></p>
                  </td>
                  <td>sdpvar object (primal cost)</td>
                </tr>
                <tr>
                  <td>
                  <p align="right"><font face="Courier New" size="2">Fd:</font></p>
                  </td>
                  <td>set object in dual SDP form</td>
                </tr>
                <tr>
                  <td>
                  <p align="right"><font face="Courier New">objd</font><font face="Courier New" size="2">:</font></p>
                  </td>
                  <td>sdpvar object (dual cost)</td>
                </tr>
                <tr>
                  <td>
                  <p align="right"><font face="Courier New" size="2">X:</font></p>
                  </td>
                  <td>cell of sdpvar object (primal cone variables)</td>
                </tr>
                <tr>
                  <td>
                  <p align="right"><font face="Courier New" size="2">free:</font></p>
                  </td>
                  <td>sdpvar objects (free primal variables)</td>
                </tr>
              </table>
              </td>
            </tr>
            <tr>
              <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2">
              Description</th>
            </tr>
            <tr>
              <td class="tabxpl">dualize is used to convert a SDP problem given 
              in primal form to the corresponding dual problem.</td>
            </tr>
            <tr>
              <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2">
              Examples</th>
            </tr>
            <tr>
              <td class="tabxpl">Consider the following SDP problem in primal 
              form.<table cellpadding="10" width="100%">
                <tr>
                  <td class="xmpcode">
                  <pre>X = sdpvar(3,3);
Y = sdpvar(3,3);
F = set(X&gt;0) + set(Y&gt;0);
F = F + set(X(1,3)==9) + set(Y(1,1)==X(2,2));
F = F + set(sum(sum(X))+sum(sum(Y)) == 20);
obj = trace(X)+trace(Y);</pre>
                  </td>
                </tr>
              </table>
              <p>We can solve this in the given format. This will however be 
              very inefficient in YALMIP, since the matrices X and Y will be 
              explicitely parameterized, and the problem will be solved in a 
              dual form with equality constraints. Instead, we note that the 
              problem is an SDP in standard primal form. We therefor let YALMIP 
              extract this primal model, and return the dual of this. If we 
              solve this problem, the dual of this will be the original primal. 
              Confused yet? (note that the dual objective should be maximized)</p>
              <table cellpadding="10" width="100%">
                <tr>
                  <td class="xmpcode">
                  <pre>[Fd,objd,XX,y] = dualize(F,obj);
solvesdp(Fd,-objd);</pre>
                  </td>
                </tr>
              </table>
              <p>To obtain our original variables, we extract the duals</p>
              <table cellpadding="10" width="100%">
                <tr>
                  <td class="xmpcode">
                  <pre>assign(XX{1},dual(Fd(1));
assign(XX{2},dual(Fd(2));</pre>
                  </td>
                </tr>
              </table>
              <p>Check out the tutorial for more <a href="dual.htm#dualize">
				examples</a></td>
            </tr>
            <tr>
              <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2">
              Related commands</th>
            </tr>
            <tr>
              <td class="tabxpl">
              <a href="reference.htm#dual">dual</a>,
              <a href="reference.htm#set">set</a>,
              <a href="reference.htm#solvesdp">solvesdp</a>,
              <a href="reference.htm#sdpvar">sdpvar</a></td>
            </tr>
          </table>
          </td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bordercolor="#FF9933">
        <tr>
          <td class="tableheader">
          <p class="tableheader"><a name="export">EXPORT</font></a></p>
          </td>
        </tr>
        <tr>
          <td>
          <table cellspacing="0" cellpadding="4" width="100%" border="0">
            <tr>
              <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2">
              Syntax<p>&nbsp;</p>
              </th>
              <td class="code" valign="top" nowrap width="100%"><code>[model,recoverymodel] 
              = export(F,h,ops)</code></td>
            </tr>
            <tr>
              <td class="tabxpl">
              <table border="0">
                <tr>
                  <td>
                  <p align="right"><font face="Courier New" size="2">model:</font></p>
                  </td>
                  <td>Output structure.</td>
                </tr>
                <tr>
                  <td>
                  <font face="Courier New" size="2">recoverymodel:</font></td>
                  <td>Output structure.</td>
                </tr>
                <tr>
                  <td>
                  <p align="right"><font face="Courier New" size="2">F:</font></p>
                  </td>
                  <td>set object describing the constraints. </td>
                </tr>
                <tr>
                  <td>
                  <p align="right"><font face="Courier New" size="2">h:</font></p>
                  </td>
                  <td>sdpvar-object describing the objective function.</td>
                </tr>
                <tr>
                  <td>
                  <p align="right"><font face="Courier New" size="2">ops:</font></p>
                  </td>
                  <td>options structure from sdpsettings.</td>
                </tr>
              </table>
              </td>
            </tr>
            <tr>
              <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2">
              Description</th>
            </tr>
            <tr>
              <td class="tabxpl">export is used to export YALMIP models to 
              various solver formats (<font color="#FF0000">note : not all 
              solvers are supported yet</font>)</td>
            </tr>
            <tr>
              <th class="doc" valign="top" nowrap align="left" bgcolor="#eeeeee" rowspan="2">
              Examples</th>
            </tr>
            <tr>
              <td class="tabxpl"><p>Consider a Lyapunov stability problem</p><table cellpadding="10" width="100%">
                <tr>
                  <td class="xmpcode">
                  <pre>A = randn(5,5);A = -A*A';
P = sdpvar(5,5);
F = set(A'*P+P*A &lt; 0) + set(P&gt;eye(5));
obj = trace(P);</pre>
                  </td>
                </tr>
              </table>
              <p>Exporting this to a model in SeDuMi format is done by 
              specifying the solver as <code>'sedumi'</code> and calling export in the same way 
              as <a href="reference.htm#solvesdp">solvesdp</a> would have ben called.</p>
              <table cellpadding="10" width="100%">
                <tr>
                  <td class="xmpcode">
                  <pre>[model,recoverymodel] = export(F,obj,sdpsettings('solver','sedumi'));</pre>
                  <pre><font color="#000000">model = </font></pre>
                  <pre><font color="#000000">       A: [50x15 double]
       b: [15x1 double]
       C: [50x1 double]
       K: [1x1 struct]
    pars: [1x1 struct]</font></pre>
                  </td>
                </tr>
              </table>
              <p>The data in <code>recoverymodel</code> can be used to relate a solution 
              obtained from using the exported model, to the actual variables in 
              YALMIP. </p>
              <table cellpadding="10" width="100%">
                <tr>
                  <td class="xm

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -