From c26ed86a02da7a8618cca516a5f20f680e5144d6 Mon Sep 17 00:00:00 2001 From: Bruno Rosendo Date: Thu, 18 Apr 2024 03:15:45 +0100 Subject: [PATCH] Solved ISA error by adding fixed qiskit-algorithms fork --- .gitmodules | 3 +++ src/main.py | 4 +++- src/qiskit_algorithms | 1 + src/solver/qubo/CplexSolver.py | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 160000 src/qiskit_algorithms diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..77f9f42 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "src/qiskit_algorithms"] + path = src/qiskit_algorithms + url = https://github.com/BrunoRosendo/qiskit-algorithms diff --git a/src/main.py b/src/main.py index 94e6c9e..e9db5bc 100644 --- a/src/main.py +++ b/src/main.py @@ -1,6 +1,6 @@ from dotenv import load_dotenv -from src.solver.qubo.CplexSolver import CplexSolver +from src.solver.qubo.CplexSolver import CplexSolver, get_backend_sampler if __name__ == "__main__": load_dotenv() @@ -16,6 +16,8 @@ (0, 1, 6), ], True, + sampler=get_backend_sampler(), + warm_start=True, ) result = cvrp.solve() result.print() diff --git a/src/qiskit_algorithms b/src/qiskit_algorithms new file mode 160000 index 0000000..a5df93a --- /dev/null +++ b/src/qiskit_algorithms @@ -0,0 +1 @@ +Subproject commit a5df93a57fcee82b74d4057600de36ad93d1357c diff --git a/src/solver/qubo/CplexSolver.py b/src/solver/qubo/CplexSolver.py index 7ffcaea..4fc4796 100644 --- a/src/solver/qubo/CplexSolver.py +++ b/src/solver/qubo/CplexSolver.py @@ -4,7 +4,6 @@ from docplex.util.status import JobSolveStatus from numpy import ndarray from qiskit.primitives import Sampler -from qiskit_algorithms import QAOA from qiskit_algorithms.optimizers import COBYLA, Optimizer from qiskit_ibm_runtime import ( QiskitRuntimeService, @@ -28,6 +27,7 @@ from src.model.VRPSolution import VRPSolution from src.model.adapter.CplexAdapter import CplexAdapter +from src.qiskit_algorithms.qiskit_algorithms import QAOA from src.solver.qubo.QuboSolver import QuboSolver DEFAULT_SAMPLER = Sampler()