Delivering returns while managing risk remains a key priority in today’s financial markets. Portfolio managers and quantitative analysts are asked to make decisions that not only hold up in theory but also withstand the messy realities of trading—transaction costs, turnover limits, diversification rules, and more. 

In our recent webinar, Unlocking Alpha with Gurobi: Advanced Portfolio Optimization and Backtesting with Discrete Constraints, Gurobi experts demonstrated how mathematical optimization can help financial services firms overcome these challenges and gain a competitive edge. 

The event featured Gurobi’s Dr. Robert Luce, Principal Developer, and Dr. Silke Horn, Senior Optimization Engineer, who shared insights from their research and experience helping customers apply optimization in finance. The session concluded with a live Q&A led by Senior Engineers David Torres Sanchez and Dan Steffy.
 

From Classical Theory to Real-World Constraints 

Dr. Luce began by revisiting the classical mean-variance portfolio optimization framework pioneered by Harry Markowitz in the 1950s. This model balances expected returns against risk, producing an “optimal” portfolio under simplified assumptions. It remains one of the most widely studied models in finance. 

But while elegant, the mean-variance approach assumes a world without friction. In practice, portfolio managers face numerous discrete decisions and constraints: 

  • Minimum holding sizes: Avoiding tiny positions that add complexity without impact. 
  • Turnover limits: Restricting how much a portfolio can change from one period to the next. 
  • Transaction costs: Accounting for fees, spreads, and slippage. 
  • Diversification rules: Ensuring exposure across sectors or asset classes. 
  • Lot sizes and tax considerations: Reflecting how trades are executed and taxed. 

These constraints can’t be modeled accurately using traditional continuous optimization techniques. However, with Gurobi’s mixed-integer optimization technology, they can be built directly into the model. That means the resulting strategies are not only mathematically optimal but also practical and executable in real markets. 

Dr. Luce illustrated this with a simple example: adding a cardinality constraint (limiting the number of assets in a portfolio). By introducing binary decision variables, Gurobi makes it possible to restrict allocations to a manageable number of positions—something impossible in pure continuous models. 


The Role of Backtesting
 

While designing one “optimal” portfolio is valuable, the real test is whether a strategy can stand up over time. That’s where backtesting comes in. 

Dr. Horn explained that backtesting applies investment strategies to historical data to measure how they would have performed under actual market conditions. This process: 

  • Validates assumptions before capital is deployed. 
  • Reveals weaknesses that may not be obvious from a single optimization run. 
  • Provides comparisons to benchmarks and alternative approaches. 

In the webinar, Dr. Horn and Dr. Luce used 10 years of S&P 500 data—covering 459 stocks that were part of the index throughout the decade—to demonstrate how backtesting works in practice. They showed how rebalancing, turnover constraints, transaction costs, and minimum trade sizes can be modeled to mirror the realities of portfolio management. 

Backtesting isn’t just about avoiding mistakes. The faster and more extensively you can test, the more opportunities you must discover new alpha-generating strategies. 

 

Scaling Performance with Gurobi 

One of the biggest challenges in backtesting is performance. Running thousands of scenarios across long time horizons can be computationally intensive. Here’s where Gurobishines. 

The presenters highlighted three techniques for dramatically improving backtesting speed and efficiency: 

  1. Parameter Tuning
    Adjusting solver parameters tailored to the model structure reduced runtime by more than half in their tests. For customers, Gurobi’s Expert Team is available to help with this tuning process. 
  2. Model Reuse
    Instead of rebuilding a model from scratch at every rebalancing step, users can update only the parts that change (such as returns or factor exposures). This reduced modeling time by more than threefold. 
  3. Parallelization
    By running independent strategies in parallel across multiple CPU cores, firms can test far more scenarios in less time. Even on a laptop, parallelization produced runtime improvements of up to three times. 


Together, these methods help firms scale their analysis—allowing them to test more strategies, uncover more insights, and ultimately, find more ways to unlock alpha.
 

 

Insights from the Q&A 

The Q&A portion of the webinar highlighted the kinds of real-world questions practitioners face. Topics included: 

  • Risk measures: How to incorporate Conditional Value at Risk (CVaR) into optimization. 
  • Debugging infeasibility: Using Gurobi’s IIS infeasibility finder and feasibility relaxation tools to diagnose and fix problematic models. 
  • Practical trading issues: Modeling round-lot trades, integrating trading signals, and managing constraints like turnover and diversification. 
  • Performance trade-offs: Understanding the differences between continuous models and mixed-integer models, and why the latter often deliver better practical results even if they require more computational effort. 

The takeaway? Optimization isn’t just about mathematics—it’s about building models that reflect the realities of trading and can be solved efficiently with the right tools. 

 

Key Takeaways 

  • Optimization with constraints matters: Real-world trading involves discrete rules, and Gurobi makes it possible to model them directly. 
  • Backtesting is essential: Validating strategies against history builds confidence and reduces risk. 
  • Performance unlocks opportunity: The more strategies you can test, the better your chances of discovering alpha. 
  • Expert support is available: From parameter tuning to feasibility analysis, Gurobi’s team can help firms get the most from their models. 

In an industry where fractions of a percent can mean the difference between success and underperformance, the ability to design, test, and refine strategies quickly is a critical edge. With Gurobi, firms can move beyond theory to create investment strategies that are both powerful and practical. 

To learn more, watch the full webinar on demandor explore our portfolio optimization resources to see how Gurobi can help you unlock more alpha. 

Kathleen Spalding
AUTHOR

Kathleen Spalding

Marketing Manager

AUTHOR

Kathleen Spalding

Marketing Manager

Kathleen Spalding builds and executes marketing strategies that bridge the gap between advanced technology and meaningful customer engagement. She’s driven by curiosity and a passion for turning analytical insights into creative, results-oriented campaigns. At Gurobi, Kathleen focuses on connecting audiences to the power of mathematical optimization and data-driven decision intelligence. She holds a B.B.A. in Marketing and enjoys exploring new ideas, traveling, and spending time with her family.

Kathleen Spalding builds and executes marketing strategies that bridge the gap between advanced technology and meaningful customer engagement. She’s driven by curiosity and a passion for turning analytical insights into creative, results-oriented campaigns. At Gurobi, Kathleen focuses on connecting audiences to the power of mathematical optimization and data-driven decision intelligence. She holds a B.B.A. in Marketing and enjoys exploring new ideas, traveling, and spending time with her family.

Guidance for Your Journey

30 Day Free Trial for Commercial Users

Start solving your most complex challenges, with the world's fastest, most feature-rich solver.

Always Free for Academics

We make it easy for students, faculty, and researchers to work with mathematical optimization.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Academic License
Gurobi provides free, full-featured licenses for coursework, teaching, and research at degree-granting academic institutions. Academics can receive guidance and support through our Community Forum.

Search

Gurobi Optimization

Navigation Menu