deiruch.SATInterface
4.8.4
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package deiruch.SATInterface --version 4.8.4
NuGet\Install-Package deiruch.SATInterface -Version 4.8.4
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="deiruch.SATInterface" Version="4.8.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="deiruch.SATInterface" Version="4.8.4" />
<PackageReference Include="deiruch.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 deiruch.SATInterface --version 4.8.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: deiruch.SATInterface, 4.8.4"
#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 deiruch.SATInterface@4.8.4
#: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=deiruch.SATInterface&version=4.8.4
#tool nuget:?package=deiruch.SATInterface&version=4.8.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SATInterface
SATInterface is a .NET library to formulate SAT problems
Installation
Add a reference to the NuGet Package deiruch.SATInterface.
Features
- Maximize or minimize linear objective functions (3 strategies)
- Enumerate all solutions
- Supports linear combinations
- Convenient .NET operator overloading
- Simplify Boolean formulas
- Translate Boolean formulas to CNF
- Includes algorithms for
- Counting (Totalizer)
- At-most-one-constraints (7 implementations)
- Exactly-one-constraints (9 implementations)
- Exactly-k-constraints (4 implementations)
- Unsigned integer arithmetic (Addition, Subtraction, Multiplication, Shifting)
- Export to DIMACS files
- Includes Kissat (https://github.com/arminbiere/kissat), CaDiCaL (https://github.com/arminbiere/cadical) and CryptoMiniSAT (see https://github.com/msoos/cryptominisat)
Usage example: Sudoku
using System;
using System.Linq;
using SATInterface;
using var m = new Model();
m.Configuration.Solver = InternalSolver.CaDiCaL;
m.Configuration.Verbosity = 2;
var v = m.AddVars(9, 9, 9);
//fix the first number to 1
v[0, 0, 0] = true;
//here's alternative way to set 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 (configured formulation)
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 | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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.
-
net6.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.1.4 | 400 | 2/23/2024 |
| 5.1.3 | 356 | 2/3/2024 |
| 5.1.2 | 441 | 1/14/2024 |
| 5.1.1 | 414 | 1/12/2024 |
| 5.1.0 | 482 | 11/21/2023 |
| 4.13.0 | 567 | 7/18/2023 |
| 4.12.0 | 461 | 7/14/2023 |
| 4.11.0 | 463 | 7/13/2023 |
| 4.10.0 | 494 | 7/3/2023 |
| 4.9.0 | 585 | 3/4/2023 |
| 4.8.4 | 706 | 11/18/2022 |
| 4.8.3 | 792 | 6/29/2022 |
| 4.8.2 | 785 | 6/23/2022 |
| 4.8.1 | 770 | 6/1/2022 |
| 4.8.0 | 811 | 5/25/2022 |
| 4.7.2 | 788 | 5/18/2022 |
| 4.7.1 | 787 | 5/18/2022 |
| 4.7.0 | 803 | 5/13/2022 |
| 4.6.0 | 821 | 5/9/2022 |
| 4.5.0 | 845 | 5/1/2022 |
| 4.4.0 | 839 | 3/24/2022 |
| 4.3.1 | 809 | 3/6/2022 |
| 4.3.0 | 822 | 3/6/2022 |
| 4.2.6 | 801 | 3/3/2022 |
| 4.2.5 | 852 | 3/3/2022 |
| 4.2.4 | 861 | 2/25/2022 |
| 4.2.3 | 796 | 2/20/2022 |
| 4.2.2 | 847 | 2/20/2022 |
| 4.2.1 | 811 | 2/20/2022 |
| 4.2.0 | 816 | 2/20/2022 |
| 4.1.0 | 671 | 12/8/2021 |
| 4.0.1 | 755 | 11/1/2021 |
| 4.0.0 | 824 | 6/11/2021 |
| 3.4.5 | 760 | 5/6/2021 |
| 3.4.4 | 828 | 2/22/2021 |
| 3.4.3 | 882 | 12/4/2020 |
| 3.4.2 | 863 | 12/4/2020 |
| 3.4.1 | 857 | 11/23/2020 |
| 3.4.0 | 914 | 8/20/2020 |
| 3.3.2 | 911 | 7/29/2020 |
| 3.3.1 | 962 | 6/14/2020 |
| 3.3.0 | 973 | 3/23/2020 |
| 3.2.2 | 1,016 | 3/6/2020 |
| 3.2.1 | 1,035 | 2/25/2020 |
| 3.2.0 | 1,001 | 2/21/2020 |
| 3.1.0 | 993 | 2/12/2020 |
| 3.0.0 | 984 | 2/4/2020 |
| 2.1.11 | 1,000 | 1/17/2020 |
| 2.1.10 | 980 | 1/14/2020 |
| 2.1.9 | 994 | 1/10/2020 |
| 2.1.8 | 966 | 1/9/2020 |
| 2.1.7 | 961 | 1/3/2020 |
| 2.1.6 | 1,082 | 12/30/2019 |
| 2.1.4 | 1,044 | 12/30/2019 |
| 2.1.3 | 1,035 | 12/30/2019 |
| 2.1.2 | 1,055 | 12/29/2019 |
| 2.1.1 | 1,070 | 12/29/2019 |
| 2.1.0 | 1,116 | 12/28/2019 |
| 2.0.5 | 972 | 12/25/2019 |
| 2.0.4 | 964 | 12/17/2019 |
| 2.0.3 | 913 | 12/6/2019 |
| 2.0.2 | 958 | 12/4/2019 |
| 1.4.3 | 2,187 | 3/15/2019 |
| 1.4.2 | 1,665 | 7/19/2018 |
| 1.4.1 | 1,636 | 6/11/2018 |
| 1.4.0 | 1,683 | 6/11/2018 |
| 1.3.9 | 1,715 | 5/28/2018 |
| 1.3.8 | 1,497 | 11/29/2017 |
| 1.3.7 | 1,506 | 11/29/2017 |
| 1.3.6 | 1,676 | 11/16/2017 |
| 1.3.5 | 1,690 | 10/23/2017 |
| 1.3.4 | 1,658 | 10/23/2017 |
| 1.3.2 | 1,660 | 10/23/2017 |
| 1.3.1 | 1,638 | 10/22/2017 |
| 1.3.0 | 1,673 | 10/22/2017 |
| 1.2.4 | 1,570 | 3/19/2017 |
| 1.2.3 | 1,581 | 3/19/2017 |
| 1.2.2 | 1,523 | 3/19/2017 |
| 1.2.1 | 1,492 | 3/19/2017 |
| 1.2.0 | 1,481 | 3/19/2017 |
| 1.1.2 | 1,587 | 1/7/2017 |
| 1.1.1 | 1,554 | 1/7/2017 |
| 1.1.0 | 1,556 | 1/7/2017 |
| 1.0.5 | 1,541 | 1/6/2017 |
| 1.0.4 | 1,538 | 1/3/2017 |
| 1.0.3 | 1,515 | 1/3/2017 |
| 1.0.2 | 1,536 | 1/3/2017 |
| 1.0.1 | 1,517 | 1/3/2017 |
| 1.0.0 | 1,521 | 1/3/2017 |