source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/htmldata/impexp.htm @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 6.1 KB
Line 
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 Example : Efficient solution of KYP problems</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 leftMargin="0" topMargin="0">
15
16<div align="left">
17  <table border="0" cellpadding="4" cellspacing="3" style="border-collapse: collapse" bordercolor="#000000" width="100%" align="left" height="100%">
18    <tr>
19      <td width="100%" align="left" height="100%" valign="top">
20      <h2>Saving &amp; and loading</h2>
21      <hr noShade SIZE="1">
22      <p>The most efficient and safe way to save and communicate YALMIP models
23                is to work with the MATLAB script, i.e. the YALMIP code. In some cases
24                however, it might be necessary to use binary or other formats.
25                Additionally, there might be cases where a YALMIP model needs to be
26                converted to a solver specific numerical model.</p>
27                <h3>Loading &amp; saving in binary MATLAB format</h3>
28                <p>The objects in YALMIP all support loading and saving, hence it is
29                possible to save a model in a binary MATLAB format.</p>
30      <table cellPadding="10" width="100%">
31        <tr>
32          <td class="xmpcode">
33          <pre>A = randn(3);
34P = sdpvar(3,3);
35F = set(A'*P+P*A &lt; -eye(3));
36obj = trace(P);</pre>
37                        <pre>save mymodel</pre>
38                        <pre>clear all;
39load mymodel
40
41F
42<font color="#000000">+++++++++++++++++++++++++++++++++++++++++++++++++
43|   ID|      Constraint|                    Type|
44+++++++++++++++++++++++++++++++++++++++++++++++++
45|   #1|   Numeric value|   Matrix inequality 3x3|
46+++++++++++++++++++++++++++++++++++++++++++++++++</font>
47obj
48<font color="#000000">Linear scalar (real, 3 variables)</font></pre>
49          </td>
50        </tr>
51      </table>
52      <p>Note that loading a YALMIP model will destroy any
53              <a href="reference.htm#sdpvar">sdpvar</a> and
54              <a href="reference.htm#set">set</a> object in the current
55                workspace. The binary data format is not recommended, and the reason is three-fold. The first reason is
56                incompatibility between different MATLAB version, the second reason is
57                possible incompatibility between different YALMIP versions, and finally
58                that the binary format in YALMIP currently is inefficient for
59                large-scale problems.</p>
60                <h3>Loading &amp; saving in SDPA sparse ASCII format</h3>
61                <p>The leading format to communicate standard linear SDP problems in a
62                platform and application independent way is the
63                <a target="_blank" href="http://infohost.nmt.edu/~sdplib/FORMAT">sparse
64                SDPA format</a>. YALMIP can both save and load models in this format.</p>
65      <table cellPadding="10" width="100%" id="table1">
66        <tr>
67          <td class="xmpcode">
68          <pre>A = randn(3);
69P = sdpvar(3,3);
70F = set(A'*P+P*A &lt; -eye(3));
71obj = trace(P);</pre>
72                        <pre>savesdpafile(F,obj,'mymodel.dat-s');</pre>
73                        <pre>clear all;
74[F,obj] = loadsdpafile('mymodel.dat-s');
75
76F
77<font color="#000000">+++++++++++++++++++++++++++++++++++++++++++++++++
78|   ID|      Constraint|                    Type|
79+++++++++++++++++++++++++++++++++++++++++++++++++
80|   #1|   Numeric value|   Matrix inequality 3x3|
81+++++++++++++++++++++++++++++++++++++++++++++++++</font>
82obj
83<font color="#000000">Linear scalar (real, 3 variables)</font></pre>
84          </td>
85        </tr>
86      </table>
87      <p>The SDPA format is limited to standard linear SDP problems (without
88                equality constraints), hence many YALMIP models cannot be saved in this
89                format. </p>
90      <h3>Exporting solver specific models</h3>
91                <p>YALMIP can be used to extract the numerical model in various solver
92                specific formats. This can be done along during a call to the solver,
93                but also without explicitly invoking the solver. To export the solver
94                while solving the problem, we use the <code>savesolverinput</code> option.<table cellPadding="10" width="100%" id="table2">
95        <tr>
96          <td class="xmpcode">
97          <pre>A = randn(3);
98P = sdpvar(3,3);
99F = set(A'*P+P*A &lt; -eye(3));
100obj = trace(P);
101sol = solvesdp(F,obj,sdpsettings('solver','sedumi','savesolverinput',1));
102sol.solverinput
103<font color="#000000">ans = </font></pre>
104                        <pre><font color="#000000">       A: [9x6 double]
105       c: [9x1 double]
106       b: [6x1 double]
107       K: [1x1 struct]
108    pars: [1x1 struct]</font></pre>
109          </td>
110        </tr>
111      </table>
112      <p>To export the model with actually calling the solver, use
113              <a href="reference.htm#export">export</a>.</p>
114      <table cellPadding="10" width="100%" id="table3">
115        <tr>
116          <td class="xmpcode">
117          <pre>A = randn(3);
118P = sdpvar(3,3);
119F = set(A'*P+P*A &lt; -eye(3));
120obj = trace(P);
121mdl = export(F,obj,sdpsettings('solver','sedumi'));
122mdl</pre>
123          </td>
124        </tr>
125      </table>
126      <p>All solvers are currently not supported in
127              <a href="reference.htm#export">export</a>. If you miss
128                support for some solver, please make a feature request.<h3>Saving AMPL
129                models<br>
130                </h3>A
131                rudimentary support for exporting models in
132                <a target="_blank" href="http://www.ampl.com/">AMPL</a> format is
133                available. This functionality is mainly intended for small nonlinear or
134                mixed integer programs, and was only implemented in order to save one
135                particular problem. If you are interested in a better support, make a
136                feature request.<table cellPadding="10" width="100%" id="table4">
137        <tr>
138          <td class="xmpcode">
139          <pre>sdpvar a b c
140F = set(a+b^2 &lt; c*pi) + set(integer(b)) + set(a+b==3);
141obj = a*b*c;
142saveampl(F,obj,'mymodel.mod')
143type mymodel</pre>
144                        <pre><font color="#000000">var x {1..2};
145var z {1..1} integer ;
146minimize obj:  x[1]*z[1]*x[2];
147subject to constr1: 0 &lt;= -x[1]+x[2]-z[1]^2;
148subject to constr2: 0 == 3-x[1]-z[1];
149solve;
150display x;
151display z;
152display obj;</font></pre>
153          </td>
154        </tr>
155      </table>
156      </td>
157    </tr>
158  </table>
159</div>
160
161</body>
162
163</html>
Note: See TracBrowser for help on using the repository browser.