Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,38 @@
A second correctness review: every fix below was reproduced against a
brute-force reference or a closed-form value and has a regression test.

### Strassen bound on one-sided generators

- New `sofic.generators.strassen_bound`: `strassen_lower_bound(bidir)` bounds from below the state entropy of every
generator that is sufficient on one side, with any number of states (optional dependency,
`pip install sofic[global]`). A reverse-sufficient generator is a law on the simplex of beliefs on the reverse
causal states that dominates its image under the belief updates in convex order (Strassen 1965), so it passes every
concave piecewise-linear cut; the bound is the least entropy over laws with the right mean that pass the cuts, found
by cutting planes from the canonical-heights cut of the side's chain. Each master puts one atom in each cell of the
cuts' common refinement and replaces `-w log2 w` by its chords, refined at the minimizer: a mixed-integer linear
program with an SOS2 constraint per cell (Beale & Tomlin 1970), solved by SCIP. Separation is the most violated
hinge on the segment, and on the triangle the most violated ridge, then the coupling LP's Farkas cut. Sides with
more than three causal states are skipped. `StrassenBoundResult.certified` says that SCIP solved the last master,
that its minimizer passed separation and the martingale-coupling LP (so it is the law of a generator), and that its
entropy is within `1e-6` of `lower`; the side's one-sided value is then in `[lower, value]`.
- `generative_model(..., strassen_bound=True)` runs it right after the simplex-chain search, seeded with its chains,
with a quarter of the remaining budget (30 s per side without one) and at most 30 cuts per side, and reports
`strassen_lower` and `strassen_certified` per side, also in the reliability summary. Neither enters `lower` or
`certified`: the bounds hold for `C_g` only if some minimal generator is one-sided, which is open. The stage is
skipped on truncated and exploding builds, for the Wyner objective, and without PySCIPOpt.
- The masters avoid SCIP's spatial branch and bound on `-w log w`, which returned bounds above the entropy of a known
generator on 13 of 406 three-state sides of binary 3-state processes (by 0.09 to 1.86 bits on 6, certifying one of
those, and by `1.8e-6` to `2.6e-5` on 7) and called the master infeasible on 3 more. A failed round, with an LP error or an "infeasible" verdict, is solved again without the linear shortcut,
then with SCIP's numerics emphasis and feasibility tolerances of `1e-8` and `1e-7`; past those the master keeps its
last solved round. Thin cells left at a vertex by creases that converge on it are kept: dropping them loses the
vertex's atom.
- Validation, 30 cuts per side. On the 406 sides, 120 s each, no bound rose above the census generator's entropy
(the largest difference is `-6e-9`); 2 sides were certified, 10 came within `1e-6`, and the median bound is 0.88
of the value. Of 133 open `C_g` brackets of small ε-machines, both sides were bounded on 66 (63 have a side with
more than three causal states): the bound raised the lower end of 3 and closed `s3-n2-t0012-d4`, certified on
both sides, and rose above no upper end. On 30 two-state processes, 600 s per side certified 5 and came within
`1e-6` of 7.

### Drawing from a terminal

- `draw()` with no filename shows the diagram: inline in terminals that support the kitty graphics protocol (kitty,
Expand Down
58 changes: 58 additions & 0 deletions docs/generators/generative_models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,62 @@ It enters ``lower`` (as a numerical bound) only at cryptic order at most 1 with
otherwise ``certified`` is unchanged. The polished solution is offered as a candidate. The
two-step flows and this restricted use are not from the literature.

Strassen bound on one-sided generators
--------------------------------------

:func:`~sofic.generators.strassen_bound.strassen_lower_bound` (optional dependency PySCIPOpt,
``pip install sofic[global]``) bounds from below the state entropy of every reverse-sufficient generator, whatever
its number of states, and of every forward-sufficient one on the mirror side. Such a generator is a finite law
:math:`\mu` on :math:`\Delta(S^-)` that dominates its image :math:`\Phi(\mu)` under the belief updates in convex order
:cite:`Strassen1965` (see the simplex-chain search above). After a symbol :math:`x`, emitted with probability
:math:`m_x(y)`, a belief :math:`y` moves to :math:`f_x(y)`, so for every concave :math:`U` on the simplex, Jensen's
inequality on the split of each updated belief gives :math:`\int (\mathcal{B} U - U) \, d\mu \ge 0` with
:math:`\mathcal{B} U(y) = \sum_x m_x(y) \, U(f_x(y))`. A *cut* is a concave piecewise-linear :math:`U`, and the least
entropy over laws with mean :math:`p(S^-)` that pass a set of cuts is a lower bound. The function computes it by
cutting planes, on each side with at most three causal states, where the cells below are polygons:

* the *master problem* puts one atom in each cell of the cuts' common refinement, on which every cut is affine.
Merging the atoms of a cell keeps every cut (:math:`\mathcal{B} U` is superadditive) and lowers the entropy, so
these laws reach the minimum. Each term :math:`-w \log_2 w` is replaced by its chords on a grid of masses, which
lie below it, so the master is a mixed-integer linear program with an SOS2 constraint per cell :cite:`Beale1970`,
solved by SCIP :cite:`Achterberg2009` through PySCIPOpt :cite:`Maher2016`. Its dual bound is a lower bound, and the
grids gain the minimizer's masses until the chords meet the entropy there (to :math:`10^{-9}` in all);
* *separation* returns a cut that the minimizer fails: on the segment (two causal states) the most violated hinge
:math:`-(y_0 - t)_+`, which decides convex order there, and on the triangle the most violated of 180 ridges
:math:`-(d \cdot y - t)_+`, then the Farkas dual of the martingale-coupling LP;
* the loop starts from the canonical-heights cut of the side's chain, which is tight at the law of a minimal chain,
and stops when the minimizer passes separation, after ``max_cuts`` cuts, or at the side's time limit.

A minimizer that passes separation and the coupling LP is itself the law of a generator, so the bound is then the
side's one-sided value. ``certified`` also needs SCIP to have solved that master (to optimality or to its relative
gap of :math:`10^{-7}`) and the minimizer's entropy to come within :math:`10^{-6}` of the bound; a master stopped at
its time limit gives a valid bound and no certificate. The relaxation, the separation, the cell merge, the chord
refinement, the certificate and the heights cut are not from the literature.

