threshold-pruner / MAGNITUDE_INDEX.md
CharlesCNorton
Rename OPTIMALITY_INDEX to MAGNITUDE_INDEX, add CIRCUITS_TODO, add architecture search
329d4e4

Magnitude Index

Results of exhaustive magnitude enumeration on threshold logic circuits.

Summary

All circuits listed below have been tested via exhaustive enumeration. "Min Mag" is the minimum magnitude at which valid configurations were found.

Single-Layer Gates (Linearly Separable)

Circuit Inputs Params Min Mag Solutions Configs Tested
threshold-not 1 2 1 1 5
threshold-nor 2 3 2 1 7
threshold-implies 2 3 2 1 25
threshold-or 2 3 3 1 25
threshold-nand 2 3 3 1 25
threshold-and 2 3 4 1 129
threshold-nor3 3 4 3 1 129
threshold-or3 3 4 4 1 321
threshold-nand3 3 4 5 1 681
threshold-and3 3 4 6 1 1,289
threshold-demux 2 6 7 1 19,825
threshold-majority 8 9 13 1 27,298,155

Multi-Layer Gates (Not Linearly Separable)

Circuit Inputs Params Original Mag Min Mag Solutions Reduction
threshold-xor 2 9 10 7 6 30%
threshold-xnor 2 9 9 7 2 22%
threshold-mux 3 11 10 7 4 30%
threshold-xor3 3 16 14 10 18 29%

Magnitude-Minimized Variants

These repos contain the minimum-magnitude weights found:

  • threshold-xor-mag7 - 6 solutions at magnitude 7
  • threshold-xnor-mag7 - 2 solutions at magnitude 7
  • threshold-mux-mag7 - 4 solutions at magnitude 7
  • threshold-xor3-mag10 - 18 solutions at magnitude 10 (flat architecture)

Pending / In Progress

Circuit Params Status
threshold-halfadder 12 Running (expected min: 11)
threshold-mod4 9 Running
threshold-biimplies 9 Not yet tested (same as XNOR)
threshold-halfsubtractor 12 Not yet tested

Methodology

Exhaustive search enumerates all integer weight configurations by magnitude level (0, 1, 2, ...) until valid solutions are found. This finds the minimum magnitude within the search space.

For circuits with >12 parameters, exhaustive search becomes impractical. Use evolutionary or simulated annealing instead.

Key Findings

  1. Single-layer threshold gates appear to have unique minimum-magnitude representations. All tested single-layer gates have exactly 1 solution at their minimum magnitude.

  2. Multi-layer gates can have solution families. XOR has 6 solutions at magnitude 7, XOR3 has 18 solutions at magnitude 10.

  3. Non-linearly-separable functions benefit most from optimization. XOR/XNOR/MUX achieved 22-30% magnitude reduction.

  4. Architecture matters. XOR3 flat architecture (mag 10) beats cascade architecture (mag 14) by 29%.

Last Updated

2026-01-23