Abstract

Portfolio theory mainly studies how to optimize the allocation of assets under the premise of maximizing expected returns and minimizing investment risks. In view of the instability of the financial market, a diversified investment portfolio can help control the loss of the investment portfolio. In addition to paying attention to the safety and return of asset allocation, we cannot ignore the liquidity of assets, that is, their liquidity. Adding high-liquidity products to asset allocation, such as equity investment, can better control the financial cash flow in response to emergencies. One of the ways to make assets flow is to securitize assets and sell them to the market. In order to revitalize the stock assets, good investment efficiency is a necessary choice for financial investment. Various financial products and their derivatives continue to enter people’s vision. There are many financial products in reality, and optimizing the investment portfolio can bring high economic benefits. The purpose of this paper is to study the application of optimization algorithms in financial portfolio problems. (1) Monetary policy remains prudent and neutral. It is not easy to expect flooding, but flexibility is required in complex situations. (2) Financial resources are tilted towards innovation and transformation and capital markets, which is beneficial to the development of capital markets in the medium and long term. (3) Unblocking the transmission mechanism is conducive to lenient credit and tapping the wrong killing opportunities in private enterprise debt. (4) Banks and other financial institutions have moderate pressure to give benefits to entities, but in the long run, the interests of the two are consistent. (5) Finance risk prevention will continue, orderly breaking the rigid exchange and reshaping the financial structure and ecology. (6) The pace of opening up of the financial industry has accelerated, and the bond market investor structure has improved. In this paper, we establish different optimization schemes to compare and study the portfolio problem and then use MATLAB to solve the modeling and programming problem, calculate the highest return rate and the lowest risk value before and after optimization, and then make a comparative analysis to get a better optimization scheme. The results show that the genetic algorithm model is superior to the quadratic programming method in terms of risk control. The minimum risk of portfolio optimization through genetic algorithm has been reduced by about 40%, and the maximum return has increased by about 25%. The comprehensive optimization effect is better than the quadratic planning method and ultimately can obtain higher economic benefits. It can be seen that the optimization algorithm is of great significance for the comparative study of financial portfolio problems.

1. Introduction

Asset portfolio theory studies the methods of optimizing asset allocation by maximizing expected returns and minimizing investment risks. In 1952, based on the Markowitz model, a portfolio theory system was established to determine how investors chose the best portfolio among all possible asset portfolios and at the same time minimized the risk of the portfolio. It maximizes the return on the risk level. The introduction of this theory set a precedent for mathematical finance and laid a foundation for modern financial quantitative methods. The diversification of investment asset diversification theory has the effect of reducing nonsystemic risks in the market. The theory has two important contents: efficient frontier of portfolio meaning and variance analysis. Markowitz has done a lot of analysis and observation, but it is assumed that choosing between two assets with the same return will enable investors to choose assets with less risk. This also means that investors seeking high returns are also at high risk. In the end, investors often hold multiple investment portfolios to avoid risks. Based on the quantitative analysis of returns and risks, Markowitz systematically studied the characteristics of the investment portfolio and used mathematical methods to explain the investor’s risk aversion. The limitation of this model is that it does not take into account the nonnormal distribution of returns, and most empirical studies have shown that the yield of securities does not necessarily follow the normal distribution; on the other hand, the method is complicated to calculate, especially when it is applied to the portfolio problem of multiple projects. This kind of calculation is even greater. He also proposed ways to optimize the investment portfolio. The risk that determines the investment portfolio is not the risk of the asset itself, but the mutual influence between them. By manipulating the correlation between assets, we can manipulate the risk of the investment portfolio to achieve the return-risk portfolio we want. Through the analysis of the mean variance of assets, we can find an effective frontier. The point on this effective frontier is the best investment portfolio. These investment portfolios have the following characteristics: given the level of return of the portfolio, the risk of the portfolio is the smallest and the benefit is the largest; this is the content of the mean-variance model. The choice of investment portfolio is one of the main capital allocation and budget issues in financial management, and a variety of models have been proposed to make the best choice [1]. Optimal portfolio selection is a nondeterministic problem that has not been proposed in an accurate algorithm. It can be solved in polynomial time. In recent years, other limiting factors found in financial markets have been incorporated into the literature in an attempt to narrow the theoretical and the gap between practice [2]. The problem of portfolio selection is related to the allocation of resources to a limited number of assets. In the classical approach, this problem aims to overcome the trade-off between portfolio risk and expected return [3].

