Non-linear Optimisation and Portfolio Selection
8.1 Non-linear Programming: Why It Is Harder Than Linear Programming
Linear programming relies on a key proportionality assumption: the contribution of each activity is proportional to its level, so the objective always takes the form “coefficient × decision variable.” When this assumption fails, the problem becomes a non-linear programme.
Linear versus Non-linear
| Comparison | Linear programming | Non-linear programming |
|---|---|---|
| Activity contribution | proportional to activity level | non-proportional (for example, diminishing marginal returns) |
| Modelling difficulty | write coefficients and variables directly | specify the functional form first, often via curve fitting |
| Solution difficulty | mature algorithms such as simplex guarantee a global optimum | the solver may stop at a local optimum or even fail |
| Location of optimum | always at a corner of the feasible region | interior, boundary or one of several local optima |
Four Types of Non-proportional Relationships
8.2 Curve Fitting and Multi-Start Solving
How to Obtain a Non-linear Relationship
- Plot the data as a scatter chart.
- Add a trendline (Chart Tools → Layout → Trendline).
- Choose a functional form (linear, logarithmic, polynomial, power or exponential), inspect R² and residuals, and check whether the parameters have economic meaning.
Multi-Start Search: The Same Model, Different “Optima”
Consider Maximise Profit = 0.5x⁵ − 6x⁴ + 24.5x³ − 39x² + 20x subject to 0 ≤ x ≤ 5. It has two local maxima, so a solver starting from different values can stop in different places.
Where Does Each Starting Value Converge?
The model has two local maxima on 0 ≤ x ≤ 5 (approximately x = 0.37 and x = 3.12). Determine where searches from the three starting values stop.
8.3 Two Non-linear Cases
Case 1: Wyndor with Marketing Costs
Market research shows that, without advertising, Wyndor can sell only a small fraction of output; selling everything requires substantial advertising. Curve fitting estimates weekly marketing cost for production rates D and W as: doors 25D²; windows (200/3)W²; gross margin is about USD 375 per door and USD 700 per window. Therefore:
Maximise Profit = 375D − 25D² + 700W − (200/3)W²
Constraints: D ≤ 4; 2W ≤ 12; 3D + 2W ≤ 18; D ≥ 0, W ≥ 0
Optimal Output with Marketing Costs
Solve the model above and enter optimal door output, window output and maximum net profit (3% tolerance).
Case 2: Portfolio Selection
Large fund managers commonly use non-linear-programming models to set portfolio weights. Investors care about expected return and risk—a cost-benefit trade-off (non-linear) model:minimise risk subject to expected return meeting a required level.
| Stock | Expected return | Risk (standard deviation) | Stock pair | Cross risk (covariance) |
|---|---|---|---|---|
| 1 | 21% | 25% | 1 and 2 | 0.040 |
| 2 | 30% | 45% | 1 and 3 | −0.005 |
| 3 | 8% | 5% | 2 and 3 | −0.010 |
Minimise Risk = (0.25S₁)² + (0.45S₂)² + (0.05S₃)² + 2(0.04)S₁S₂ + 2(−0.005)S₁S₃ + 2(−0.01)S₂S₃
Constraints: 0.21S₁ + 0.30S₂ + 0.08S₃ ≥ 0.18; S₁ + S₂ + S₃ = 100%; Sᵢ ≥ 0
Minimum-Risk Portfolio
With expected return at least 18%, enter minimum-risk weights and risk (standard deviation; 5% tolerance).
8.4 Separable Programming and Evolutionary Algorithms
Case: Wyndor with Overtime
Wyndor receives an order for a special handmade product that will occupy Plant 1 and Plant 2 capacity for the next four months. Remaining workers must work overtime to produce standard products. Overtime adds cost, so profit is lower at the same output—a piecewise-linear non-proportional relationship.
| Product | Maximum regular-time output | Maximum overtime output | Total | Regular-time unit profit | Overtime unit profit |
|---|---|---|---|---|---|
| Doors | 3 | 1 | 4 | $300 | $200 |
| Windows | 3 | 3 | 6 | $500 | $100 |
Maximise Profit = 300DR + 200DO + 500WR + 100WO
Constraints: DR ≤ 3; WR ≤ 3; (DR+DO) ≤ 4; (WR+WO) ≤ 6; 3(DR+DO) + 2(WR+WO) ≤ 18
Optimal Schedule with Overtime
Enter the four output quantities and total profit under the optimal plan.
Why Use Separable Programming?
- Transform the problem into Linear programming, enabling a fast solution.
- A linear programme can generate a sensitivity report(shadow prices and allowable ranges)—non-linear solvers usually cannot.
- The method segments each activity that violates proportionality, creates one variable per segment, and uses segment slope as unit profit.
Evolutionary Solver and Genetic Algorithms
Evolutionary Solver follows a completely different logic. A standard solver starts from a single solution and searches in improving directions. Evolutionary Solver generates an entire population of solutions and iterates through “pairing → offspring → mutation → survival of the fittest” until several generations show no improvement. It suits rough, irregular models with many local optima.
Evolutionary Algorithms: Logic and Characteristics
The method borrows a biological metaphor: each candidate solution is an individual’s “chromosome,” with its decision values encoded as “genes”;a group of candidate solutions is the population, and the objective value measures each individual’s “fitness.” Each generation does three things:
- Selection: fitter individuals are more likely to reproduce—survival of the fittest.
- Crossover: combine genes from two parents to create offspring. For portfolios, this means exchanging and blending two sets of weights.
- Mutation: randomly change a few genes (for example, increase or decrease a weight slightly). This is crucial for shaking a population out of a local optimum.
Its characteristics determine when it is suitable:
- No gradient required: it only needs to calculate the objective for a set of values, so it handles rough, discontinuous, conditional or integer models—the cases ordinary solvers find hardest.
- Starts from a population rather than one point, reducing the chance of immediate entrapment in a local optimum, but it does not guarantee a global optimum—only a sufficiently good solution.
- Results are random: two runs on the same model may differ. Fix a random seed and compare multiple runs rather than relying on one.
- Parameters must be set: population size, crossover rate, mutation rate, generations and convergence criteria all affect quality and runtime.
- Computationally intensive: the objective is evaluated thousands of times. It is best for problems with relatively few variables but difficult model structure.
- Strong on combinatorial problems: selecting a subset from many candidates (stocks, sites), scheduling with logical constraints and multi-modal curve fitting.
Case: Selecting a Portfolio That Beats the Market
A common objective for investment managers is to beat the market. If past performance has some predictive value, it makes sense to search for portfolios that beat the market most often. In this case, seven A-share stocks (ICBC, PetroChina, Kweichow Moutai, BYD, COSCO Shipping Holdings, China Vanke and Ping An) have returns for the past 12 quarters, along with the SSE A-Share Index over the same period; assign a weight to each stock.
| Element | Content |
|---|---|
| Decision variables | weights for seven stocks w₁ … w₇, with 0 ≤ wᵢ ≤ 1 and Σwᵢ = 1 |
| Objective | Maximise the number of quarters in which the portfolio return exceeds the index (out of 12) |
| Data | returns for seven stocks over 12 quarters; contemporaneous SSE A-Share Index returns |
The objective is unusual: it counts wins, not the size of wins. A small change in weights may leave the win count unchanged or jump it by one—the objective is a step function, non-differentiable and discontinuous, with many tied solutions. Ordinary solvers struggle; evolutionary algorithms are appropriate:the population is a set of weight combinations,fitness is the number of winning quarters (plus a small penalty enforcing weights summing to one),Crossover blends two weight vectors, and Mutation randomly changes a few weights slightly.
A simple comparison with this data:the equal-weight portfolio(1/7 in each stock) beat the index in 8 of the past 12 quarters. Blindly generating 200,000 random weight vectors, most beat the index only 6–8 times; only a few dozen reached 11 wins, and only an extremely small number reached 12.This is why we use search rather than luck: evolutionary algorithms accumulate information from each trial and move toward higher fitness over generations.
8.5 AI and the Course Project
Curve fitting and multi-start search
① Give AI activity and profit data and ask for a fitted function.
② Ask why that functional form was selected and what the parameters mean economically.
③ Multi-start search: ask for three different initial solutions and compare results.
④ Verification: enter the function in Excel and use Solver to verify the optimum.
⑤ Record the difference between AI’s fit and Excel’s trendline.
When AI Portfolio Recommendations Fail
| Failure condition | Why it fails | How to guard against it |
|---|---|---|
| History does not represent the future | using past returns to estimate future returns | run scenario analysis; do not rely blindly on backtests |
| Correlations change | assets move together in crises | stress-test high-correlation scenarios |
| Optimising only the mean | ignoring volatility and tail risk | inspect standard deviation, maximum drawdown and percentiles |
| Constraints ignored | AI does not know your investment limits | state constraints clearly and verify each one |
| Recommendation not implementable | odd lots, taxes and liquidity problems | calculate implementation costs before deciding |
Where Will an AI Recommendation Fail?
Evaluate the following four statements.
Course Project Requirements (1): Objective and Deliverables
- Objective: choose a real management problem and complete the full “data — model — AI collaboration — recommendation” process.
- Deliverable: a written report; no classroom presentation.
- Report elements: problem definition, data description, model and method, interpretation and recommendation.
- Required AI-use statement: which tool, for what purpose and how it was verified.
- Topic guidance: extend a course case or address a real problem from your workplace.
Course Project Requirements (2): Report Outline
- Problem and context: what decision is needed and how will it be measured?
- Data and definitions: sources, field meanings and cleaning.
- Model and solution: why this model, and how it is solved.
- Results and interpretation: what the result is and what it means for management.
- AI collaboration and verification: what AI did and what problems you found.
- Recommendation and limitations: what to do, plus boundaries and risks.
8.6 Summary and Course Review
- Non-linearity arises from non-proportional relationships; such models are much harder to solve and offer no guarantee of finding a global optimum.
- Curve fitting and multi-start search are standard tools: different starting values can yield different “optima.”
- Separable programming converts piecewise-linear problems into linear programmes and provides sensitivity reports.
- Evolutionary or genetic algorithms suit rough, irregular models.
The Course Spine across Eight Units
| Unit | Core question | Typical tools |
|---|---|---|
| 1 Data and descriptive statistics | What do the data look like? | Descriptive statistics, histograms, box plots, AI fundamentals |
| 2 Probability and hypothesis testing | Is this difference real? | Normal distribution, confidence intervals, four-step testing, A/B tests |
| 3 Regression | What influences the outcome? | Four-step regression, R², significance, dummy variables, log models |
| 4 Time series and text | What will happen next? | Seasonal factors, smoothing, causal forecasting, LLM labelling |
| 5 Linear programming | How should resources be allocated? | Four-step modelling, graphical solution, Solver, sensitivity analysis |
| 6 Modelling and integer programming | Whether, and how many? | Modelling standards, integer and binary variables, scheduling, setup costs |
| 7 Uncertainty and simulation | How large is the risk? | Decision criteria, decision trees, Bayesian updating, Monte Carlo |
| 8 Non-linear optimisation and portfolios | What if relationships are non-proportional? | Curve fitting, multi-start search, separable programming, portfolio optimisation |
Appendix: Interactive Demonstrations and Classroom Exercises
| Location | Type | Content |
|---|---|---|
| 8.2 | Demonstration | Linear versus quadratic fit (trendlines) |
| 8.2 | Demonstration | Multi-start search: three starting values |
| 8.3 | Demonstration | Wyndor profit curve with marketing costs |
| 8.3 | Demonstration | Portfolio risk-return map and efficient frontier |
| 8.4 | Demonstration | Separable programming: regular and overtime output |
| 8.2 | Exercise | Where Does Each Starting Value Converge? |
| 8.3 | Exercise | Optimal Output with Marketing Costs |
| 8.3 | Exercise | Minimum-Risk Portfolio |
| 8.4 | Exercise | Optimal Schedule with Overtime |
| 8.5 | Exercise | Where Will an AI Recommendation Fail? |
Data sources: 单元8_非线性与组合练习.xlsx and model parameters from WyndorExtension.xlsx and Portfolio.xlsx. Every optimum is calculated on the page by grid search or enumeration and can be checked against Excel Solver.
Unit Glossary (English–Chinese)
| English | 中文 |
|---|---|
| Non-linear programming | 非线性规划 |
| Curve fitting | 曲线拟合 |
| Local optimum | 局部最优 |
| Global optimum | 全局最优 |
| Separable programming | 可分离规划 |
| Evolutionary algorithm | 演化算法 |
| Portfolio | 投资组合 |
| Efficient frontier | 有效前沿 |
| Covariance | 协方差 |