The masters are numerically delicate. SCIP's spatial branch and bound on the logarithm itself
:cite:`Vigerske2018` returned bounds above the entropy of a known generator on 13 of 406 three-state sides of binary
3-state processes, by 0.09 to 1.86 bits on 6 of them (certifying one) and by :math:`1.8 \times 10^{-6}` to
:math:`2.6 \times 10^{-5}` on 7, and called the master infeasible on 3 more; the chords replace it. Creases that
converge on a vertex leave cells as thin as :math:`10^{-7}` there, which are kept (without them the master loses the
vertex's atom) and on which SCIP's LP can fail. A failed round is solved again without the linear shortcut for the
cut terms, then with SCIP's numerics emphasis and the feasibility tolerance relaxed to :math:`10^{-8}` and to
:math:`10^{-7}`, which only relaxes the master; after that the master keeps its last solved round, and a master with
none stops the loop at the best bound so far. A master that SCIP calls infeasible counts as failed: the side's
ε-machine passes every valid cut.

With 30 cuts and 120 s per side, no bound on those 406 sides rose above the entropy of the known generator (the
largest difference is :math:`-6 \cdot 10^{-9}`); 2 sides were certified, 10 came within :math:`10^{-6}`, and the
median bound is 0.88 of the value. Of 133 open brackets on :math:`C_g` of small ε-machines, 66 have at most three
causal states on both sides; there the bound raised the lower end of 3 and closed one, certified on both sides. On
30 two-state processes, 600 s per side certified 5.

The pipeline runs it with ``strassen_bound=True``, right after the simplex-chain search and seeded with its chains,
with a quarter of the remaining budget (30 s per side without one) and at most 30 cuts per side. The bounds go to
``strassen_lower`` and ``strassen_certified`` per side and into the reliability summary, and never into ``lower``:
they bound :math:`C_g` only if some minimal generator is reverse- or forward-sufficient, which is open. The stage is
skipped, and the log says why, on truncated and exploding builds (where it would bound the truncation), for the
Wyner objective, and without PySCIPOpt.

API
===

Expand Down Expand Up @@ -580,6 +636,8 @@ Coupled generators and bounds
.. autoclass:: sofic.generators.global_bound.GlobalBoundResult
.. autofunction:: sofic.generators.global_bound.separating_global_bound
.. autoclass:: sofic.generators.global_bound.SeparatingBoundResult
.. autofunction:: sofic.generators.strassen_bound.strassen_lower_bound
.. autoclass:: sofic.generators.strassen_bound.StrassenBoundResult
.. autoclass:: sofic.generators.generative_search.GenerativeModelResult
:members: certified, gap, g_optima_generate
.. autofunction:: sofic.generators.coverage_bound.coverage_entropy_lower
Expand Down
11 changes: 11 additions & 0 deletions docs/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -1955,3 +1955,14 @@ @inproceedings{Maher2016
year = {2016},
doi = {10.1007/978-3-319-42432-3_37},
}

@inproceedings{Beale1970,
author = {Beale, E. M. L. and Tomlin, J. A.},
title = {Special Facilities in a General Mathematical Programming System for Non-Convex Problems Using Ordered Sets of Variables},
booktitle = {Proceedings of the Fifth International Conference on Operational Research},
editor = {Lawrence, J.},
pages = {447--454},
publisher = {Tavistock Publications},
address = {London},
year = {1970},
}
Loading
Loading