FSharp.Azure.Quantum 0.1.0-alpha

This is a prerelease version of FSharp.Azure.Quantum.
There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FSharp.Azure.Quantum" Version="0.1.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FSharp.Azure.Quantum" Version="0.1.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="FSharp.Azure.Quantum" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FSharp.Azure.Quantum --version 0.1.0-alpha
                    
#r "nuget: FSharp.Azure.Quantum, 0.1.0-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FSharp.Azure.Quantum@0.1.0-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FSharp.Azure.Quantum&version=0.1.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=FSharp.Azure.Quantum&version=0.1.0-alpha&prerelease
                    
Install as a Cake Tool

FSharp.Azure.Quantum

F# library for quantum-inspired optimization - Solve TSP, Portfolio, and combinatorial optimization problems with automatic quantum vs classical routing.

NuGet License

πŸš€ 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

πŸ—οΈ 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 dev branch

πŸ“„ 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


Status: Alpha (v0.1.0) - Classical solvers production-ready, quantum integration coming soon.

Last Updated: 2025-11-24

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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