当前位置:网站首页>【1.2.投资的收益和风险】
【1.2.投资的收益和风险】
2022-07-26 14:25:00 【是数学系的小孩儿】
文章目录
模型的建立与求解
多目标规划问题通过一定形式的改变可以化为单目标的线性规划。
m a x ∑ i = 0 n ( r i − p i ) x i , max\sum_{i=0}^{n} (r_{i}-p_{i})x_{i}, maxi=0∑n(ri−pi)xi,
s . t . { q i x i M ≤ a i = 1 , 2 , ⋯ , n , ∑ i = 0 n ( 1 + p i ) x i = M x i ≥ 0 , i = 1 , 2 , ⋯ , n 。 s.t.\begin{cases} \frac{q_{i}x_{i}}{M}\le a & i =1,2,\cdots,n, \\ \sum_{i=0}^{n}(1+p_{i})x_{i} =M & x_{i}\ge 0, i =1,2,\cdots,n。 \end{cases} s.t.{ Mqixi≤a∑i=0n(1+pi)xi=Mi=1,2,⋯,n,xi≥0,i=1,2,⋯,n。
由于matlab中只能使用min,所以在敲代码的时候需要把数学模型中的max改编成min.
m i n f = [ − 0.05 , − 0.27 , − 0.19 , − 0.185 , − 0.185 ] ⋅ [ x 0 , x 1 , x 2 , x 3 , x 4 ] T minf=[-0.05,-0.27,-0.19,-0.185,-0.185]\cdot [x_{0},x_{1},x_{2},x_{3},x_{4}]^{T} minf=[−0.05,−0.27,−0.19,−0.185,−0.185]⋅[x0,x1,x2,x3,x4]T
s . t . { x 0 + 1.01 x 1 + 1.02 x 2 + 1.045 x 3 + 1.065 x 4 = 1 0.025 x 1 ≤ a 0.015 x 2 ≤ a 0.055 x 3 ≤ a 0.026 x 4 ≤ a x i ≥ 0 , i = 0 , 1 , ⋯ , 4 s.t.\begin{cases} x_{0}+1.01x_{1}+1.02x_{2}+1.045x_{3}+1.065x_{4}=1 \\0.025x_{1}\le a \\0.015x_{2}\le a \\0.055x_{3}\le a \\0.026x_{4}\le a \\x_{i}\ge0,i=0,1,\cdots,4 \end{cases} s.t.⎩⎨⎧x0+1.01x1+1.02x2+1.045x3+1.065x4=10.025x1≤a0.015x2≤a0.055x3≤a0.026x4≤axi≥0,i=0,1,⋯,4
由于a是任意给定的风险度,不同的投资者有不同的分享度,下面从a=0开始,以步长0.001进行循环搜索,由此可以使用MATLAB进行编程。
clc,clear
a=0;
hold on
while a<0.05
c=[-0.05,-0.27,-0.19,-0.185,-0.185];
A=[zeros(4,1),diag([0.025,0.015,0.055,0.026])];
b=a*ones(4,1);
Aeq=[1,1.01,1.02,1.045,1.065];
beq=1;
LB=zeros(5,1);
[x,q]=linprog(c,A,b,Aeq,beq,LB);
q=-q;
plot(a,q,'*k');
a=a+0.001;
end
xlabel('风险度变化a'),ylabel('总体收益Q')
综合分析,应该选择曲线的转折点作为最优投资组合,a=0.006, Q=0.20.
然后我们需要求出来每个项目需要投多少钱,就需要各个x求出来。
于是下面进行编程。
clc,clear
a=0.006;
c=[-0.05,-0.27,-0.19,-0.185,-0.185];
A=[zeros(4,1),diag([0.025,0.015,0.055,0.026])];
b=a*ones(4,1);
Aeq=[1,1.01,1.02,1.045,1.065];
beq=1;
LB=zeros(5,1);
[x,q]=linprog(c,A,b,Aeq,beq,LB)
q=-q

到这里给出总的金额的话,就可以具体根据比例关系求得每个项目需要投资的最优金额了。
边栏推荐
猜你喜欢

Iscc2021 lock problem solution

基于用户画像的在线健康社区用户流失预测研究

Research on technology subject division method based on patent multi-attribute fusion
![[ostep] 04 virtualized CPU - process scheduling strategy](/img/42/7ffb9745ef21a8db35861119dd70bf.png)
[ostep] 04 virtualized CPU - process scheduling strategy

ISCC2021 LOCKK题解

Multi task text classification model based on tag embedded attention mechanism

嵌入式开发:调试嵌入式软件的技巧
![[untitled]](/img/50/7aa01f1d8657700a11cbc26290804a.png)
[untitled]

全校软硬件基础设施一站式监控 ,苏州大学以时序数据库替换 PostgreSQL

1-to-1 live broadcast source code - 1-to-1 voice chat source code
随机推荐
One stop monitoring of the software and hardware infrastructure of the whole university, and Suzhou University replaces PostgreSQL with time series database
【干货】MySQL索引背后的数据结构及算法原理
Basic syntax of MySQL DDL and DML and DQL
Sequence traversal of binary tree (implemented in C language)
Integer internal cache
Add a display horizontal line between idea methods
Image-Level 弱监督图像语义分割汇总简析
[deep learning] fully connected network
基于用户画像的在线健康社区用户流失预测研究
Some lightweight network models in detection and segmentation (share your own learning notes)
android安全基础知识学习
请问下大家,flink sql有没有办法不输出update_before?
Share 44 JS problems, and half of them are masters
Detailed explanation of alter field of MySQL Foundation
嵌入式开发:调试嵌入式软件的技巧
Seata的部署与微服务集成
智能家居行业发展,密切关注边缘计算和小程序容器技术
键盘快捷键操作电脑(自己遇到不会的)
Seata deployment and microservice integration
mysql5.7通过文件zip方式安装-九五小庞