Geliştirici, SDK ve REST API dokümantasyonuDeveloper, SDK and REST API documentation
Aynı API JavaScript (Node.js ve tarayıcı) ve saf Python'da bulunur. Zorunlu bağımlılık yoktur; NumPy, Mitiq, Cirq, Qiskit, dimod ve PennyLane yalnızca kullanıldığında yüklenir. Bütün örnekler kopyalanabilir ve tohumlu olduğu için tekrarlanabilir.The same API exists in JavaScript (Node.js and browser) and pure Python. There are no mandatory dependencies; NumPy, Mitiq, Cirq, Qiskit, dimod and PennyLane are imported only when used. Every example can be copied and is seeded, so it is reproducible.
Node.js≥ 18
Python≥ 3.9
Zorunlu bağımlılıkMandatory dependencies0
JSON API ucuJSON API endpoints10
KurulumInstallation
Paket adı her iki dilde quboforge. Depoyu doğrudan kullanıyorsanız kurulum gerekmez: src/index.mjs ve python/quboforge olduğu gibi içe aktarılır.The package is called quboforge in both languages. Working from the repository needs no install step: src/index.mjs and python/quboforge can be imported as they are.
Çekirdek, Node.js 18+ ve modern tarayıcılarda değişmeden çalışan ES modüllerinden oluşur. solve() her çözücü için tek kapıdır ve hem QUBO hem Ising enerjisini (ikisi aynıdır) döndürür.The core is a set of ES modules that run unchanged in Node.js 18+ and modern browsers. solve() is the single front door for every solver and returns the energy, identical in the QUBO and Ising picture.
solve.mjs
import * as qf from 'quboforge'; // or './src/index.mjs' from the repository
// Max-Cut on a seeded 3-regular graph with discrete simulated bifurcation
const ising = qf.maxCutToIsing(qf.randomRegularGraph(12, 3, 2026));
const best = qf.solve(ising, { solver: 'dsb', seed: 1, steps: 600, nTrajectories: 32 });
console.log(best.energy, best.x); // x: 0/1 bits, spins: -1/+1
// Your own QUBO as a dictionary {"i,j": weight}
const qubo = qf.quboFromDict({ '0,0': -1, '0,1': 2, '1,1': -1 }, 2);
console.log(qf.solve(qubo, { solver: 'bruteforce' }).energy);
// Industrial compilers return baseline, optimized and validation
const cut = qf.cuttingStock.solveCuttingStock(qf.cuttingStock.CUTTING_PRESETS.glass_facade);
console.log(cut.baseline.sheetCount, cut.optimized.sheetCount, cut.validation.optimized.ok);
const roster = qf.shiftRostering.solveRoster(qf.shiftRostering.ROSTER_PRESETS.factory_3shift);
console.log(roster.optimized.assignmentCount, roster.optimized.hardViolations);
Çözücüler: dsb, bsb, sa, tabu, greedy, bruteforce, qaoa. Derleyiciler: cuttingStock, cvrp, shiftRostering, binPacking3d, energyArbitrage; gürültü ve ZNE için noise.Solvers: dsb, bsb, sa, tabu, greedy, bruteforce, qaoa. Compilers: cuttingStock, cvrp, shiftRostering, binPacking3d, energyArbitrage; noise and ZNE live in noise.
Tarayıcı: klasik bundle ve file://Browser: classic bundle and file://
Tarayıcılar diskten açılan sayfalarda ES modülü içe aktarımlarını reddeder. Bu yüzden scripts/build-bundle.mjs aynı kaynakları tek bir klasik betiğe paketler: quboforge.bundle.js. Betik, kütüphaneyi window.QuboForge olarak sunar ve hem http:// hem file:// altında çalışır. Canlı Stüdyo bu yolu kullanır.Browsers refuse ES module imports on pages opened from disk. scripts/build-bundle.mjs therefore packs the same sources into one classic script, quboforge.bundle.js. It exposes the library as window.QuboForge and works under http:// and file:// alike. The Live Studio uses exactly this path.
npm run build # writes web/quboforge.bundle.js
npm run build:check # exit code 1 if the bundle is stale
Python + NumPy
Saf Python paketi aynı modülleri yansıtır. NumPy kuruluysa backend="auto" bütün yörüngeleri tek bir (M, N) matrisi olarak işler; her adımda tek çarpım F = sgn(X) Jᵀ + h hesaplanır. Başlangıç koşulları saf arka uçla aynı tohumlu üreteçten gelir.The pure-Python package mirrors the same modules. With NumPy installed, backend="auto" treats all trajectories as one (M, N) matrix and computes a single product F = sgn(X) Jᵀ + h per step. Initial conditions come from the same seeded generator as the pure backend.
solve.py
import quboforge as qf # or sys.path.insert(0, "python") in the repository
ising = qf.max_cut_to_ising(qf.random_regular_graph(12, 3, seed=2026))
fast = qf.dsb(ising, seed=1, steps=600, n_trajectories=32, backend="auto")
print(fast["energy"], fast["params"]["backend"]) # "numpy" when NumPy is installed
from quboforge.compilers import shift_rostering as ro
plan = ro.solve_roster(ro.ROSTER_PRESETS["factory_3shift"], seed=1)
print(plan["optimized"]["assignment_count"], plan["optimized"]["hard_violations"])
CLI & IBM Quantum Heron r2
Kuru çalıştırma (--dry-run) devreyi {rz, sx, x, cz} yerel kapı kümesine yeniden yazar ve varsayılan Heron sınıfı hata oranlarıyla yerelde örnekler. Bu oranlar herhangi bir cihazın kalibrasyon verisi değildir. Gerçek donanım için IBM_QUANTUM_TOKEN ortam değişkenini ayarlayın; heavy-hex yerleşimi ve yönlendirme Qiskit transpiler tarafından yapılır.The dry run (--dry-run) rewrites the circuit to the native {rz, sx, x, cz} gate set and samples locally under assumed Heron-class error rates. These rates are not calibration data of any device. For real hardware set IBM_QUANTUM_TOKEN; heavy-hex layout and routing are done by the Qiskit transpiler.
shell
# local rehearsal, no account needed
python -m quboforge.ibm_runtime --dry-run --nodes 6 --p 1 --shots 4000
# real Heron r2 processor (ibm_fez, ibm_marrakesh, ibm_kingston)
export IBM_QUANTUM_TOKEN=<your API key>
python -m quboforge.ibm_runtime --backend ibm_fez --nodes 10 --p 1 --shots 4000
Hesabınıza açık işlemcileri IBM Quantum Platform üzerinden kontrol edin. IBM_QUANTUM_CHANNEL ve IBM_QUANTUM_INSTANCE servis kanalını ve örneği değiştirir. Anahtarınızı depoya veya istemlere yazmayın.Check which processors your account can use on the IBM Quantum Platform. IBM_QUANTUM_CHANNEL and IBM_QUANTUM_INSTANCE override the service channel and instance. Never commit your key or paste it into prompts.
OpenQASM 3.0 & Mitiq ZNE
QAOA devresi OpenQASM 3.0 metni olarak üretilir: her ZZ terimi cx; rz(2γw); cx, karıştırıcı rx(2β). Bağımsız bir kapı seviyesi simülatörü üretilen metni yeniden yürütür. Gürültü modülü devreyi kesin yoğunluk matrisi üzerinde depolarizan kanallarla çalıştırır, kapıları 1, 3, 5 ölçeğinde katlar ve Richardson ile sıfır gürültüye ekstrapole eder.The QAOA circuit is emitted as OpenQASM 3.0 text: each ZZ term as cx; rz(2γw); cx, mixer rx(2β). An independent gate-level simulator re-executes the emitted text. The noise module runs the circuit on an exact density matrix with depolarizing channels, folds gates at scales 1, 3, 5 and extrapolates to zero noise with Richardson.
import quboforge as qf
from quboforge import ecosystem, mitiq_bridge as mb
model = qf.max_cut_to_ising(qf.random_regular_graph(4, 3, seed=1))
z = qf.zne_qaoa(model, p=1, p1=0.001, p2=0.02)
print(z["errors"]["unmitigated"], z["errors"]["richardson"])
qasm = ecosystem.to_openqasm3(model, p=1, gammas=[0.3], betas=[0.2])
circuit = ecosystem.to_qiskit_circuit(qasm) # needs quboforge[ibm]
if mb.mitiq_available(): # needs quboforge[mitiq]
out = mb.run_with_mitiq(model, [0.4], [0.3], p1=0.001, p2=0.02)
print(out["errors"]["mitigated"], out["errors"]["unmitigated"])
REST API · server.mjs
server.mjs sıfır bağımlılıklı bir Node.js HTTP sunucusudur: siteyi, Canlı Stüdyo'yu ve aşağıdaki JSON uçlarını sunar. Varsayılan olarak yalnızca 127.0.0.1 adresini dinler. Bütün POST gövdeleri JSON'dur; seçenekler sunucu tarafından beyaz listeyle süzülür ve sınırlanır.server.mjs is a zero-dependency Node.js HTTP server: it serves the site, the Live Studio and the JSON endpoints below. By default it listens on 127.0.0.1 only. Every POST body is JSON; options are whitelisted and clamped by the server.
Gövde: graph: { n, edges } (Max-Cut) veya qubo: { "i,j": w } + isteğe bağlı n, offset; solver (dsb varsayılan) ve options. Yanıt: energy, x, spins, elapsedMs, params.Body: graph: { n, edges } (Max-Cut) or qubo: { "i,j": w } with optional n, offset; solver (default dsb) and options. Response: energy, x, spins, elapsedMs, params.
QAOA açılarını kesin durum vektörüyle optimize eder (en çok 14 kübit, p 1 ile 3 arası). Yanıt: gammas, betas, expectation, groundEnergy, approxRatio, pOptimal, bestSample, qasm.Optimises QAOA angles on an exact statevector (at most 14 qubits, p from 1 to 3). Response: gammas, betas, expectation, groundEnergy, approxRatio, pOptimal, bestSample, qasm.
Gürültülü QAOA + sıfır gürültü ekstrapolasyonu (en çok 8 kübit). p1, p2, readout hata oranları; scales en az iki farklı tek sayı (1 ile 9 arası). Yanıt: ideal, noisy[], zne.richardson, zne.linear, errors, qasm.Noisy QAOA + zero-noise extrapolation (at most 8 qubits). p1, p2, readout are error rates; scales needs at least two distinct odd integers between 1 and 9. Response: ideal, noisy[], zne.richardson, zne.linear, errors, qasm.
Tanıtım sunucusu tek bir isteğin sunucuyu kilitlememesi için boyutları kontrol eder ve çözücü seçeneklerini sınırlar. Şirket içi kurulumda bu sınırlar ihtiyaca göre ayarlanır.The demo server checks sizes and clamps solver options so that a single request cannot stall it. On-premise deployments tune these limits.
UçEndpoint
SınırLimit
/api/solve
en çok 2000 değişkenat most 2000 variables
/api/qaoa
en çok 14 kübit, p ≤ 3at most 14 qubits, p ≤ 3
/api/zne
en çok 8 kübit, p ≤ 2, ölçekler 1 ile 9 arası tek sayılarat most 8 qubits, p ≤ 2, scales are odd integers from 1 to 9
/api/cutting-stock
100 parça türü, 1000 parça100 part types, 1000 parts
/api/cvrp
müşteri × araç ≤ 1500customers × vehicles ≤ 1500
/api/roster
60 çalışan, 31 gün60 employees, 31 days
/api/load-3d
30 koli türü, 300 koli30 box types, 300 boxes
/api/energy
96 zaman dilimi, 30 parti96 time slots, 30 batches
TümüAll
gövde en çok 1 MiB; hatalar { "error": "..." } ile 400, 404, 405 veya 413 dönerbody at most 1 MiB; errors return { "error": "..." } with 400, 404, 405 or 413