智能反射面—流形优化

使用Manopt工具箱适合优化最小化问题,如果你的优化问题是最大化问题,那么需要将其转换为最小化问题然后使用Manopt工具箱求解。

具体安装过程

Matlab添加Manopt - 知乎 (zhihu.com)

优化问题

clc,clear;
close all;
s=rng(1);%rand seed
N=10;
GR_num=1e3;% number, should be large enough
A = rand(N)+1i*rand(N);
A = (A*A'); % semidefinite matrix

% SDR
cvx_begin 
variable X(N,N) hermitian semidefinite
minimize (real(trace(A*X)))
subject to
    diag(X)==ones(N,1);
 cvx_end

 
% gassian random
obj = zeros(GR_num,1);
v=zeros(N,GR_num);
[V1,D1]=eig(X);
for ii=1:GR_num
    v(:,ii) = V1*D1^(1/2)*sqrt(1/2)*(randn(N,1) + 1i*randn(N,1));
    v(:,ii) = exp(1i*angle(v(:,ii)));% guarantee constant modulus
    obj(ii)=real(trace(A*(v(:,ii)*v(:,ii)')));
end
[~,idx] = min(obj);
v_opt = v(:,idx);
% check constant modulus
abs(v_opt)
% check optimal value
real(cvx_optval)

real(trace(v_opt'*A*v_opt ))



%采用方法二进行求解
% Create the problem structure.
v_init = ones(N,1);
manifold = complexcirclefactory(N);
problem.M = manifold;
options.verbosity=0;
% Define the problem cost function and its Euclidean gradient.
problem.cost  = @(x) trace(x'*A*x);
problem.egrad = @(x) 2*A*x;                   % notice the 'e' in 'egrad' for Euclidean

% Solve.
[x, xcost, info, options] = conjugategradient(problem,v_init,options);
 
% Display some statistics.
figure;
semilogy([info.iter], [info.gradnorm], '.-','linewidth',1);
xlabel('Iteration number');
ylabel('Norm of the gradient of f');
grid on

figure;
semilogy([info.iter], real([info.cost]), 'b.-','linewidth',1.2);
xlabel('Iteration number');
ylabel('cost');
grid on
set(gca,'fontsize',11);

real(x'*A*x)

 

相关推荐

  1. 机器学习——学习

    2024-01-19 03:22:02       36 阅读
  2. 的观点分析神经网络

    2024-01-19 03:22:02       16 阅读
  3. 系统优化(安全,限,数据存储)

    2024-01-19 03:22:02       37 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-01-19 03:22:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-19 03:22:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-19 03:22:02       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-19 03:22:02       20 阅读

热门阅读

  1. iptables使用

    2024-01-19 03:22:02       24 阅读
  2. PHP 数组面试题

    2024-01-19 03:22:02       32 阅读
  3. 解密Spring Boot的定时任务

    2024-01-19 03:22:02       30 阅读
  4. dpwwn:01

    dpwwn:01

    2024-01-19 03:22:02      34 阅读
  5. c语言之分支语句

    2024-01-19 03:22:02       32 阅读
  6. 网络安全应急响应&灾备KB

    2024-01-19 03:22:02       29 阅读
  7. kubernetes 权限控制

    2024-01-19 03:22:02       25 阅读
  8. SpringCloud Gateway解决CROS跨域问题

    2024-01-19 03:22:02       37 阅读
  9. Unity3D PVP游戏位置同步算法优化详解

    2024-01-19 03:22:02       37 阅读
  10. 2401vim,vim实现任务列表

    2024-01-19 03:22:02       36 阅读