⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 allpartetooptimalsolutions.m

📁 一个用MATLAB编写的优化控制工具箱
💻 M
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Example of computing all the Pareto solutions for a finite% game (of course this is using a discrete approximation).%% Author: K. Passino% Version: 4/5/02%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Compute all Pareto solutions for a finite gameclear all% Define payoff (cost) functions for each player (much coarser)theta1=-4:0.5:4; % Ok, while we think of it as an infinite game computationally	              % we of course only study a finite number of points.m=length(theta1);theta2=-5:0.5:5;n=length(theta2);% A set of cost functions, J1 for player 1 and J2 for player 2for ii=1:length(theta1)	for jj=1:length(theta2)		J1(ii,jj)=-2*(exp( (-(theta1(ii)-2)^2)/5 +(-4*(theta1(ii)*theta2(jj))/20) + ((-(theta2(jj)-3)^2)/2))); 		J2(ii,jj)=-1*(exp( (-(theta1(ii)-1)^2)/4 + (5*(theta1(ii)*theta2(jj))/10) + ((-(theta2(jj)+1)^2)/2)));	endendPP=ones(size(J1)); % Initialize a matrix that will hold flags indicating if a point is a Pareto Point					% (initially it indicates that they are all Pareto points)% Compute the family of Pareto-optimal strategies:for ii=1:length(theta1)      % These are the loops for the test points theta^*	for jj=1:length(theta2)for iii=1:length(theta1)     % These are the loops for the points theta	for jjj=1:length(theta2)			% Perform tests to determine if (ii,jj) is a Pareto point		if (iii ~=ii & jjj~=jj) &...			((J1(iii,jjj) <= J1(ii,jj)) & (J2(iii,jjj) <= J2(ii,jj))) &...			((J1(iii,jjj) < J1(ii,jj)) | (J2(iii,jjj) < J2(ii,jj)))			PP(ii,jj)=0; % If find one such time that the conditions hold then it is not a Pareto point		end	endend					endend%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%figure(1)clfcolormap(jet)contour(theta2,theta1,J1,14)hold oncontour(theta2,theta1,J2,14)hold onfor ii=1:length(theta1)      % These are the loops for the test points theta^*	for jj=1:length(theta2)		if PP(ii,jj)==1			plot(theta2(jj),theta1(ii),'kx')			hold on		end	endendxlabel('\theta^2')ylabel('\theta^1')title('J_1, J_2, R_1 (-), R_2 (--), "x" marks a Pareto solution')hold off%-------------------------------------% End of program%-------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -