QAOA portfolio rebalancing implementation#
Quantum Cost Operator#
- portfolio_cost_operator(problem)[source]#
- Quantum cost operator for the discrete portfolio rebalancing problem, as described in https://arxiv.org/pdf/1911.05296.pdf.It is depended on the problem instance, including the old portfolio positions, the normalized covariance matrix, the normalized asset returns and trading costs. See example implementation for formatting.
- Parameters:
- problemList
A list containing a the relevant data for the problem instance.
- Returns:
- portfolio_cost_op: function
A callable function to be applied to a QuantumArray for solving the problem instance.
Classical cost function#
- portfolio_cl_cost_function(problem)[source]#
- Classical cost function for the discrete portfolio rebalancing problem, as described in https://arxiv.org/pdf/1911.05296.pdf.
|It is depended on the problem instance, including the old portfolio positions, the normalized covariance matrix, the normalized asset returns and trading costs. See example implementation for formatting.
- Parameters:
- problemList
A list containing a the relevant data for the problem instance.
- Returns:
- cl_cost_function: function
A callable function to calculate the cost value of the problem solution.
State initialization#
- portfolio_init(lots)[source]#
- Initial state for the discrete portfolio rebalancing problem, as described in https://arxiv.org/abs/1904.07358.Depending on the number of lots a QuantumArray is prepared, where the first index describes the short positions held and the second index describes the long postions held.
- Parameters:
- lotsInt
The number of lots in the initial portfolio position
- Returns:
- state_prep: function
A callable function to be applied to a QuantumArray to receive the initial state for the problem.