Class TruthTableMinimizer
- Namespace
- LogicalOptimizer
- Assembly
- LogicalOptimizer.Minimization.dll
Exact two-level minimization: Quine–McCluskey prime implicant generation followed by an exact minimum cover search (essential primes + branch-and-bound, greedy fallback past a work limit). Cost order: total literals, then term count. Minterm bit convention: bit j of a minterm index is the value of variables[j] (variables are expected in sorted order).
public static class TruthTableMinimizer
- Inheritance
-
TruthTableMinimizer
- Inherited Members
Methods
MinimalPos(IReadOnlyList<string>, IReadOnlyCollection<int>, IReadOnlyCollection<int>?, long?, CancellationToken)
Minimal product-of-sums: the complement's minimal SOP negated via De Morgan.
public static AstNode MinimalPos(IReadOnlyList<string> variables, IReadOnlyCollection<int> onSet, IReadOnlyCollection<int>? dontCareSet = null, long? pairComparisonLimit = null, CancellationToken cancellationToken = default)
Parameters
variablesIReadOnlyList<string>onSetIReadOnlyCollection<int>dontCareSetIReadOnlyCollection<int>pairComparisonLimitlong?cancellationTokenCancellationToken
Returns
MinimalPosWithStatus(IReadOnlyList<string>, IReadOnlyCollection<int>, IReadOnlyCollection<int>?, long?, CancellationToken, int)
Like MinimalPos(IReadOnlyList<string>, IReadOnlyCollection<int>, IReadOnlyCollection<int>?, long?, CancellationToken) but also reports whether the minimum cover search of
the complement completed: when ProvenMinimal is true the returned POS is provably
minimal in (total literals, then clause count); when false the clause set is sound
but the exact search hit coverStepLimit before proving
optimality (mirrors MinimalSopWithStatus(IReadOnlyList<string>, IReadOnlyCollection<int>, IReadOnlyCollection<int>?, long?, CancellationToken, int) so the POS path is no
longer silently unproven).
public static (AstNode Expression, bool ProvenMinimal) MinimalPosWithStatus(IReadOnlyList<string> variables, IReadOnlyCollection<int> onSet, IReadOnlyCollection<int>? dontCareSet = null, long? pairComparisonLimit = null, CancellationToken cancellationToken = default, int coverStepLimit = 200000)
Parameters
variablesIReadOnlyList<string>onSetIReadOnlyCollection<int>dontCareSetIReadOnlyCollection<int>pairComparisonLimitlong?cancellationTokenCancellationTokencoverStepLimitint
Returns
MinimalSop(IReadOnlyList<string>, IReadOnlyCollection<int>, IReadOnlyCollection<int>?, long?, CancellationToken)
Minimal sum-of-products for the function given by its ON-set (and optional don't-care set) over 2^variables.Count minterms.
public static AstNode MinimalSop(IReadOnlyList<string> variables, IReadOnlyCollection<int> onSet, IReadOnlyCollection<int>? dontCareSet = null, long? pairComparisonLimit = null, CancellationToken cancellationToken = default)
Parameters
variablesIReadOnlyList<string>Sorted variable names; bit j of a minterm is variables[j].
onSetIReadOnlyCollection<int>Minterms where the function is 1.
dontCareSetIReadOnlyCollection<int>Minterms whose value is unspecified.
pairComparisonLimitlong?Optional work budget for prime-implicant generation; when exceeded a ComputationBudgetExceededException is thrown so callers can fall back to heuristic simplification (dense functions near 12 variables can otherwise cost seconds).
cancellationTokenCancellationTokenCooperative cancellation, observed throughout: prime generation (per level and within dense pairing loops), covering-table reduction (per row/column pass) and the branch-and-bound cover search (periodically per node).
Returns
MinimalSopWithStatus(IReadOnlyList<string>, IReadOnlyCollection<int>, IReadOnlyCollection<int>?, long?, CancellationToken, int)
Like MinimalSop(IReadOnlyList<string>, IReadOnlyCollection<int>, IReadOnlyCollection<int>?, long?, CancellationToken) but also reports whether the minimum cover search
completed: when ProvenMinimal is true the returned SOP is provably minimal in
(total literals, then term count); when false the cover is sound but the exact
search hit coverStepLimit before proving optimality.
public static (AstNode Expression, bool ProvenMinimal) MinimalSopWithStatus(IReadOnlyList<string> variables, IReadOnlyCollection<int> onSet, IReadOnlyCollection<int>? dontCareSet = null, long? pairComparisonLimit = null, CancellationToken cancellationToken = default, int coverStepLimit = 200000)
Parameters
variablesIReadOnlyList<string>onSetIReadOnlyCollection<int>dontCareSetIReadOnlyCollection<int>pairComparisonLimitlong?cancellationTokenCancellationTokencoverStepLimitint