sfiruch.SATInterface
5.2.0
dotnet add package sfiruch.SATInterface --version 5.2.0
NuGet\Install-Package sfiruch.SATInterface -Version 5.2.0
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="sfiruch.SATInterface" Version="5.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="sfiruch.SATInterface" Version="5.2.0" />
<PackageReference Include="sfiruch.SATInterface" />
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 sfiruch.SATInterface --version 5.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: sfiruch.SATInterface, 5.2.0"
#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 sfiruch.SATInterface@5.2.0
#: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=sfiruch.SATInterface&version=5.2.0
#tool nuget:?package=sfiruch.SATInterface&version=5.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SATInterface
Library to formulate and solve SAT problems in .NET.
The interface includes these excellent SAT solvers, but any solver that supports DIMACS can be used (e.g. Lingeling, Clasp, RISS, MiniSAT, ...):
- CaDiCaL — MIT-licensed, https://github.com/arminbiere/cadical
- Kissat — MIT-licensed, https://github.com/arminbiere/kissat
- CryptoMiniSat — MIT-licensed, https://github.com/msoos/cryptominisat
Usage Example: Sudoku
using System;
using System.Linq;
using SATInterface;
using var m = new Model(new Configuration()
{
Verbosity = 2
});
var v = m.AddVars(9, 9, 9);
//instead of a variable, use the constant "True" to fix the number 1
v[0, 0, 0] = true;
//here's alternative way to fix the second number
m.AddConstr(v[1, 0, 1]);
//assign one number to each cell
for (var y = 0; y < 9; y++)
for (var x = 0; x < 9; x++)
m.AddConstr(m.Sum(Enumerable.Range(0, 9).Select(n => v[x, y, n])) == 1);
//each number occurs once per row (alternative formulation)
for (var y = 0; y < 9; y++)
for (var n = 0; n < 9; n++)
m.AddConstr(m.ExactlyOneOf(Enumerable.Range(0, 9).Select(x => v[x, y, n])));
//each number occurs once per column, with a specific SAT encoding
for (var x = 0; x < 9; x++)
for (var n = 0; n < 9; n++)
m.AddConstr(m.ExactlyOneOf(Enumerable.Range(0, 9).Select(y => v[x, y, n]), Model.ExactlyOneOfMethod.PairwiseTree));
//each number occurs once per 3x3 block
for (var n = 0; n < 9; n++)
for (var y = 0; y < 9; y += 3)
for (var x = 0; x < 9; x += 3)
m.AddConstr(m.Sum(
v[x + 0, y + 0, n], v[x + 1, y + 0, n], v[x + 2, y + 0, n],
v[x + 0, y + 1, n], v[x + 1, y + 1, n], v[x + 2, y + 1, n],
v[x + 0, y + 2, n], v[x + 1, y + 2, n], v[x + 2, y + 2, n]) == 1);
m.Solve();
if (m.State == State.Satisfiable)
for (var y = 0; y < 9; y++)
{
for (var x = 0; x < 9; x++)
for (var n = 0; n < 9; n++)
if (v[x, y, n].X)
Console.Write($" {n + 1}");
Console.WriteLine();
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.2.0 | 39 | 3/11/2026 |