📄 test3.m
字号:
%----------------------------------------------------------------------%% TEST 3%%----------------------------------------------------------------------%% This script is for testing GP solver.% It generates various random problem data and solves this problem.% mkgp is a Matlab function that generates random problem data% which is originally written by Lieven Vandenberghe and% modified by Kwangmoo Koh.close all; clear all;randn('state',0);rand('state',0);% the size of problem data.%% n : # of variable% m : # of inequality constraints% w : # of terms in each inequality constraint% p : # of equality constraints% m*w >= n >= p in general.% s : # of average variables per monomial%n = 1000; m = 10000; w = 5; p = 0; nnz = 500000;sparsity = nnz/(n*m*w)disp(sprintf('n = %d, m = %d, w = %d, p = %d, nnz = %d',n,m,w,p,nnz))szs = w*ones(m+1,1);% generate random problem datadisp('setting up the problem data...');[A,b,G,h,x0,nu] = mkgp(n, szs, p, 0, sparsity);disp('solving the problem...');% solve the problem using gpcvxtic[x1,status1,lambda1,nu1,mu1] = gpcvx(A,b,szs,G,h);toc
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -