This guide explains how to create, upload, and execute QUBO using the Quanfluence.
Install the quanfluence-sdk and requests packages:
pip install quanfluence-sdk requests- Create a QUBO problem file
- Upload the QUBO file to the Quanfluence platform
- Execute the uploaded QUBO problem
- Re-run the QUBO problem without re-uploading
create_qubo.py: Creates a QUBO file for a Max-Cut problem (A simple example that I used for test)upload_example.py: Uploads and executes a QUBO filerun_example.py: Executes a previously uploaded QUBO filemax_cut_triangle.qubo: Example QUBO file (created bycreate_qubo.py)bqm_example.py: Additional example for working with Binary Quadratic Models
I create a create_qubo.py file to generate a QUBO file (You can create your own code to create the qubo problem you want):
python create_qubo.pyThis script creates a simple Max-Cut problem on a triangle graph and saves it as max_cut_triangle.qubo.
Use upload_example.py to upload your QUBO file (like the 'max_cut_triangle.qubo' I generated above) to the Quanfluence platform and execute it:
python upload_example.pyImportant:
- Note the filename returned after uploading (it will be printed in the console). You'll need this filename for subsequent runs.
upload_example.pyshould only be run once to upload a QUBO file or to update parameters.- For multiple executions of the same problem, use
run_example.pyto avoid unnecessary uploads as following Step 3. - The device ID and user credentials are preconfigured and should not be changed.
For subsequent runs of your QUBO problem (without re-uploading), use run_example.py:
-
First, edit
run_example.pyto specify the qubo filename path you received from the upload step. -
Then run the script:
python run_example.pyFor more detailed information, please refer to README_quickstart.pdf.