Tao research shows that the problem of portfolio optimization is the core issue of modern economics and decision theory. The development of the financial industry occupies an important position in China’s economic development system and is also an important aspect of showing China’s economic strength. Finance is a series of economic methods carried out around capital, which includes investment, transaction, savings, lending, and other aspects. These aspects have an important impact on people’s lives. It can be said that everyone lives in such a gradually financialized world picture. Especially with the development of economic globalization, the world’s financial system and the credit system are integrated, and people are also entering the era of credit. As far as China’s current development is concerned, the development of the financial market has profoundly affected people’s lives, including both positive and negative effects. The mean-variance model and stochastic advantage model can solve this problem. Based on the second-order stochastic dominance constraint, an improved biogeography-based optimization algorithm is proposed to optimize the portfolio. The best returns obtained through this algorithm are 0.1325% and 0.3197%. In contrast, the return on the FTSE 100 index portfolio is 0.0937% [4]. Sengupta uses a robust optimization method to solve the linear opportunity limited portfolio optimization problem, in which the financial script and asset loss return distribution is regarded as an extreme value. Compare the risk and return of investments made in deterministic and uncertain and highly volatile financial markets [5]. Kshatriya investigated the process of international portfolio diversification based on a sample of 33 globally traded stock market indices from 2000 to 2012. Taking skewness and kurtosis into consideration makes portfolio optimization nonlinear, nonconvex, and multiobjective. In the whole time period, the higher moment model is superior to the traditional mean-variance model [6]. Hsu uses the analytic hierarchy process, support vector regression, and genetic algorithm to design portfolio optimization methods to solve portfolio selection, portfolio optimization, and trading opportunities in turn. According to the investment results, the annualized investment returns of the semiconductor and steel market segments are 15.36% and 6.15%. Both rates of return are superior to Taiwan’s one-year deposit certificates of about 1% [7].

The purpose of this paper is to study the application of optimization algorithms in financial portfolio problems and optimize the portfolio problems from three different optimization methods; establish an optimization model and calculate the highest return and the lowest risk before and after optimization; then conduct a comparative analysis to get a better optimization plan. This provides a reference for future financial analysis. Compared with the previous literature on portfolio research, the innovation content of this paper is roughly divided into the following points. The first point is to analyze the optimal solution of the financial portfolio by the quadratic programming algorithm. The second point is to establish the genetic algorithm model by MATLAB to solve the optimal solution of the investment portfolio and discuss the optimization effect of different optimization schemes on the investment portfolio. The third point is that the genetic optimization algorithm and the actual financial portfolio problem are combined with each other to analyze the best optimization plan for the actual portfolio with different optimization schemes.

2. The Theory of Financial Portfolio

Since launching spontaneous economic activities, the financial industry has played an extremely important role in the entire human society as an important discipline [8, 9]. With the development of the times, the breadth and depth of financial services have greatly increased. In this process, in order to achieve faster, more accurate, and more stable investment activities, various complex mathematical models emerged at the historic moment [10]. And it does play an important role in breaking fineness. Many excellent mathematics personnel who are engaged in capital operations have also entered the financial market. Ordinary investors will obtain a higher return on investment as the main goal of investment activities. At the same time, they also take various ways to avoid the risks caused by investment activities. From common sense, it is not difficult to know that any kind of financial assets and return cannot be separated, but only relatively separated [11]. Therefore, it is necessary to find a mathematical model that combines the two and optimizes expected returns, which is obviously more practical than directly avoiding risks.

If we pay attention to the research of contemporary Western investment theory, we will find that the research object of Western investment theory is not an industrial investment but financial investment, especially investment in stocks, bonds, and other securities [12]. Initially, Western economists focused primarily on industrial investment but then gradually focused on financial investment. After entering the capitalist society, industrial investment activities developed rapidly due to the powerful power of the industrial revolution and large-scale production of machines. In turn, the entire capitalist world economy has an unprecedented speed of development. Therefore, the economics-related theoretical circles are also conducting many different degrees of research on industrial investment theory and practical problems [13]. The world’s first real stock exchange is the Amsterdam Stock Exchange, established in the Netherlands in 1613. After that, due to the extensive development of stock companies, stocks and bonds have become the main trading objects in the exchange. The opposite party of Western investment theory is Chinese investment theory, and the basis of Chinese investment theory is based on the background and guidance of Marxist theory on capital accumulation and expansion of capital reproduction. Western investment theories mainly study investment issues under the conditions of free capitalism. They have a relatively long process of formation and development and have formed a certain system.

Due to the large amount of investment, securities investment has always been the most common investment method of some investment institutions and countless publics in Western countries, so it is inevitable that the theoretical and scientific community will be required to carry out the next theoretical research on financial investment and gradually carry out investment research, which will become the main goal [14]. With this change, the investment theory research of securities investment is mainly the securities investment of various investments in the field of financial investment. In other words, securities investment focuses on securities of financial assets, namely, securities of stock investment and bond investment and securities of stock investment and bond investment with different properties and characteristics [15]. Markowitz believes that investors’ desire to invest is to be able to pursue high-expected returns while avoiding as much risk as possible. Therefore, he designed a securities investment model and established a theoretical framework [16]. The core of the theory is how to use quantitative analysis to select the portfolio that can provide the greatest utility and how to provide the maximum return at a given risk level or the smallest risk-taking behavior without damaging the return. In the construction of a portfolio, in addition to determining the rate of return, it is also crucial to estimate the risk or uncertainty associated with the return to be won. The variance and standard deviation of the rate of return are two alternative statistics that represent risk or uncertainty. These two statistics actually measure the degree to which the rate of return changes around its average value. If the rate of return changes drastically around the mean value, it means that the rate of return is very uncertain, and the risk is also large. The variance or standard deviation can be used to measure the risk of single security in an absolute sense. At the same time, we also need to consider the risk of security in the entire portfolio. The risk of a portfolio depends on the proportion of each security in the portfolio and the contribution of each security to the overall portfolio risk. Covariance is a statistic used to measure the risk of a security in a portfolio relative to other securities. Essentially, the way in which the securities in the portfolio change each other affects the overall variance of the portfolio and thus its risk. Generally speaking, portfolios with negative correlation or negative covariance of portfolios have the potential to significantly reduce portfolio risk.

The first level of the investment portfolio is a combination of industrial investment and financial investment. In terms of scope, this level of investment portfolio includes all investments that constitute real assets and all investments that constitute financial assets. In other words, this level of investment portfolio includes fixed asset investment, current asset investment, intangible asset investment, human asset investment, stock investment, and bond investment. This is the most complex portfolio [17]. The second level of the portfolio consists of two sets of portfolios. One is various investment portfolios in the field of industrial investment; the second is various investment portfolios in the field of financial investment. The former main directions include fixed asset management investment, intangible asset management investment, and other current asset management investments. The latter’s main business includes investment in private equity and fixed asset income stocks. The purpose of the industrial investment portfolio is to optimize resource allocation and asset structure and create more favorable conditions for the smooth operation of enterprises. The purpose of the investment portfolio in the field of financial investment is mainly to increase investment returns and reduce investment risks. The third level of the portfolio also includes two sets of portfolios. One is a stock portfolio; the other is a stock portfolio. The second is the bond portfolio. The former includes only various stock investments within the scope. In fact, securities portfolios are often referred to as equity portfolios, also known as diversified portfolios. The latter includes only various bond investments. Bond portfolio is also called bond portfolio [18]. However, the purpose of these two portfolios is the same: to increase returns while reducing risk.

3. Optimization Algorithm Theory of Financial Portfolio

3.1. Optimization Theory Based on Genetic Algorithm

In 1952, Markowitz proposed the mean square error portfolio optimization model using the methods of probability theory and plan theory. The mean square error portfolio optimization model is regarded as the cornerstone of modern portfolio theory. According to the consideration of risk-free assets, the mean-variance combination model can generally be subdivided into a mean-variance combination model for risk-free value assets and two mean-variance combination models for risk-free value assets [19]. Especially for relatively risk-free assets, the expected rate of return is usually constant. For the first time, the mean-variance combination model reveals from the theoretical perspective of modern normative market economics how to establish the effectiveness and boundary relationships of various investment strategy combinations through combination to correctly select the best investment strategy combination. It is undoubtedly the academic pioneer of China’s modern investment strategy portfolio model theory to choose investment methods that reduce the market risk. It has promoted the steady development of my country’s modern capitalist market economy theory [20]. Risk-free assets are usually replaced by Treasury bills. Therefore, the interest rate of Treasury bills is called the risk-free interest rate.

By reading and analyzing the relevant literature, it can be seen that the current research on securities portfolio theory mainly focuses on the following aspects: (1) Genetic algorithms are used as the main analytical tools and means to select different risk distributions. In simulation optimization, different size models are selected according to different requirements to solve the problem more accurately [14]. (2) Simulated annealing algorithm uses simulated annealing as the main method and uses different risk frequencies to predict returns [5]. (3) Sequential quadratic programming algorithm: through the application of sequential quadratic programming, the rate of return can be calculated at a certain risk or the risk coefficient can be calculated at a certain rate of return, thereby optimizing the investment portfolio [21].

Genetic algorithms provide us with a new general technical framework for solving nonlinear, multithreaded model, multipurpose, and other complex global system structure optimization techniques; these problems provide a new general technical framework, so they have the advantages of both global system optimization and strong robustness [22, 23]. Genetic algorithm is a random search algorithm that draws on the natural selection and natural genetic mechanism of the biological world. It searches for the optimal solution by simulating the natural evolution process. It uses a certain coding technology to act on the digital strings called chromosomes, recombining those adaptable strings through organized and random information exchange and simulating the evolutionary process of the groups composed of these strings. This algorithm has both advantages and disadvantages. Advantages are as follows: ① extensive representation of feasible solutions; ② group search characteristics; ③ no need for auxiliary information; ④ extensible and easy to mix with other technologies. Disadvantages are as follows: ① the coding is not standardized and the coding has inaccuracy of representation; ② a single genetic algorithm coding cannot fully express the constraints of the optimization problem; ③ the genetic algorithm is prone to premature convergence. Therefore, improving and optimizing the genetic algorithm to form a hybrid genetic algorithm to improve the efficiency and solution quality of the pure genetic algorithm is a research hotspot in the future. Genetic algorithm technology is a kind of self-adaptive artificial intelligent analysis technology, which can help solve genetic problems by analyzing and simulating the evolutionary development process of human organisms and genetic mechanism models. The core idea is mainly the comprehensive result of the following basic knowledge understanding. From simple to complex and from low level to high level, the entire biological evolution process itself is actually a very natural, parallel, and powerful biological optimization process. One of the main goals of optimization is the best adaptability to the working environment. Then, to achieve the purpose of biological evolution through an appropriate method, the entire population relationship is subjected to secondary genetic mutation. According to Darwin’s natural selection and Mendel’s evolutionary theory of natural genetic variation, the entire evolutionary process of biology is realized through the four basic evolutionary forms of genetic reproduction, mutation, competition, and natural selection. In order to effectively and accurately optimize a target variable function in the largest area, some problems should be solved as soon as possible [24]. In the described situation, the solution to this problem is basically to optimize the adaptation function of the species to the environment. To illustrate that the type-optimized variables correspond to appropriate hybridization, the generation of mutation types, and the selection and use of new generations, the current population begins to repeat this process until the desired mother group or specified evolutionary time limit is obtained. Therefore, it is possible to have a clear biological background and arbitrary functional categories (especially functional categories that cannot be expressed). After the mid-1980s, it attracted widespread attention in the fields of artificial intelligence, machine learning, and artificial neural networks. After training, the program will automatically generate an expert system, maintenance, knowledge base of ultralarge scale, high linearity, and discontinuous function optimization. After the 1980s, the application research of the model algorithm has gradually become a research hotspot in the fields of contemporary computer engineering science, information science, and system optimization technology. In recent years, genetic algorithms have been widely used to study and solve various optimization system problems, such as system functional structure optimization, combined structure optimization, automatic control, robot intelligent engineering, image signal processing, artificial life, genetic algorithm coding, and automatic machine deep learning [25]. However, many experts and scholars at home and abroad have fully proved the great effectiveness of genetic algorithms in the research and solution of the optimal allocation problem in personal investment portfolios. After establishing a portfolio model based on structured classification, according to the basic assumptions of the model and the representation of the corresponding objective function, the steps to solve the model by genetic algorithm are summarized as follows. Step 1. Select the classification standard (such as industry) according to the actual situation of securities, carry out the classification, and use the mathematical symbol table. Step 2. Obtain the historical data of the candidate assets and calculate the corresponding expected return variance (risk) and the covariance between assets. Step 3. Determine the first-level portfolio optimization according to the number of specific candidate assets of each type of asset and call the genetic algorithm to get the portfolio optimization of each type of asset. Step 4. Repeat Step 3 until getting each type of asset. Step 5. According to the classified portfolio results in Step 3 to Step 4, call the genetic algorithm to solve the final portfolio optimization results. After the establishment of a combined solution optimization analysis model, most scientific studies believe that it is based on genetic algorithm and solve the results of the model combination. Therefore, genetic algorithms can already be used to effectively solve the problem of risk investors in the optimization of portfolio structure. Genetic algorithm is also derived from a computer genetic simulation based on the biological genetic system. Professor Holland of the United States said that this is a natural scientific process of biological evolution. It is the evolution process of finding the best solution to a problem in a simulator. In order to quickly adapt to the optimization of traditional probabilistic algorithms, he proposed a new method-genetic algorithm, genetic algorithm, and a new artificial intelligence adaptive algorithm system. Professor Holland first systematically edited and published the first book. In the 1980s, the professor at a Dutch university successfully implemented the first new machine learning intelligent system based on genetic algorithm and thus proposed a new machine intelligence learning new system concept based on genetic algorithm. At the same time, the main theoretical research results of genetic algorithms are systematically summarized, and some basic principles and practical applications of genetic algorithms are thoroughly and completely discussed [26].

3.2. Analysis Theory of Genetic Algorithm and Quadratic Programming Algorithm

The main parameters of the basic components of the genetic algorithm include density genetic control coding data processing operation mechanism, fitness genetic control operation function, genetic density control function operator, and other genetic control parameters. Encoding genetic mechanism rules is the theoretical basis of genetic algorithms. It is related to and corresponding to the genetic encoding mechanism rules based on chromosome strings in molecular genetics. The genetic algorithm can use a new encoding operation mechanism to encode different individuals evenly into a specific single character string. The most common processing method of carry encoding is binary carry encoding, which includes using 0 and 1 to encode personal information into a binary string. The fitness evaluation function is mainly used to accurately assess the environmental adaptability of each genetic individual, which closely corresponds to the adaptation mechanism of individual living environment selection that describes the survival of the fittest in the evolution of the genetic process. In system optimization design problems, fitness optimization functions are usually used as an objective optimization function. The genetic fitness evaluation function method can be introduced to evaluate and analyze different individuals according to their genetic fitness functions, determine their fitness, and then carry out the genetic operation of survival of the fittest. Genetic operators correspond to operators in other natural systems, and breeding and mating correspond to mutations in other genetic operators. The main types of genetic replication operators include three selective mutation replication genetic operators, cross replication operators, and linear mutation operators. Copy space operator mapping is a random function mapping from an overall copy space to the main space. It selects good mother individuals from the current birth population according to some scientific standards or probability distribution to help generate newborn individuals by forming different newborn mother individuals. The two most commonly used numerical operators for selection are what we call a certain proportion of numerical selection and basic numerical selection. They are proportional to another person’s adaptive selection of numerical values. Cross-matrix operator mapping is a random cross-map from the entire space of the matrix to a single matrix space. Its main function is generally achieved by randomly determining the truncation position of one or more matrix components as a hybridization point, so that different individuals in different matrix components are truncated and divided into a limited number of individuals, and then obtaining a new individual by quickly obtaining the corresponding individual truncation through a certain probability exchange. According to the different numbers of various crossing points, the cross-line operator can be subdivided into three types of single-point line intersection, two-point line intersection, and multipoint line intersection. A restricted exchange form of multipoint linear intersection is also called a unified multipoint intersection. The mutation space operator probability is a random mutual mapping from the original individual mutation space to the newborn individual mutation space. The interaction calculation method is generally used to independently change the newborn individual with the mutation probability (also known as the individual mutation operator probability). It mainly calculates the variation value of each important component (such as gene) in order to produce a new individual. Control parameter inheritance refers to the algorithm parameters commonly used in the actual operation of controlling genetic algorithm parameters.

The quadratic programming method decomposes the original problem into a series of quadratic programming problems to be solved step by step. In operations research, it is a special type of optimization problem. The optimal value can be found in the financial investment portfolio, and the optimal solution can be found.

Nonlinear programming theory is an interdisciplinary field of research on operations research and modern computers and mathematics. Due to its profound historical background and rich theoretical content, nonlinear network programming has developed into an important branch of modern operations research. It has been widely used in enterprise production management information system and mechanical engineering technology as well as other social management sciences in this professional field. The basic research of nonlinear spatial planning was first proposed by Karsh before 1931. In the late 1940s, nonlinear urban planning officially entered the design system. In recent decades, many programming scientists have been devoted to the basic research of optimizing mathematical problems. These have made nonlinear software programming make great progress in the field of optimization theory basic research and the development of practical programming algorithms.

The solution to this is generally called a constrained nonlinear additive programming set problem. When a subset of the quadratic additive program is solved in the first to k-the additive times, the calculation formula can be directly expressed as follows:where is the Lagrangian approximate Heather matrix, d is the search direction, is the gradient vector of the objective function at , represents the value of the inequality constraint at point , and is the Jacobian matrix with inequality constrained at .

The basic genetic algorithm (also known as the standard genetic algorithm or the simple genetic algorithm, Simple Genetic Algorithm, SGA for short) is a group operation that takes all individuals in the group as objects and only uses the basic Genetic Operator, Selection Operator, Crossover Operator, and Mutation Operator, its genetic evolution operation process is simple and easy to understand and is the basis of some other genetic algorithms, and it not only provides a variety of genetic algorithms A basic framework but also has certain application value. Selection, crossover, and mutation are the three main operation operators of genetic algorithm. They constitute the genetic operation, which makes the genetic algorithm have the characteristics that other methods do not have. The representation method is as follows:

4. Portfolio Optimization Model Based on Genetic Algorithm

4.1. Genetic Algorithm Execution Steps

(1)By selecting a digital coding representation strategy (using binary digital coding), each possible point in the space searched by a questioner is represented by a corresponding digital coding. This strategy is expressed and can be formed by one chromosome.(2)Systematic definition of population genetic selection strategy includes defining population selection scale parameter n, crossover, mutation-selection method, population selection method probability mean PR, crossover method probability mean Pc, mutation method probability mean Pm, and other genetic strategy parameters. Population inheritance is a small group where the frequency of genes in the group is changed due to accidental events (Wright effect). In a small group, because individuals cannot mate sufficiently at random, the genes cannot be completely free to separate and combine, so that the allele frequency is biased.(3)Use a command to iteratively increase the number of populations after an iteration to make this function t = 0. The random population transformation method selects a function with a value on the chromosome as the initialization, and a subsequent population makes the function called P(o) define the fitness function in a population as the population function whose value is f(f > 0).(4)Calculate the fitness value of each chromosome.(5)Through the selection operation to achieve the “survival of the fittest” process, select the better individual groups.(6)Perform a second exchange operation on Pc and d with a higher probability for all the better linear chromosomes selected in the figure (called single-point second crossover).(7)For the genes in the chromosome, participate in the mutation operation with the probability Pm (specify the mutation point according to the mutation probability Pm, and reverse the mutation point) to obtain a new generation of population P(t + 1).(8)Determine whether the group performance meets the preset termination criteria. If not, return to (4).

4.2. Genetic Algorithm and Quadratic Programming to Solve the Best Portfolio

Let the portfolio P be composed of N risk securities. The portfolio can be expressed as P = {, among them, image refers to the proportion of investment quota A in N securities. If the expected return E and risk of the N securities and the covariance between two random securities in the portfolio can be found, the huge risk of the portfolio is . The question to be considered now is as follows: given the expected return rate of the portfolio, how to minimize the risk, that is, consider this objective function, , and restrictions, E = , where 0 <  < 1, , and finally find the minimum objective function value.

4.3. Financial Data Selection

We selected ten stocks in the CSI 300 Index (China Baan, Shenzhen Energy, CIMC, Sinopec, Zoomlion, Dong Ajao, Holyan Securities, Gere Electric, Baine Energy, and Modern Investment) from January 5, 2012, to June 4, 2012, the closing price of 100 trading days (unit: yuan); these data come from Sine Finance Data Center. Because all of our data are the historical closing price of each stock, in practice, we need to use the return rate (arithmetic return rate), covariance, and so on. Of each stock, so first perform data preprocessing to obtain the following results. The specific results are shown in Table 1.

Set the parameters for the Markowitz mean-variance model: r is the vector composed of the mean returns in Table 1, and V is the variance-covariance matrix. N = 10; that is, ten financial assets are considered in the investment portfolio. μ = 0.0075; that is, the expected return is 0.0075 L = ones(1,10), which is an all-one matrix with ten rows and ten columns. U = zeros(1,10), which is, a row and ten columns of all zero matrices.

Solve the above Markowitz mean-variance model by quadratic programming algorithm, genetic algorithm MATLAB programming solution, and genetic algorithm toolbox, respectively, and compare and analyze the solution results.

5. Comparative Analysis of the Results of Optimization Algorithms in Financial Portfolio Problems

5.1. Analysis of Research Results of Quadratic Programming Algorithm in Financial Investment Portfolio

Before starting to solve this model, we also need to conduct a comprehensive analysis of the ten preselected historical data models to ensure that the data is accurate and valid and finally determine the specific method that needs to be solved for this model, and the ten major financial assets (China Baan, Shenzhen Biaxin Energy, CIMC, Sinopec, Zoom lion, Dong Ajao, Hong Yuan Securities, Gere Electric, Biaxin China Energy, and Hyundai Investment) are divided into group A, group B, group C, group D, group E, group F, group G, group H, group M, and group N. First, use MATLAB software to perform a normal distribution test on the returns of the selected 10 stocks over the past 100 trading days and test the results. After that, the optimal investment ratio is calculated through the quadratic programming algorithm.

As shown in Figure 1, the optimization result of the quadratic programming algorithm for the financial portfolio problem is not very ideal. Compared with the optimal return rate, the risk value will still be high, the optimization result is not obvious, the optimal return rate obtained by Hong Yuan Securities for group G is 0.043, and the poor yield is only 0.008. In addition, the quadratic programming algorithm (QP) has a faster convergence rate, its convergence rate is related to the initial value selection, and the investment dispersion is not very good.

As shown in Table 2, according to the data table, assuming that the income constraint E = 0.004 and the P value is obtained according to the quadratic programming algorithm, there is the objective function formula above to calculate the risk f = 1.4 at this time. Their quadratic programming values are 0.16, 0.2, 0.27, 0.1, 0.17, 0.03, 0.2, 0.07, 0.11, and 0.09, indicating that the investment dispersion is not very good.

5.2. Analysis of Research Results of Genetic Algorithm in Financial Investment Portfolio

As shown in Figure 2, the genetic algorithm’s optimization result for the financial portfolio problem is ideal. Compared with the optimal return rate, its risk value has also been significantly reduced, the optimization result is obvious, and the optimal return rate obtained is group G 0.068. The poor rate of return is only 0.03, assuming that the income constraint E = 0.004 and the P value is obtained according to the quadratic programming algorithm, there is the objective function formula above that can calculate the risk f = 0,81 Compared with the planning results, it has been significantly improved. Moreover, the genetic algorithm has an excellent performance in global search. Although the local search ability is insufficient, the late convergence rate is slower, and its investment diversification is better than QP. Therefore, the genetic algorithm is faster, simpler, and more effective for solving the financial portfolio problem, which also shows that the genetic algorithm model is better than the quadratic programming algorithm for financial portfolio investment and has a good reference significance.

As shown in Figure 3, since the gene to be processed by the genetic algorithm is a single gene obtained by performing gene encoding calculation on a parameter set, the genetic algorithm is usually able to perform a numerical calculation on its genes. The analysis results obtained through the combination optimization research through the genetic algorithm analysis optimization method and the genetic algorithm toolbox method are used to perform the combination optimization analysis. The typical combination analysis results obtained may not be much different. It is generally considered to have typical combination characteristics. In terms of risk control models, the genetic algorithm risk model is significantly better than the quadratic risk planning method. This fact shows that, to a certain extent, the model built by the genetic algorithm is not only simple and easy to implement but also far superior to the international standard quadratic programming algorithm in terms of scientific effect. In addition, if the number of high-quality securities products in the algorithm combination model becomes more, due to the inherent parallelism of the genetic algorithm combination model, its competitive advantage will also be more obvious, and we will be more able to obtain better social and economic benefits.

5.3. Comparative Analysis of Three Algorithms in Financial Investment Portfolio

As shown in Figure 4, a random analysis of four groups of ten shares is conducted for comparative analysis, and the most characteristic analysis results are obtained. Comparing the return risks of the three asset portfolios, the returns and risks in combination with the largest objective function are both less than the target return and risk of the smallest combination of functions. This is in line with the investment habits of investors. The benefits obtained through genetic algorithms are large. Although it is a risky asset, it is often the higher return that investors want to get to make up for the possibility of too much risk. This part of the risk is reduced and accompanied by high returns. In the process of investment, investors consider more about the risk of this asset, and the risk cannot be higher than the expectations and thresholds in their hearts. It can be seen that the optimization of the portfolio through genetic algorithms avoids this very well. Therefore, genetic algorithm optimization can have a good reference value for financial investment.

The genetic algorithm toolbox is a set of general tools constructed using MATLAB matrix functions to implement a variety of genetic algorithm methods. Genetic algorithm toolbox is a set of routines, mainly written in m files, which implement the most important functions of genetic algorithms.

In general, the advantages of financial portfolio investment are risk diversification, better avoidance and reduction of risks, and relatively stable returns. The disadvantage is that it requires a large number of funds.

6. Conclusions

(1)In terms of risk control, the genetic algorithm model is superior to the quadratic programming method. It shows that, to a certain extent, the model built by the genetic algorithm is not only simple and easy to implement but also far superior to the international standard quadratic programming algorithm in terms of scientific effect. In addition, if the number of high-quality securities products in the algorithm combination model becomes more, due to the inherent parallelism of the genetic algorithm combination model, its competitive advantage will be more obvious, and we will be able to obtain better social and economic benefits.(2)The results show that the optimization results of the genetic algorithm for the financial portfolio problem are ideal. Compared with the optimal return rate, the risk value is also significantly reduced, the optimization result is obvious, the optimal return rate obtained is group G 0.068, and the poor rate of return is only 0.03. According to the value obtained by the genetic algorithm, the risk f = 0.81 can be calculated from the known objective function formula, which is significantly improved compared with the quadratic planning result.(3)Experimental data shows that the minimum risk of portfolio optimization by the genetic algorithm is reduced by about 40% and the maximum return is increased by about 25%. The risk reduction is better than the quadratic planning method, and it can also obtain the same benefits as the quadratic planning method. Financial capital needs to be strong. Overall, genetic algorithms have obvious effects on financial portfolio problems, which is conducive to reducing transaction costs. In many financial trades, they can eventually obtain a large amount of financial capital. This optimization method has obvious practical significance.

Data Availability

No data were used to support this study.

Conflicts of Interest

The authors declare that there are no conflicts of interest with any financial organizations regarding the material reported in this manuscript.