This is wrong! It's been scheduled for a while, and new experimentation has drawn new suspicions and conclusions. I'm publishing it, however, because this article being wrong is going to be important in explaining (hopefully) how to do it right.
In HHL Portfolio Optimization, Round 1, The Quantum Dragon used the QCentroid platform to try out the HHL algorithm for portfolio optimization. Then in The HHL Dragon vs LSS vs CPLEX, he used the QCentroid platform to compare HHL to two classical solvers. But there had been a serious problem… until now.
The unnamed software development kit (SDK) was Qiskit. It could handle a 30-asset toy implementation, but it crashed my laptop’s RAM with a 511-asset file. Even worse, it crashed QCentroid’s 32 GB RAM server. And this wasn’t even simulating the circuit yet, but rather building it in the first place. How can we possibly leverage HHL for its potential exponential advantages on real hardware if we can’t even build the circuits for it?
But is it actually an HHL problem? The only way to know for sure was to try other SDKs. Sure enough, PennyLane handled the 511-asset file on my laptop. HHL is a viable algorithm after all.
30 Assets — Qiskit vs PennyLane vs LSS vs CPLEX
I used the 30-asset file simply to be able to compare all 4 solvers at this point. ‘HHL demo’ refers to Qiskit. The Quantum Dragon had originally intended to focus on the algorithm, not the SDK, hence the name.
Cost can be ignored because this is just testing.
As we saw in Round 2, the solvers focused on different parts of the objective function. LSS slightly edged Qiskit on expected returns, while Qiskit had an edge over LSS on Sharpe Ratio. CPLEX fared the worst on both.
Then we saw CPLEX edge out PennyLane on minimizing variance, but this pulled down CPLEX’s expected returns and Sharpe Ratio much more than it did for PennyLane. LSS fared the worst.
Then we saw LSS edge out CPLEX on speed, while PennyLane trailed the pack. Qiskit and PennyLane both needed time to build their respective circuits and run their respective classical simulators. But before you start calling Qiskit the “most performant” SDK, it’s important to remember that Qiskit’s journey ended here.
511 Assets — PennyLane vs LSS vs CPLEX
Once again, we can ignore cost for testing purposes.
LSS edged out PennyLane on expected return, while CPLEX trailed.
PennyLane then had the better Sharpe Ratio. It fared much better than LSS on minimizing variance while hanging in there on expected return. Again, CPLEX focused on minimizing variance, so it trailed here again.
Interestingly, PennyLane sped up. Again, this was classical simulation, but PennyLane ran faster with 511 assets than it did with 30 while still leading on Sharpe Ratio. So, it didn’t just speed up and spew garbage, which I have seen other solvers do, but rather it fared better qualitatively as well.
Conclusion
There are more than two quantum computing SDKs, so The Quantum Dragon wants to compare PennyLane to as many of them as he can. He needs to find the truly “most performant” SDK before he can begin focusing on HHL. Then he’ll be able to add real-world constraints, increase the number of assets, and so forth.
Before that, however, the next article in this series will look at QCentroid’s features. The Quantum Dragon has been focused on getting these solvers to work and hasn’t taken the time to stop and smell QCentroid’s proverbial roses. While he’s doing that, he’ll be testing the other SDKs in parallel. Then, the next article after that one will hopefully compare a bunch of SDKs on the 30-asset and 511-asset files.
HHL Portfolio Optimization Series
Round 3: The Qiskit vs PennyLane Dragons
Premium: Burned to a Qrisp
Premium: HHL Behind-the-Scenes
Round 2: HHL vs LSS vs CPLEX
Round 1: HHL
Image generated by an AI model provided by Microsoft Copilot.