Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121324176
regularized_norm_tradeoff.html
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jul 10, 01:46
Size
2 KB
Mime Type
text/html
Expires
Sat, Jul 12, 01:46 (2 d)
Engine
blob
Format
Raw Data
Handle
27284726
Attached To
R1252 EMPoWER
regularized_norm_tradeoff.html
View Options
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Builds a norm minimization tradeoff curve</title>
<link rel="canonical" href="http://cvxr.com/cvx/examples/html/regularized_norm_tradeoff.html">
<link rel="stylesheet" href="../examples.css" type="text/css">
</head>
<body>
<div id="header">
<h1>Builds a norm minimization tradeoff curve</h1>
Jump to:
<a href="#source">Source code</a>
<a href="#output">Text output</a>
<a href="#plots">Plots</a>
<a href="../index.html">Library index</a>
</div>
<div id="content">
<a id="source"></a>
<pre class="codeinput">
<span class="comment">% This script solves a family of problems of the form</span>
<span class="comment">% minimize || A*x-b ||_1 + gamma * || x ||_Inf</span>
<span class="comment">% for varying values of gamma. For gamma = 0, this is simply an</span>
<span class="comment">% unconstrained norm minimization; for gamma = Inf, x = 0 and</span>
<span class="comment">% || A x - b || = || b || are optimal. Varying gamma allows us</span>
<span class="comment">% to genreate a tradeoff curve between these extremes.</span>
n = 10;
A = randn(2*n,n);
b = randn(2*n,1);
gamma = logspace( -1, 3 );
nrms = zeros( size( gamma ) );
xnrms = zeros( size( gamma ) );
fprintf( 1, <span class="string">'Gamma: '</span> );
<span class="keyword">for</span> k = 1 : length( gamma ),
<span class="keyword">if</span> k > 1 & rem( k, 10 ) == 1, fprintf( 1, <span class="string">'\n '</span> ); <span class="keyword">end</span>
fprintf( 1, <span class="string">'%g '</span>, gamma( k ) );
cvx_begin <span class="string">quiet</span>
variable <span class="string">x(n)</span>
minimize( norm( A * x - b, 1 ) + gamma( k ) * norm( x, Inf ) )
cvx_end
nrms( k ) = norm( A * x - b, 1 );
xnrms( k ) = norm( x, Inf );
<span class="keyword">end</span>
fprintf( 1, <span class="string">'done.\n'</span> );
figure
semilogx( gamma, nrms );
xlabel( <span class="string">'\gamma'</span> );
ylabel( <span class="string">'|| A * x - b ||_1'</span> );
figure
plot( xnrms, nrms );
xlabel( <span class="string">'|| x ||_{\infty}'</span> );
ylabel( <span class="string">'|| A * x - b ||_1'</span> );
</pre>
<a id="output"></a>
<pre class="codeoutput">
Gamma: 0.1 0.120679 0.145635 0.175751 0.212095 0.255955 0.308884 0.372759 0.449843 0.542868
0.655129 0.790604 0.954095 1.1514 1.3895 1.67683 2.02359 2.44205 2.94705 3.55648
4.29193 5.17947 6.25055 7.54312 9.10298 10.9854 13.2571 15.9986 19.307 23.2995
28.1177 33.9322 40.9492 49.4171 59.6362 71.9686 86.8511 104.811 126.486 152.642
184.207 222.3 268.27 323.746 390.694 471.487 568.987 686.649 828.643 1000 done.
</pre>
<a id="plots"></a>
<div id="plotoutput">
<img src="regularized_norm_tradeoff__01.png" alt=""> <img src="regularized_norm_tradeoff__02.png" alt="">
</div>
</div>
</body>
</html>
Event Timeline
Log In to Comment