Package: quixotic
Welcome to QuixoticWhat is Quixotic?Quixotic is a Python library for simple-to-use, low-code quantum computing.FeaturesEasy-to-apply quantum algorithms for a number of combinatorial optimization problems usingQuantum AnnealingandQAOA.Includes out-of-the-box support for various optimization problems like maximum clique and minimum vertex cover.Supports custom problem formulations asQUBOs.Simple-to-use execution of algorithms using both local simulation on your laptop and managed quantum computers onAmazon Braketor the D-Wave LEAP service.Quantum is Optional: serves as a general-purpose optimization library allowing you to solve problems on your laptop using simulated annealing and exact solversInstallpip install -U pippip install quixoticNOTE: Python version>= 3.7is required.Usage Example: Find Maximum Clique in a Graph# construct or load your input graphimportnetworkxasnxseed=1967g=nx.erdos_renyi_graph(6,p=0.5,seed=seed)positions=nx.spring_layout(g,seed=seed)nx.draw(g,with_labels=True,pos=positions)# approximate a solution using QuantumAnnealer and extract resultsfromquixotic.coreimportQuantumAnnealerqo=QuantumAnnealer(g,task='maximum_clique').execute()nodes=qo.results()Executing locally.# plot nodes comprising the solutionsub=g.subgraph(nodes)nx.draw(g,pos=positions,with_labels=True)nx.draw(sub,pos=positions,node_color="r",edge_color="r")How to Execute on a Quantum Computer:By default,Quixoticuses a local solver or simulator (e.g., quantum simulator, simulated annealing), which allows you to easily run and test on your CPU-based laptop.  To run on an actual managed quantum computer hosted on Amazon Braket, simply set the backend toawsand supply thedevice_arnands3_folderparameters.  Here is an example of using theQuantumAnnealeron a quantum computer managed by Amazon Braket:fromquixotic.coreimportQuantumAnnealerqo=QuantumAnnealer(g,task='maximum_clique',backend='aws',# Amazon AWS as backenddevice_arn='arn:aws:braket:::device/qpu/d-wave/DW_2000Q_6',# D-Wave QPUs3_folder=("amazon-braket-Your-Bucket-Name","Your-Folder-Name"))qo.execute()# executes algorithm on quantum hardware managed by Amazon Braketsolution_nodes=qo.results()For theQuantumAnnealer, you can alternatively use D-Wave LEAP as a backend by specifyingbackend='dwave'.  However, to use a managed quantum computer, you'll need to first create an account with one of the backend providers using the instructions below:Setting up an Amazon Braket AccountCreate an AWS account and activateAmazon Braket.During the onboarding process in the previous step, you will generate an Amazon Braket bucket of the formamazon-braket-XXXXXX.  Make note of this.If runningQuixoticon your laptop and using a remote quantum device, you'll have toconfigure and store  your AWS credentials locally. If using a managed notebook within Amazon Braket itself, you can skip this step.Setbackend='aws'in addition to thedevice_arnands3_folderparameters when executing either theQuantumAnnealeror theQAOAalgorithm, as shown above.Setting up a D-Wave LEAP AccountTheQuantumAnnealercan also use D-Wave LEAP as a backend instead of Amazon Braket, if following the steps below.  (LEAP is D-Wave's cloud-based quantum service.)Create a LEAP account and make note of the API Token assigned to you.AfterQuixoticis installed, run the command:dwave config create.  Copy and paste your API token when prompted and select defaults for everything else.When usingQuantumAnnealerinQuixotic, setbackend='dwave'and run the code below to use the default solver:# Executing on D-Wave quantum backendfromquixotic.coreimportQuantumAnnealersolution_nodes=QuantumAnnealer(g,task='maximum_clique',backend='dwave').execute().results()