Created
July 11, 2017 18:34
-
-
Save cshjin/0257f0b4f02a2dadd4bd30de851b4ac4 to your computer and use it in GitHub Desktop.
CVX test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear; | |
has_quadprog = exist( 'quadprog' ) == 2 | exist( 'quadprog' ) == 3; | |
has_linprog = exist( 'linprog' ) == 2 | exist( 'linprog' ) == 3; | |
rnstate = randn( 'state' ); randn( 'state', 1 ); | |
s_quiet = cvx_quiet(true); | |
s_pause = cvx_pause(false); | |
cvx_clear; echo on | |
b = [2; 0; 2; 0]; | |
cvx_begin | |
variable x(2) | |
variable y(2) | |
minimize(norm([x;y]-b)); | |
subject to | |
norm(x) <= 1; | |
norm(y) <= 1; | |
cvx_end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment