Nowadays in financial field, portfolio optimization is playing a key role in making decision of investment. This article taking about the asset allocation in seven companies in Technology, Consumer Defensive, Consumer Cyclic and Entertainment. The Markowitz and Index models are the primary tools utilized in this study to analyze the portfolio data. Then, three constraints will be set to see the difference between them. In more detail, comparing two different models in same constraint and find difference in same model when setting different constraints. The results shows that McDonald’s takes the highest Weight in two models when setting different constraints on models. In the meanwhile, compared to when there are no constraints, the performance of the minimal variance frontier and the capital allocation line is inferior. The research in this paper plays a reference role for investors to construct investment portfolios.