ProvideQ / toolbox-server

Resources for the server that hosts the toolbox (Backend)
https://provideq.kit.edu
MIT License
2 stars 1 forks source link

Fix Qiskit Knapsack Solver #90

Closed koalamitice closed 3 weeks ago

koalamitice commented 1 month ago

The Qiskit Knapsack Solver runs without any issues for the test case provided in the resources directory.

When testing the frontend, I noticed that it does not work when for other problems. (I typed in some newly random problems). Example: 2 1 2 3 2 3 5 10

This example can be solved by the HS knapsack solver, but not by the qiskit knapsack solver.

Error Message:

knapsack problem couldn't be solved:
Traceback (most recent call last):
  File "/Users/koalamitice/Desktop/toolbox-server/solvers/qiskit/knapsack/knapsack_qiskit.py", line 62, in <module>
    achieved_sum += values[i]
IndexError: list index out of range

Screenshot of the Error:

Bildschirmfoto 2024-09-11 um 13 25 03