jpmorganchase / QOKit

QOKit
https://www.jpmorgan.com/technology/applied-research
Apache License 2.0
51 stars 23 forks source link

Avoid precomputing energies outside of the simulator #35

Open HaoTy opened 9 months ago

HaoTy commented 9 months ago

In certain conditions, when precomputed_costs is not provided by the user, qokit would calculate it with CPU-version functions outside of the simulator. This is intractable when the number of qubits is high. Instead, precomputed_costs should be either user-provided or calculated in fur with the user-specified backend, whenever possible. The explicit retrieving precomputed_costs from the simulator and re-passing-in when calling the simulator objective functions should also be avoided, which, when the backend is GPU, can eliminate an unnecessary copy of the large energy vector in the CPU memory and reduce communication time.

34 needs to be addressed to correctly implement this. Constraint-related values (e.g. portfolio optimization overlap) will be tricky for the simulator to calculate and have to be done outside of the simulator for now.