FSharp.Azure.Quantum
0.1.0-alpha
See the version list below for details.
dotnet add package FSharp.Azure.Quantum --version 0.1.0-alpha
NuGet\Install-Package FSharp.Azure.Quantum -Version 0.1.0-alpha
<PackageReference Include="FSharp.Azure.Quantum" Version="0.1.0-alpha" />
<PackageVersion Include="FSharp.Azure.Quantum" Version="0.1.0-alpha" />
<PackageReference Include="FSharp.Azure.Quantum" />
paket add FSharp.Azure.Quantum --version 0.1.0-alpha
#r "nuget: FSharp.Azure.Quantum, 0.1.0-alpha"
#:package FSharp.Azure.Quantum@0.1.0-alpha
#addin nuget:?package=FSharp.Azure.Quantum&version=0.1.0-alpha&prerelease
#tool nuget:?package=FSharp.Azure.Quantum&version=0.1.0-alpha&prerelease
FSharp.Azure.Quantum
F# library for quantum-inspired optimization - Solve TSP, Portfolio, and combinatorial optimization problems with automatic quantum vs classical routing.
π Quick Start
open FSharp.Azure.Quantum.Classical
// Solve a TSP problem with named cities
let cities = [
("Seattle", 47.6, -122.3)
("Portland", 45.5, -122.7)
("San Francisco", 37.8, -122.4)
]
match TSP.solveDirectly cities None with
| Ok tour ->
printfn "Best route: %A" tour.Cities
printfn "Distance: %.2f miles" tour.TotalDistance
| Error msg -> printfn "Error: %s" msg
π¦ Installation
dotnet add package FSharp.Azure.Quantum --version 0.1.0-alpha
β¨ Features
π HybridSolver - Automatic Quantum/Classical Routing
Automatically chooses the best solver (quantum or classical) based on problem characteristics:
// Let the solver decide automatically
match HybridSolver.solveTsp distances None None None with
| Ok solution ->
printfn "Method used: %A" solution.Method // Classical or Quantum
printfn "Reasoning: %s" solution.Reasoning
printfn "Solution: %A" solution.Result
| Error msg -> printfn "Error: %s" msg
πΊοΈ TSP (Traveling Salesman Problem)
Solve routing problems with named cities:
let cities = [("NYC", 40.7, -74.0); ("LA", 34.0, -118.2); ("Chicago", 41.9, -87.6)]
// Option 1: Direct solve (easiest)
let tour = TSP.solveDirectly cities None
// Option 2: Build problem first (for customization)
let problem = TSP.createProblem cities
let tour = TSP.solve problem (Some customConfig)
Features:
- Named cities with coordinates
- Automatic distance calculation
- Simulated annealing with 2-opt
- Configurable iterations and cooling
πΌ Portfolio Optimization
Optimize investment portfolios with risk/return constraints:
let assets = [
("AAPL", 0.12, 0.18, 150.0) // symbol, return, risk, price
("MSFT", 0.10, 0.15, 300.0)
("GOOGL", 0.15, 0.20, 2800.0)
]
let allocation = Portfolio.solveDirectly assets 10000.0 None
match allocation with
| Ok result ->
printfn "Total Value: $%.2f" result.TotalValue
printfn "Expected Return: %.2f%%" (result.ExpectedReturn * 100.0)
printfn "Risk: %.2f" result.Risk
| Error msg -> printfn "Error: %s" msg
Features:
- Greedy return/risk ratio optimization
- Budget constraints
- Min/max holding limits
- Efficient allocation
π€ Quantum Advisor
Get recommendations on when to use quantum vs classical:
match QuantumAdvisor.getRecommendation distances with
| Ok recommendation ->
printfn "Recommendation: %A" recommendation.RecommendationType
printfn "Problem size: %d" recommendation.ProblemSize
printfn "Reasoning: %s" recommendation.Reasoning
| Error msg -> printfn "Error: %s" msg
π§ͺ Classical Solvers
Direct access to classical optimization algorithms:
// TSP Solver
let tspSolution = TspSolver.solveWithDistances distances TspSolver.defaultConfig
// Portfolio Solver
let portfolio = PortfolioSolver.solveGreedyByRatio assets constraints PortfolioSolver.defaultConfig
π Problem Analysis
Analyze problem complexity and characteristics:
match ProblemAnalysis.classifyProblem distances with
| Ok info ->
printfn "Type: %A" info.ProblemType
printfn "Size: %d" info.Size
printfn "Complexity: %s" info.Complexity
| Error msg -> printfn "Error: %s" msg
π° Cost Estimation
Estimate quantum execution costs before running:
let estimate = CostEstimation.estimateQuantumCost problemSize shots tier
printfn "Estimated cost: $%.2f %s" estimate.EstimatedCost estimate.Currency
π Documentation
- Getting Started Guide - Installation and first examples
- API Reference - Complete API documentation
- TSP Example - Detailed TSP walkthrough
- FAQ - Common questions and troubleshooting
ποΈ Architecture
Current Status: v0.1.0-alpha
β Completed Components
| Component | Status | Description |
|---|---|---|
| HybridSolver (TKT-26) | β Complete | Automatic quantum/classical routing |
| TSP Builder (TKT-24) | β Complete | Domain API for TSP problems |
| Portfolio Builder (TKT-25) | β Complete | Domain API for portfolio optimization |
| TspSolver (TKT-16) | β Complete | Classical TSP with simulated annealing |
| PortfolioSolver (TKT-17) | β Complete | Classical portfolio with greedy algorithm |
| QuantumAdvisor (TKT-19) | β Complete | Quantum vs classical decision framework |
| ProblemAnalysis (TKT-18) | β Complete | Problem classification and complexity |
| CostEstimation (TKT-27) | β Complete | Cost calculation for quantum execution |
| CircuitBuilder (TKT-20) | β Complete | Quantum circuit construction |
| QuboEncoding (TKT-21) | β Complete | QUBO problem encoding |
| QaoaCircuit (TKT-22) | β Complete | QAOA circuit generation |
| QaoaOptimizer (TKT-23) | β Complete | QAOA parameter optimization |
π§ In Development
| Component | Status | Description |
|---|---|---|
| Quantum Backend | π§ Planned | Azure Quantum service integration |
| Advanced Constraints | π§ Planned | Complex portfolio constraints |
| More Domains | π§ Planned | Scheduling, MaxCut, Knapsack |
π― When to Use Quantum
The library automatically recommends quantum vs classical based on:
Use Classical When:
- β Problem size < 50 variables
- β Need immediate results (milliseconds)
- β Developing/testing locally
- β Cost is a concern
Consider Quantum When:
- β‘ Problem size > 100 variables
- β‘ Problem has special structure (QUBO-compatible)
- β‘ Can tolerate longer wait times (seconds)
- β‘ Budget available (~$10-100 per run)
Use HybridSolver to decide automatically!
π§ Development
Prerequisites
- .NET 10.0 SDK
- F# 10.0
Build
dotnet build
Test
dotnet test
All 186 tests passing β
Run Examples
cd examples
dotnet run
π Performance
Classical Solvers (Local Execution):
| Problem | Size | Time | Quality |
|---|---|---|---|
| TSP | 10 cities | ~20ms | Optimal |
| TSP | 50 cities | ~500ms | Within 5% of optimal |
| TSP | 100 cities | ~2s | Within 10% of optimal |
| Portfolio | 20 assets | ~10ms | Optimal |
| Portfolio | 50 assets | ~50ms | Near-optimal |
π€ Contributing
Contributions welcome! This is an alpha release and we're actively improving.
Areas for Contribution
- Additional problem domains (Scheduling, MaxCut, etc.)
- Quantum backend integration
- Performance optimizations
- Documentation improvements
- Bug fixes
Development Process
- Follow TDD methodology (see
docs-for-mulder/AI-DEVELOPMENT-GUIDE.md) - Write tests first (RED β GREEN β REFACTOR)
- Update documentation
- Submit PR to
devbranch
π License
Unlicense - Public domain. Use freely for any purpose.
π Acknowledgments
Built with:
- F# 10.0
- .NET 10.0
- Azure Quantum platform
Developed using AI-assisted TDD methodology.
π Support
- Documentation: docs/
- Issues: GitHub Issues
- Examples: docs/examples/
Status: Alpha (v0.1.0) - Classical solvers production-ready, quantum integration coming soon.
Last Updated: 2025-11-24
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Azure.Identity (>= 1.13.1)
- FSharp.Core (>= 10.0.100)
- MathNet.Numerics (>= 5.0.0)
- MathNet.Numerics.FSharp (>= 5.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on FSharp.Azure.Quantum:
| Package | Downloads |
|---|---|
|
FSharp.Azure.Quantum.Topological
Topological quantum computing plugin for FSharp.Azure.Quantum. Provides anyon theory (Ising/Fibonacci/SU(2)_k), braiding compilation, gate-to-braid conversion, Majorana hardware simulator, noise models, and topological file format (.tqp). Seamlessly integrates with main package algorithms (Grover, QFT, QAOA) via IQuantumBackend interface. Requires FSharp.Azure.Quantum v1.3.10+. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.3.10 | 96 | 2/22/2026 |
| 1.3.9 | 96 | 2/19/2026 |
| 1.3.7 | 111 | 2/17/2026 |
| 1.3.6 | 106 | 2/13/2026 |
| 1.3.5 | 111 | 2/10/2026 |
| 1.3.4 | 111 | 1/25/2026 |
| 1.3.3 | 203 | 12/20/2025 |
| 1.3.2 | 192 | 12/13/2025 |
| 1.3.1 | 448 | 12/11/2025 |
| 1.2.9 | 451 | 12/8/2025 |
| 1.2.7 | 321 | 12/7/2025 |
| 1.2.5 | 214 | 12/4/2025 |
| 1.2.4 | 692 | 12/3/2025 |
| 1.2.3 | 690 | 12/1/2025 |
| 1.2.1 | 146 | 11/29/2025 |
| 1.2.0 | 146 | 11/29/2025 |
| 1.1.0 | 115 | 11/28/2025 |
| 1.0.0 | 198 | 11/28/2025 |
| 0.5.0-beta | 210 | 11/25/2025 |
| 0.1.0-alpha | 202 | 11/24/2025 |