Mathematical Modeling Algorithms and Applications|Investment Benefits and Risks|Model 1 Analysis

I took notes on what I emphasized and what I didn't understand.

Table of contents

1 question asked

 2 Symbol rules and basic assumptions

 3 Model analysis and establishment

4 Model One

5 Modeling formula

 6. MATLAB programming code

7 Result analysis


1 question asked

 2 Symbol rules and basic assumptions

 3 Model analysis and establishment

4 Model One

 The first max formula means (average rate of return - transaction fee rate) * capital = profit. Of course, the highest profit is better, but because matlab can only calculate the minimum value, it is converted into (transaction fee rate-average rate of return)*funds.

The second constraint is to control the risk within a controllable range.

The third is that the sum of the amount of all investment projects and transaction fees should be equal to the principal.

5 Modeling formula

 The fourth part has already said that max becomes min, so it needs to be calculated (pr), and the table calculation of each rate is the result.

Because at r0, there is only deposit interest rate, that is, the risk rate p0 is 0, so the coefficient (pr) is (0-0.05)=-0.05 

In this way, when investing in the first to fourth types of projects, their transaction fee rate-average rate of return is as follows:

s1 0.01-0.28 -0.27
s2 0.02-0.21 -0.19
s3 0.045-0.23 -0.185
s4 0.065-0.25 -0.185

Therefore, the coefficients of min are calculated, corresponding to the following formula:

 

As mentioned earlier (1+transaction fee)*project funds=principal sum, the coefficient of each project can be calculated, that is, (1+transaction fee), that is, (1+p). 

investment project 1+ transaction fee rate coefficient
s0 1+0 1
s1 1+0.01 1.01
s2 1+0.02 1.02
s3 1+0.045 1.045
s4 1+0.065 1.065

So the identity formula looks like this:

 The next constraint is to control the risk, because the principal is assumed to be 1, so only qx needs to be calculated, that is, the risk loss rate*invested funds. And because the investment x should be >=0.

investment project Risk Loss Rate * Invested Funds
s0 0*x0
s1 0.025*x1
s2 0.015*x2
s3 0.055*x3
s4 0.026*x4

So the constraint formula is:

 6. MATLAB programming code

 Assuming that the risk starts from 0 and increases by 0.001 each time, the analysis stops when the risk is greater than or equal to 0.05.

It is worth noting that under the constraints, we need to set a diagonal matrix so that the calculation result is the funds for a certain project. diag is a diagonal matrix.

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;a;a;a];
   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')

You can see that A looks like this:

The result is shown in the figure:

7 Result analysis

It can be observed that the results are consistent with the analysis in the book.

 

Guess you like

Origin blog.csdn.net/qq_43604183/article/details/131744096