当前位置:网站首页>【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

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

Disease knowledge discovery based on spo semantic triples

智能家居行业发展,密切关注边缘计算和小程序容器技术

1对1直播源码——1对1语音聊天源码

Jzoffer51- reverse pairs in the array (merge sort solution)

聚力打造四个“高地”,携手合作伙伴共铸国云!

Instructions for various interfaces of hand-held vibrating wire collector vh03

Plato Farm有望通过Elephant Swap,进一步向外拓展生态

Basic knowledge about memory chips

Solve the problem that JUnit of idea console cannot be input with scanner

A survey of machine learning based technology term recognition
随机推荐
基于多特征的技术融合关系预测及其价值评估
网络图片转本地导致内核退出
sp导出贴图到maya
My creation Anniversary - from the heart
手持振弦采集仪VH03各种接口使用说明
研发了 5 年的时序数据库,到底要解决什么问题?
MySQL-03 数据库操作
【论文阅读】GRAW+:A Two-View Graph Propagation Method With Word Coupling for Readability Assessment
聚力打造四个“高地”,携手合作伙伴共铸国云!
OA项目之我的会议
如何评价测试质量?
[Yugong series] July 2022 go teaching course 017 - if of branch structure
Flink SQL(三) 连接到外部系统System和JDBC
Redis的数据操作
~6. ccf 2021-09-1 数组推导
Image-Level 弱监督图像语义分割汇总简析
Leetcode215 the kth largest element (derivation of quick sort partition function)
什么是Restful风格以及它的四种具体实现形式
Multi task text classification model based on tag embedded attention mechanism
Redis data operation