This directory contains runnable Python examples demonstrating Divi's capabilities. Each example is self-contained and can be run independently.
To run any example:
cd tutorials
python <example_name>.pyTutorials that use get_backend() from _backend.py accept these CLI flags:
| Flag | Backend | Description |
|---|---|---|
--local-qiskit (default) |
QiskitSimulator |
Local Qiskit Aer simulation |
--local-maestro |
MaestroSimulator |
Local Maestro orchestration |
--cloud-maestro |
QoroService |
Qoro cloud backend |
--force-sampling |
— | Disable exact expectation values; use shot-based sampling instead |
python qaoa_max_clique.py --local-qiskit
python qaoa_max_clique.py --cloud-maestro
python qaoa_max_clique.py --local-qiskit --force-samplingvqe_h2_molecule.py- Basic VQE calculation for H2 moleculevqe_h2_with_grouping.py- VQE with wire grouping for efficiencyvqe_hyperparameter_sweep.py- Hyperparameter sweeps across multiple molecules
qaoa_qubo.py- QAOA for QUBO optimization problemsqaoa_hubo.py- QAOA for Higher-Order Binary Optimization (HUBO) problemsqaoa_binary_quadratic_model.py- QAOA for BinaryQuadraticModel inputsqaoa_qubo_partitioning.py- QUBO partitioning for scalabilitypce_qubo.py- PCE-VQE for a QUBO problem
qaoa_max_clique.py- Basic QAOA for maximum clique problemqaoa_max_weight_matching.py- Maximum-weight matching with QAOA (standalone and partitioned)qaoa_graph_partitioning.py- Large graph partitioning with QAOAqaoa_qdrift.py- QAOA with QDrift randomized Trotterizationiterative_qaoa.py- Iterative QAOA with parameter interpolation vs standard QAOA
ce_qaoa_tsp.py- TSP with Constraint-Enhanced QAOA: grid search, parameter transfer, feasibility stats, repairce_qaoa_cvrp.py- CVRP with CE-QAOA: one-hot vs binary encoding, qubit projections, VRP file parser
error_mitigation.py- VQE with Zero Noise Extrapolation (ZNE) and probabilistic error amplification
time_evolution.py- Hamiltonian time evolution with probs, observables, and QDrifttime_evolution_trajectory.py- Time-evolution trajectories over multiple time points
standalone_pipeline.py- One-shot execution of PennyLane / Qiskit circuits throughCircuitPipelinedirectly (noQuantumProgramwrapper, no optimization loop)custom_vqa.py- Full variational optimization over a user-supplied parametric PennyLane / Qiskit circuit viaCustomVQA
viz_qaoa_pce_comparison.py- Compare QAOA and PCE loss landscapes: 1D scans, 2D scans, PCA scans with trajectory overlayviz_advanced_analysis.py- Interpolation scans, Hessian eigenvalue analysis (parameter-shift vs finite-difference), Fourier power spectra, gradient overlays, 3D surface plots, NEB minimum-energy paths
checkpointing.py- Save and resume optimization runs with checkpointing
qasm_thru_service.py- Using QoroService cloud backendbackend_properties_conversion.py- ConvertingBackendPropertiesto A QiskitBackendV2
All examples require Divi to be installed:
pip install qoro-diviFor comprehensive documentation and detailed explanations, see the User Guide.
When adding new examples:
-
Keep examples focused and self-contained
-
Add clear docstrings explaining the example's purpose
-
Include expected output in comments
-
Update this README with a brief description
-
Register in
_ci_runner.py: All tutorials are executed in CI to catch regressions — if a code change breaks a tutorial, the pipeline fails. To keep CI fast, tutorials run with reduced parameters (fewer iterations, smaller problems, lower shots). The runner copies tutorials to a temp directory, applies string patches, and runs them in parallel with per-tutorial timeouts.Every non-underscore
.pyfile must appear in exactly one of these three lists (validated at startup):SKIP— tutorials that cannot run in CI (e.g. need API keys)NO_PATCHES— tutorials that run as-is (shots capped byDIVI_CI_MAX_SHOTS)TUTORIALS— tutorials that need source patches (e.g. fewer iterations, smaller problems) and/or custom timeouts