Quantum
Algorithm Reference
TARX Quantum ships five solvers. Each wraps a quantum or quantum-inspired algorithm behind the same POST /api/solve interface. This page documents every solver, its complexity profile, problem schema, and recommended use cases.
QAOA — TARX Optimizer
The Quantum Approximate Optimization Algorithm finds near-optimal solutions to combinatorial optimization problems. Classical brute-force is O(2n). TARX Quantum uses parameterized quantum-inspired sampling to converge in polynomial iterations, delivering practical speedups on problems with 20–200 variables.
| Problem type | Combinatorial optimization (TSP, VRP, scheduling, bin packing) |
| Classical complexity | O(2ⁿ) — exponential |
| TARX complexity | Polynomial-time sampling with tunable depth |
| Best for | Logistics, supply chain, defense route planning |
import requests
response = requests.post("http://localhost:11435/api/solve", json={
"solver": "qaoa",
"problem": {
"type": "route_optimization",
"nodes": [
{"id": "depot", "lat": 40.7128, "lng": -74.0060},
{"id": "warehouse_a", "lat": 40.7580, "lng": -73.9855},
{"id": "warehouse_b", "lat": 40.7484, "lng": -73.9857},
{"id": "customer_c", "lat": 40.7614, "lng": -73.9776}
],
"constraints": {
"max_distance_km": 50,
"vehicle_count": 2,
"time_windows": [
{"node": "customer_c", "start": "09:00", "end": "12:00"}
]
}
},
"substrate": "local",
"shots": 2048
})
result = response.json()
for route in result["solution"]["routes"]:
print(route["vehicle"], route["stops"], f'{route["distance_km"]}km')Grover — TARX Search
Grover's algorithm finds a target element in an unstructured dataset. Classical search requires O(N) comparisons. TARX Search achieves O(√N) using amplitude amplification, providing quadratic speedup on pattern detection and anomaly finding.
| Problem type | Finding an optimal match in unstructured data |
| Classical complexity | O(N) — linear scan |
| TARX complexity | O(√N) — quadratic speedup |
| Best for | Cybersecurity threat detection, fraud pattern matching |
response = requests.post("http://localhost:11435/api/solve", json={
"solver": "grover",
"problem": {
"type": "pattern_search",
"dataset": "threat_signatures_2026q1",
"target": {
"pattern": "lateral_movement",
"min_confidence": 0.85
},
"search_space_size": 1_000_000
},
"substrate": "local",
"shots": 4096
})
match = response.json()["solution"]
print(match["target_index"], match["confidence"])
# → 847293 0.97QKMeans — TARX Cluster
Quantum kernel k-means uses a quantum feature map to compute distances in a higher-dimensional Hilbert space. This captures non-linear cluster boundaries that classical k-means misses. The quantum kernel metric is computed efficiently using parameterized circuits, then fed into a classical k-means loop.
| Problem type | Unsupervised segmentation and clustering |
| Classical complexity | O(nkd) per iteration — limited to linear boundaries |
| TARX complexity | Quantum kernel metric in O(d²) feature space |
| Best for | Healthcare patient stratification, customer analytics, anomaly clustering |
response = requests.post("http://localhost:11435/api/solve", json={
"solver": "qkmeans",
"problem": {
"type": "clustering",
"data": [
{"id": "p001", "features": [0.82, 0.15, 0.63, 0.91]},
{"id": "p002", "features": [0.11, 0.88, 0.22, 0.45]},
{"id": "p003", "features": [0.79, 0.18, 0.59, 0.87]},
{"id": "p004", "features": [0.14, 0.91, 0.25, 0.41]}
],
"k": 2,
"max_iterations": 100
},
"substrate": "local"
})
clusters = response.json()["solution"]["clusters"]
for cluster in clusters:
print(f'Cluster {cluster["id"]}: {cluster["members"]}')QSVM — TARX Classifier
The Quantum Support Vector Machine maps input features into a high-dimensional quantum feature space using a parameterized quantum circuit. This quantum feature map can separate classes that are non-linearly entangled in the original feature space, outperforming classical SVMs on complex decision boundaries.
| Problem type | Non-linear binary and multi-class classification |
| Classical complexity | O(n²d) — kernel computation bottleneck |
| TARX complexity | Quantum feature map in exponential Hilbert space |
| Best for | Financial fraud detection, medical diagnosis, risk scoring |
response = requests.post("http://localhost:11435/api/solve", json={
"solver": "qsvm",
"problem": {
"type": "classification",
"training_data": [
{"features": [0.1, 0.9, 500, 1], "label": "fraud"},
{"features": [0.8, 0.2, 50, 0], "label": "legitimate"},
{"features": [0.15, 0.85, 480, 1], "label": "fraud"},
{"features": [0.75, 0.3, 65, 0], "label": "legitimate"}
],
"predict": [
{"features": [0.12, 0.87, 510, 1]},
{"features": [0.82, 0.15, 42, 0]}
]
},
"substrate": "local"
})
predictions = response.json()["solution"]["predictions"]
for p in predictions:
print(p["label"], f'{p["confidence"]:.0%}')
# → fraud 96%
# → legitimate 94%QUBO — TARX Binary
Quadratic Unconstrained Binary Optimization solves assignment problems where every variable is 0 or 1. TARX Binary uses quantum annealing-inspired techniques to find the ground state of the QUBO matrix. This is the native formulation for portfolio allocation, staffing, and scheduling problems.
| Problem type | Binary variable assignment and optimization |
| Classical complexity | O(2ⁿ) — NP-hard in general |
| TARX complexity | Quantum annealing-inspired polynomial-time heuristic |
| Best for | Portfolio allocation, shift staffing, resource assignment |
response = requests.post("http://localhost:11435/api/solve", json={
"solver": "qubo",
"problem": {
"type": "portfolio_allocation",
"assets": [
{"id": "AAPL", "expected_return": 0.12, "risk": 0.18},
{"id": "GOOGL", "expected_return": 0.10, "risk": 0.15},
{"id": "TSLA", "expected_return": 0.25, "risk": 0.40},
{"id": "BND", "expected_return": 0.04, "risk": 0.03},
{"id": "GLD", "expected_return": 0.06, "risk": 0.10}
],
"constraints": {
"max_assets": 3,
"max_risk": 0.20,
"min_return": 0.08
}
},
"substrate": "local",
"shots": 4096
})
allocation = response.json()["solution"]
print(allocation["selected"])
# → ["AAPL", "GOOGL", "BND"]
print(f'Expected return: {allocation["expected_return"]:.1%}')
print(f'Portfolio risk: {allocation["risk"]:.1%}')
# → Expected return: 8.7%
# → Portfolio risk: 12.3%Choosing a solver
If you are unsure which solver fits your problem, use this decision tree:
- Need to find the best route, schedule, or assignment? →
qaoa - Searching for a needle in a haystack? →
grover - Grouping data without labels? →
qkmeans - Classifying data into categories? →
qsvm - Every decision is yes/no? →
qubo