Optimal-on-paper is not optimal
Every method so far produces a "best" portfolio in some idealized sense. But the idealized portfolio routinely asks you to do things you cannot or should not: turn over half the book, hold four hundred fractional positions, take a concentrated sector bet, lever beyond your mandate, or buy 3.7 shares of something. A portfolio that ignores these realities is not optimal — it's a thought experiment. Constraints are not the enemy of optimization; they are what makes it real.
The gallery wires real constraints directly into the convex programs (and uses mixed-integer programming where a constraint is genuinely combinatorial), so the solution that comes back already obeys the rules rather than violating them and hoping you'll fix it later. These are not afterthoughts bolted on after optimization — the optimizer finds the best portfolio subject to them. As always, output is reviewed research behind the approval gates.
Turnover and transaction-cost budgets
Two constraints govern how much you trade:
- Turnover-constrained optimization caps how far the new portfolio can move from the current one. This is essential for rebalancing: you want the benefit of re-optimizing without churning the whole book. The optimizer then finds the best reachable portfolio within a trading budget. Review whether the cap is binding — if it is, the optimizer is telling you the unconstrained optimum is far away, which is itself information.
- Transaction-cost budget goes further and models the actual cost of trading (spreads, commissions, market impact in basis points) and optimizes net of it. The engine produces a turnover waterfall so you can see what each trade buys you after its cost — and prune the ones that don't earn their keep.
Both encode the same truth: the gap between your current and ideal portfolio has a price, and a good optimizer respects it.
Cardinality and group limits
Two constraints govern what and how many you hold:
- Cardinality-constrained optimization caps the number of holdings — a theoretically optimal portfolio might want eighty tiny positions, and a cardinality constraint says "give me the best 25-name version." This is genuinely hard math (a combinatorial, mixed-integer problem), and the engine solves it as an MIQP with a principled top-k relaxation fallback when the exact solve is too large. The review focus is the diversification you give up for a manageable book.
- Group weight constraints enforce sector, asset-class, sleeve, or custom-group bounds — the bread and butter of an IPS. "No more than 25% in any sector, at least 10% in fixed income." The optimizer respects them as hard bounds rather than producing a portfolio you then have to manually hack into compliance.
Round lots, factor bounds, and exposure rules
The practical family rounds out with the rules that make a portfolio tradeable and policy-compliant:
- Round-lot optimization converts continuous target weights into actually tradeable, lot-aware share counts — the difference between a theoretical weight and an order a desk can fill.
- Factor-exposure constraints bound the portfolio's loadings on chosen factors — cap beta, neutralize a style, hold duration in a band — connecting the factor risk model from Part 7 directly to executable limits.
- Gross/net and exposure constraints govern leverage and directionality (gross long, gross short, net exposure), the scaffolding for everything from a fully-invested long-only book to a market-neutral one. Because these touch real risk and suitability, they demand explicit permission and sit firmly behind review gates — and we cover their active use in Part 9.
Regularization: the quiet stabilizer
One subtle but valuable tool: L1 and L2 regularization add a penalty on extreme or unstable weights directly to the objective. L2 (ridge) discourages concentration and shrinks weights toward balance; L1 (lasso) encourages sparsity, naturally producing fewer, cleaner positions. Both improve out-of-sample stability by telling the optimizer not to trust its inputs so completely — a direct antidote to the error-maximizer problem from Part 1, and a complement to the shrinkage we apply on the covariance side in Part 7.
How to read a constrained run
The signature diagnostic here is constraint binding — which limits are actually active at the solution:
- A binding constraint is information. If the turnover cap, the sector bound, or the cardinality limit is binding, the optimizer is being held back from its preferred answer there. That's often exactly where to focus review.
- Check the cost of constraints. The comparison view against an unconstrained run shows what each rule cost in expected return or risk — so you can tell a cheap, prudent constraint from an expensive, dogmatic one.
- Confirm implementability. Round lots and transaction costs are what turn a weight vector into a fillable order; don't skip them on anything headed toward execution.
Constraints as the real expression of intent
It is tempting to see constraints as compromises that degrade an otherwise pure optimization. The healthier framing is that constraints are where your actual investment policy lives. The objective function says what you want in theory; the constraints say what you will accept in practice — your trading budget, your concentration limits, your factor exposures, your mandate. A well-constrained "good" portfolio beats an unconstrained "optimal" one every time, because only one of them can actually be held.
The takeaway
Constraints are what separate a research curiosity from a portfolio you can actually hold: turnover and cost budgets govern trading, cardinality and group limits govern composition, round lots and exposure rules govern implementability, and regularization quietly stabilizes the whole thing. These are not degradations of the optimization — they are the optimization, expressed honestly. Read the binding constraints; they tell you where the real tension is. Next in the series: tax-aware and long-short construction — optimizing after-tax outcomes and building both sides of the book.



