📄 ex_doc_denseformat.m
字号:
%----------------------------------------------------------------------%% GP EXAMPLE IN THE DOCUMENT%%----------------------------------------------------------------------%% minimize: x^-1*y^-0.5*z^-1 + 2.3*x*z + 4*x*y*z% subject to: (1/3)*x^-2*y^-2 + (4/3)*y^0.5*z^-1 <= 1% 0.1*x + 0.2*y + 0.3*z <= 1% (1/2)*x*y = 1; %% This is an example shown in the documentation of gpcvx and gpposy% (see gpposy.ps and gpcvx.ps in doc directory).%clear all; close all;%----------------------------------------------------------------------% PROBLEM DATA IN POSYNOMIAL FORM (DENSE FORMAT)%----------------------------------------------------------------------A0 = [ -1 -0.5 -1 ;... 1 0 1 ;... 1 1 1 ];A1 = [ -2 -2 0 ;... 0 0.5 -1 ];A2 = [ 1 0 0 ;... 0 1 0 ;... 0 0 1 ];A = [ A0; A1; A2 ];b0 = [ 1; 2.3; 4 ];b1 = [ 1/3; 4/3 ];b2 = [ 0.1; 0.2; 0.3 ];b = [ b0; b1; b2 ];G = [ 1 1 0 ];h = 0.5;szs = [ size(A0,1); size(A1,1); size(A2,1) ];%----------------------------------------------------------------------% SOLVE THE PROBLEM IN POSYNOMIAL FORM%----------------------------------------------------------------------[x1,status1,lambda1,nu1] = gpposy(A,b,szs,G,h);sol_posy = x1%----------------------------------------------------------------------% SOLVE THE PROBLEM IN CONVEX FORM%----------------------------------------------------------------------[x2,status2,lambda2,nu2,mu2] = gpcvx(A,log(b),szs,G,log(h));sol_cvx = exp(x2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -