triples 0.3.0__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {triples-0.3.0 → triples-0.3.1}/PKG-INFO +1 -1
- {triples-0.3.0 → triples-0.3.1}/pyproject.toml +1 -1
- {triples-0.3.0 → triples-0.3.1}/triples/__init__.py +1 -1
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/abstract.py +10 -2
- triples-0.3.1/triples/core/sdpsos/manifold.py +283 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/sdpsos.py +35 -14
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/sos.py +117 -15
- triples-0.3.1/triples/core/sdpsos/tests/test_manifold.py +108 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/tests/test_sdpsos.py +38 -2
- triples-0.3.1/triples/core/sdpsos/tests/test_sos.py +31 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/__init__.py +2 -2
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/abstract.py +78 -13
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/arithmetic/__init__.py +7 -4
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/arithmetic/linsolve.py +159 -24
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/arithmetic/lll.py +15 -13
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/arithmetic/matmul.py +62 -26
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/arithmetic/matop.py +48 -10
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/arithmetic/tests/test_linsolve.py +25 -1
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/arithmetic/tests/test_matmul.py +11 -2
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/__init__.py +2 -2
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/backend.py +28 -12
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/clarabel_sdp.py +21 -2
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/cvxopt_sdp.py +14 -2
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/cvxpy_sdp.py +18 -1
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/mosek_sdp.py +14 -1
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/picos_sdp.py +7 -1
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/qics_sdp.py +16 -3
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/sdpap_sdp.py +7 -3
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/settings.py +40 -1
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/dual.py +432 -75
- triples-0.3.1/triples/sdp/facial.py +512 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/primal.py +21 -21
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/rationalize.py +117 -17
- triples-0.3.1/triples/sdp/tests/test_dual.py +90 -0
- triples-0.3.1/triples/sdp/tests/test_facial.py +73 -0
- triples-0.3.1/triples/sdp/tests/test_rationalize.py +93 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/transforms/linear.py +100 -108
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/transforms/polytope.py +15 -9
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/transforms/tests/test_linear.py +48 -1
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/transforms/tests/test_polytope.py +11 -7
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/transforms/transformable.py +53 -23
- {triples-0.3.0 → triples-0.3.1}/triples/testing/tests/test_syntax.py +6 -1
- {triples-0.3.0 → triples-0.3.1}/triples.egg-info/PKG-INFO +1 -1
- {triples-0.3.0 → triples-0.3.1}/triples.egg-info/SOURCES.txt +5 -0
- triples-0.3.0/triples/core/sdpsos/manifold.py +0 -385
- triples-0.3.0/triples/sdp/tests/test_dual.py +0 -43
- {triples-0.3.0 → triples-0.3.1}/LICENSE +0 -0
- {triples-0.3.0 → triples-0.3.1}/README.md +0 -0
- {triples-0.3.0 → triples-0.3.1}/notebooks/README_pypi.md +0 -0
- {triples-0.3.0 → triples-0.3.1}/setup.cfg +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/benchmarks/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/benchmarks/problems/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/benchmarks/problems/books/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/benchmarks/problems/books/nice_and_hard567.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/benchmarks/problems/books/vasile.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/benchmarks/problems/contests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/benchmarks/problems/contests/chn.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/benchmarks/problems/contests/imo.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/benchmarks/problems/problem_set.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/benchmarks/run_benchmark.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/complexity.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/dispatch.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/linsos/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/linsos/basis.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/linsos/correction.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/linsos/lift.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/linsos/linsos.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/linsos/models/linearsossolver_length_model.npz +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/linsos/models/linearsossolver_prob_model.npz +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/linsos/models/linearsossolver_time_model.npz +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/linsos/solution.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/linsos/tangents.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/linsos/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/linsos/tests/test_linsos.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/node.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/pivoting/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/pivoting/pivoting.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/pivoting/quadratic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/pivoting/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/pivoting/tests/test_pivoting.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/algebraic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/elimination.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/features.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/modeling.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/noncommutative.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/polynomial.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/reparam.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/signs.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/tests/test_elimination.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/tests/test_noncommutative.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/preprocess/tests/test_signs.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/problem.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/progsos/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/progsos/cauchy.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/progsos/progsos.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/progsos/qcqp.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/progsos/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/algebra/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/algebra/basis.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/algebra/moment_algebra.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/algebra/nc_poly_ring.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/algebra/poly_ring.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/algebra/pseudo_poly.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/algebra/state_algebra.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/algebra/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/algebra/tests/test_moment_algebra.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/algebra/tests/test_pseudo_poly.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/models/sdpsossolver_length_model.npz +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/models/sdpsossolver_prob_model.npz +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/models/sdpsossolver_time_model.npz +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/sohs.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/solution.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/sos_moment.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sdpsos/tests/test_sos_obj.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/shared.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/solution.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/nvars/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/nvars/linear.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/nvars/quadratic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/nvars/quartic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/nvars/solver.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/nvars/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/nvars/tests/test_nvars.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/pivoting/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/pivoting/bivariate.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/quaternary/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/quaternary/cubic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/quaternary/dense_symmetric.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/quaternary/quartic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/quaternary/quartic_symmetric.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/quaternary/quintic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/quaternary/solver.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/quaternary/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/quaternary/tests/test_quaternary.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/structsos.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/acute.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/acyclic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/cubic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/dense_symmetric.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/nonic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/octic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/octic_symmetric.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/quadratic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/quartic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/quintic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/quintic_symmetric.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/septic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/septic_symmetric.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/sextic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/sextic_symmetric.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/solver.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/sparse.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/tests/test_ternary.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/ternary/utils.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/tests/test_univariate.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/univariate.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/structsos/utils.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/sum_of_squares.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/symsos/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/symsos/basic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/symsos/representation.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/symsos/symmetric.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/symsos/symsos.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/symsos/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/symsos/tests/test_symsos.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/tests/test_dispatch.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/core/tests/test_problem.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/gui/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/gui/grid.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/gui/linebreak.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/gui/sos_manager.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/gui/visualize.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/arithmetic/eigens.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/arithmetic/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/arithmetic/tests/test_eigens.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/arithmetic/tests/test_matop.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/caller.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/backends/tests/test_backends.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/cone.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/ipm.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/tests/test_cone.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/tests/test_primal.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/transforms/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/transforms/diagonalize.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/transforms/parametric.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/transforms/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/transforms/tests/test_diagonalize.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/transforms/transform.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/utils.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/wedderburn/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/wedderburn/character_table.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/wedderburn/decomposition.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/wedderburn/dixon.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/wedderburn/symmetric.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/wedderburn/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/wedderburn/tests/test_dixon.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/sdp/wedderburn/tests/test_symmetric.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/testing/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/testing/doctest_parser.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/testing/fix_code_quality.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/testing/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/testing/tests/test_code_quality.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/expressions/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/expressions/coeff.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/expressions/cyclic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/expressions/exraw.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/expressions/psatz.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/expressions/soscone.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/expressions/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/expressions/tests/test_coeff.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/expressions/tests/test_cyclic.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/monomials.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/normalforms.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/polytools.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/pqr.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/extrema.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/monotonic_opt.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/num_extrema.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/polysolve.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/rationalize.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/root_list.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/roots.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/tests/test_extrema.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/tests/test_num_extrema.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/tests/test_polysolve.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/roots/tests/test_roots.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/tests/__init__.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/tests/test_monomials.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/tests/test_polytools.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/tests/test_text_process.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/text_process.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples/utils/tree_predictor.py +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples.egg-info/dependency_links.txt +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples.egg-info/requires.txt +0 -0
- {triples-0.3.0 → triples-0.3.1}/triples.egg-info/top_level.txt +0 -0
|
@@ -160,6 +160,7 @@ class SOSElement:
|
|
|
160
160
|
|
|
161
161
|
def solve(self,
|
|
162
162
|
solver: Optional[str] = None,
|
|
163
|
+
*,
|
|
163
164
|
solve_child: bool = True,
|
|
164
165
|
propagate_to_parent: bool = True,
|
|
165
166
|
verbose: bool = False,
|
|
@@ -167,12 +168,15 @@ class SOSElement:
|
|
|
167
168
|
allow_numer: int = 0,
|
|
168
169
|
normalize: bool = True,
|
|
169
170
|
kwargs: Dict[Any, Any] = {},
|
|
171
|
+
recovery_rounds: int = 2,
|
|
172
|
+
retry_relaxation: float = 0.,
|
|
173
|
+
recovery_with_equalities: bool = False
|
|
170
174
|
) -> Optional[Matrix]:
|
|
171
175
|
"""
|
|
172
176
|
Solve the SOS problem. Arguments are passed to `SDPProblem.solve`.
|
|
173
177
|
"""
|
|
174
178
|
end_time = perf_counter() + time_limit if isinstance(time_limit, (int, float)) else None
|
|
175
|
-
time_limit = ArithmeticTimeout.make_checker(time_limit)
|
|
179
|
+
time_limit = ArithmeticTimeout.make_checker(time_limit=time_limit)
|
|
176
180
|
if self._sdp is None:
|
|
177
181
|
self.construct(verbose=verbose, time_limit=time_limit)
|
|
178
182
|
time_limit()
|
|
@@ -180,7 +184,10 @@ class SOSElement:
|
|
|
180
184
|
return self.sdp.solve(solver=solver, solve_child=solve_child,
|
|
181
185
|
propagate_to_parent=propagate_to_parent, verbose=verbose,
|
|
182
186
|
time_limit=rest_time, allow_numer=allow_numer,
|
|
183
|
-
normalize=normalize, kwargs=kwargs
|
|
187
|
+
normalize=normalize, kwargs=kwargs,
|
|
188
|
+
recovery_rounds=recovery_rounds,
|
|
189
|
+
retry_relaxation=retry_relaxation,
|
|
190
|
+
recovery_with_equalities=recovery_with_equalities)
|
|
184
191
|
|
|
185
192
|
def as_solution(self, *args, **kwargs):
|
|
186
193
|
raise NotImplementedError
|
|
@@ -353,6 +360,7 @@ class AtomSOSElement(SOSElement):
|
|
|
353
360
|
self.sdpp.constrain_block_structures()
|
|
354
361
|
|
|
355
362
|
self.sdpp.constrain_zero_diagonals(time_limit=time_limit)
|
|
363
|
+
# self.sdpp.constrain_coordinate_faces(time_limit=time_limit)
|
|
356
364
|
|
|
357
365
|
|
|
358
366
|
def _get_equation_system(self, parameters: List['Symbol']=[], domain=None) -> SOSEquationSystem:
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains heuristic, experimental, imcomplete facial reduction algorithm
|
|
3
|
+
for SDP via computing the equality cases of the original SOS problem.
|
|
4
|
+
"""
|
|
5
|
+
from collections import defaultdict
|
|
6
|
+
from itertools import islice, product
|
|
7
|
+
from typing import (
|
|
8
|
+
Dict, Iterable, Iterator, List, Mapping, Sequence, Tuple,
|
|
9
|
+
Union, Optional, Callable, Any, TYPE_CHECKING
|
|
10
|
+
)
|
|
11
|
+
from sympy import QQ
|
|
12
|
+
from sympy.external.gmpy import MPQ
|
|
13
|
+
from sympy.matrices import MutableDenseMatrix as Matrix
|
|
14
|
+
from sympy.polys.rings import ring
|
|
15
|
+
|
|
16
|
+
from .algebra import PseudoPoly
|
|
17
|
+
from ...sdp.arithmetic import ArithmeticTimeout, rep_matrix_from_list
|
|
18
|
+
from ...utils import Root, MonomialManager
|
|
19
|
+
from ...utils.roots.roots import _algebraic_field_coeffs
|
|
20
|
+
|
|
21
|
+
if TYPE_CHECKING:
|
|
22
|
+
from sympy import Poly
|
|
23
|
+
from sympy.combinatorics import PermutationGroup
|
|
24
|
+
from sympy.polys.rings import PolyElement
|
|
25
|
+
|
|
26
|
+
from .algebra import SOSBasis
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
_Monomial = Tuple[int, ...]
|
|
30
|
+
_Coefficients = Mapping[_Monomial, MPQ]
|
|
31
|
+
_GramBlock = Tuple[Any, _Coefficients, Sequence[_Monomial]]
|
|
32
|
+
_Jet = Tuple[Any, Tuple[MPQ, ...]]
|
|
33
|
+
_SignedJet = Tuple[Any, bool, Tuple[MPQ, ...]]
|
|
34
|
+
_JetLayers = Tuple[Tuple[_SignedJet, ...], ...]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _order(poly: "PolyElement") -> int:
|
|
38
|
+
"""Return the order at zero of a nonzero univariate ring element."""
|
|
39
|
+
return min(poly)[0]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _parametrization_jets(
|
|
43
|
+
target: _Coefficients,
|
|
44
|
+
equalities: Sequence[_Coefficients],
|
|
45
|
+
blocks: Sequence[_GramBlock],
|
|
46
|
+
parametrization: Sequence["PolyElement"],
|
|
47
|
+
permutations: Sequence[Sequence[int]] = (),
|
|
48
|
+
) -> _JetLayers:
|
|
49
|
+
"""Prepare successive orders of the Gram terms on one parametrization.
|
|
50
|
+
|
|
51
|
+
The coordinates are polynomials in a common univariate ring over QQ,
|
|
52
|
+
with the base point at parameter zero. A nonzero Gram term has leading
|
|
53
|
+
order d + 2*j and the sign of its weight. Here d is the weight order,
|
|
54
|
+
and j is the first basis coefficient outside the Gram kernel.
|
|
55
|
+
"""
|
|
56
|
+
ring = parametrization[0].ring
|
|
57
|
+
cache: Dict[_Monomial, PolyElement] = {}
|
|
58
|
+
|
|
59
|
+
def monomial(powers: _Monomial) -> "PolyElement":
|
|
60
|
+
if powers not in cache:
|
|
61
|
+
value = ring.one
|
|
62
|
+
for x, e in zip(parametrization, powers):
|
|
63
|
+
if e:
|
|
64
|
+
value *= x**e
|
|
65
|
+
cache[powers] = value
|
|
66
|
+
return cache[powers]
|
|
67
|
+
|
|
68
|
+
def restrict(poly: _Coefficients, perm: Sequence[int] = ()) -> "PolyElement":
|
|
69
|
+
return sum((c * monomial(tuple(m[i] for i in perm) if perm else m)
|
|
70
|
+
for m, c in poly.items()), ring.zero)
|
|
71
|
+
|
|
72
|
+
if any(restrict(h) for h in equalities):
|
|
73
|
+
return ()
|
|
74
|
+
rhs = restrict(target)
|
|
75
|
+
rhs_order = _order(rhs) if rhs else float('inf')
|
|
76
|
+
# Restrict each orbit term separately: an invariant SOS sum can contain
|
|
77
|
+
# weights of both signs even when its representative is positive.
|
|
78
|
+
terms = []
|
|
79
|
+
for key, weight, basis in blocks:
|
|
80
|
+
seen = set()
|
|
81
|
+
for perm in permutations or ((),):
|
|
82
|
+
g = restrict(weight, perm)
|
|
83
|
+
if not g:
|
|
84
|
+
continue
|
|
85
|
+
d = _order(g)
|
|
86
|
+
if d >= rhs_order:
|
|
87
|
+
continue
|
|
88
|
+
monoms = tuple(tuple(m[i] for i in perm) if perm else m for m in basis)
|
|
89
|
+
signature = (d, g[(d,)] > 0, monoms)
|
|
90
|
+
if signature not in seen:
|
|
91
|
+
seen.add(signature)
|
|
92
|
+
terms.append((key, *signature))
|
|
93
|
+
|
|
94
|
+
# The target is a fixed term on the other side. Work strictly below its
|
|
95
|
+
# first nonzero order, where its coefficients cannot participate.
|
|
96
|
+
if not terms:
|
|
97
|
+
return ()
|
|
98
|
+
by_order = defaultdict(list)
|
|
99
|
+
for key, d, positive, monoms in terms:
|
|
100
|
+
evaluated = [monomial(m) for m in monoms]
|
|
101
|
+
count = max((max(p)[0] for p in evaluated if p), default=-1) + 1
|
|
102
|
+
if rhs:
|
|
103
|
+
count = min(count, (int(rhs_order)-d+1)//2)
|
|
104
|
+
for j in range(count):
|
|
105
|
+
column = tuple(p.get((j,), QQ.zero) for p in evaluated)
|
|
106
|
+
if any(column):
|
|
107
|
+
by_order[d+2*j].append((key, positive, column))
|
|
108
|
+
|
|
109
|
+
return tuple(tuple(by_order[order]) for order in sorted(by_order))
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def scan_jet_layers(layers: _JetLayers, survives: Callable[[_Jet], bool]) -> Iterator[Tuple[bool, _Jet]]:
|
|
113
|
+
"""Yield proven directions and the first layer that can still cancel."""
|
|
114
|
+
for layer in layers:
|
|
115
|
+
active = [(key, positive, column) for key, positive, column in layer
|
|
116
|
+
if survives((key, column))]
|
|
117
|
+
mixed = len({positive for _, positive, _ in active}) == 2
|
|
118
|
+
for key, _, column in active:
|
|
119
|
+
yield mixed, (key, column)
|
|
120
|
+
if mixed:
|
|
121
|
+
break
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def _collect_line_jets(
|
|
125
|
+
target: "Poly",
|
|
126
|
+
inequalities: Mapping[Any, "Poly"],
|
|
127
|
+
bases: Mapping[Any, "SOSBasis"],
|
|
128
|
+
ideal: Iterable["Poly"],
|
|
129
|
+
*,
|
|
130
|
+
roots: Sequence[Root],
|
|
131
|
+
symmetry: Optional["PermutationGroup"],
|
|
132
|
+
check_time: Callable[[], None],
|
|
133
|
+
) -> List[_JetLayers]:
|
|
134
|
+
nvars = len(target.gens)
|
|
135
|
+
if nvars > 4 or not roots:
|
|
136
|
+
return []
|
|
137
|
+
equalities = complete_constraints_by_symmetry(list(ideal), symmetry)
|
|
138
|
+
if not all(p.domain.is_ZZ or p.domain.is_QQ for p in [
|
|
139
|
+
target, *inequalities.values(), *equalities]):
|
|
140
|
+
return []
|
|
141
|
+
|
|
142
|
+
def coefficients(poly: "Poly") -> _Coefficients:
|
|
143
|
+
return poly.set_domain(QQ).rep.to_dict()
|
|
144
|
+
|
|
145
|
+
_, t = ring('t', QQ)
|
|
146
|
+
target_coeffs = coefficients(target)
|
|
147
|
+
eq_coeffs = [coefficients(p) for p in equalities]
|
|
148
|
+
blocks = [(k, coefficients(p), bases[k]._basis)
|
|
149
|
+
for k, p in inequalities.items() if len(bases[k])]
|
|
150
|
+
permutations = ([tuple(p(i) if i < p.size else i for i in range(nvars))
|
|
151
|
+
for p in symmetry.elements] if symmetry is not None else [])
|
|
152
|
+
lines: Dict[_JetLayers, None] = {}
|
|
153
|
+
points = dict.fromkeys(
|
|
154
|
+
tuple(QQ.convert(p, root.domain) for p in root.rep)
|
|
155
|
+
for root in roots if root.is_Rational and root.rep is not None)
|
|
156
|
+
directions = list(product((-1, 0, 1), repeat=nvars))
|
|
157
|
+
for point in islice(points, 12):
|
|
158
|
+
check_time()
|
|
159
|
+
if target.eval(dict(zip(target.gens, map(QQ.to_sympy, point)))) != 0:
|
|
160
|
+
continue
|
|
161
|
+
stabilizer = [p for p in permutations if tuple(point[i] for i in p) == point]
|
|
162
|
+
for direction in directions:
|
|
163
|
+
# The line test already uses the full orbit of every Gram term.
|
|
164
|
+
if any(tuple(direction[i] for i in p) < direction for p in stabilizer):
|
|
165
|
+
continue
|
|
166
|
+
check_time()
|
|
167
|
+
parametrization = tuple(p + v*t for p, v in zip(point, direction))
|
|
168
|
+
layers = _parametrization_jets(
|
|
169
|
+
target_coeffs, eq_coeffs, blocks, parametrization, permutations)
|
|
170
|
+
if layers:
|
|
171
|
+
lines[layers] = None
|
|
172
|
+
return list(lines)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def _root_span(root: Root, basis: "SOSBasis") -> Matrix:
|
|
176
|
+
"""Evaluate the basis and extract rational coefficient vectors."""
|
|
177
|
+
values = [root._single_power_monomial(monom) for monom in basis._basis]
|
|
178
|
+
if root.is_Rational:
|
|
179
|
+
return rep_matrix_from_list(values, len(values), domain=root.domain)
|
|
180
|
+
return _algebraic_field_coeffs(values, root.domain)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def _findroot_binary(poly: "Poly", symmetry: "PermutationGroup" = None) -> List[Root]:
|
|
184
|
+
"""
|
|
185
|
+
Very easy implementation to find binary roots of the polynomial.
|
|
186
|
+
"""
|
|
187
|
+
symmetry = MonomialManager(len(poly.gens), perm_group=symmetry)
|
|
188
|
+
roots = set()
|
|
189
|
+
for root in product([0, 1], repeat=len(poly.gens)):
|
|
190
|
+
# root = RootRational(root)
|
|
191
|
+
# if root.subs(poly, poly.gens) == 0:
|
|
192
|
+
# roots.append(root)
|
|
193
|
+
if poly(*root) == 0:
|
|
194
|
+
# roots.append(RootRational(root))
|
|
195
|
+
roots.add(symmetry.standard_monom(root))
|
|
196
|
+
roots = set(roots)
|
|
197
|
+
all_zero = tuple([0] * len(poly.gens))
|
|
198
|
+
if all_zero in roots:
|
|
199
|
+
roots.remove(all_zero)
|
|
200
|
+
roots = [Root(root) for root in roots]
|
|
201
|
+
return roots
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def get_sos_jet_data(
|
|
205
|
+
poly: "Poly",
|
|
206
|
+
ineq_constraints: Dict[Any, "Poly"],
|
|
207
|
+
eq_constraints: Dict[Any, "Poly"],
|
|
208
|
+
ineq_bases: Dict[Any, "SOSBasis"],
|
|
209
|
+
*,
|
|
210
|
+
roots: Sequence[Root] = (),
|
|
211
|
+
perm_group: Optional["PermutationGroup"] = None,
|
|
212
|
+
time_limit: Optional[Union[Callable, float]]=None,
|
|
213
|
+
) -> Tuple[Dict[Any, Matrix], List[_JetLayers]]:
|
|
214
|
+
"""Return point kernels and the ordered Gram coefficients along each line.
|
|
215
|
+
|
|
216
|
+
Point evaluation also supports algebraic roots. The line data can be
|
|
217
|
+
rescanned after imposing kernels without expanding the polynomials again.
|
|
218
|
+
"""
|
|
219
|
+
time_limit = ArithmeticTimeout.make_checker(time_limit)
|
|
220
|
+
if not roots:
|
|
221
|
+
return {}, []
|
|
222
|
+
lines = _collect_line_jets(
|
|
223
|
+
poly, ineq_constraints, ineq_bases,
|
|
224
|
+
eq_constraints.values(),
|
|
225
|
+
roots=roots, symmetry=perm_group, check_time=time_limit
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
# A zero of the target alone does not justify point kernels when
|
|
229
|
+
# nonzero weights of opposite signs can cancel.
|
|
230
|
+
inequalities = complete_constraints_by_symmetry(
|
|
231
|
+
[g for k, g in ineq_constraints.items() if len(ineq_bases[k])], perm_group)
|
|
232
|
+
equalities = complete_constraints_by_symmetry(
|
|
233
|
+
list(eq_constraints.values()), perm_group)
|
|
234
|
+
point_roots = []
|
|
235
|
+
for root in roots:
|
|
236
|
+
time_limit()
|
|
237
|
+
if not (root.is_Rational or root.domain.is_AlgebraicField):
|
|
238
|
+
continue
|
|
239
|
+
if root.eval(poly) != 0 or any(root.eval(h) != 0 for h in equalities):
|
|
240
|
+
continue
|
|
241
|
+
values = [root.eval(g) for g in inequalities]
|
|
242
|
+
if (all(v.is_nonnegative is True for v in values)
|
|
243
|
+
or all(v.is_nonpositive is True for v in values)):
|
|
244
|
+
point_roots.append(root)
|
|
245
|
+
|
|
246
|
+
nullspaces = {}
|
|
247
|
+
for key, weight in ineq_constraints.items():
|
|
248
|
+
basis = ineq_bases[key]
|
|
249
|
+
if not len(basis):
|
|
250
|
+
continue
|
|
251
|
+
columns: Dict[Tuple, None] = {}
|
|
252
|
+
for root in point_roots:
|
|
253
|
+
time_limit()
|
|
254
|
+
if root.eval(weight) != 0:
|
|
255
|
+
span = _root_span(root, basis)
|
|
256
|
+
columns.update(dict.fromkeys(tuple(col) for col in span.T.tolist() if any(col)))
|
|
257
|
+
if columns:
|
|
258
|
+
nullspaces[key] = Matrix(list(columns)).T
|
|
259
|
+
return nullspaces, lines
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
def complete_constraints_by_symmetry(polys: List[Union["Poly", "PseudoPoly"]], symmetry=None):
|
|
263
|
+
"""
|
|
264
|
+
Complete the constraints in the orbit of the symmetry group.
|
|
265
|
+
Returns a list of polynomials.
|
|
266
|
+
"""
|
|
267
|
+
if symmetry is None or len(polys) == 0 or symmetry.is_trivial:
|
|
268
|
+
return list(polys)
|
|
269
|
+
rep_set = set()
|
|
270
|
+
polylize, gens = polys[0].__class__.new, polys[0].gens
|
|
271
|
+
for poly in polys:
|
|
272
|
+
rep = poly.rep
|
|
273
|
+
rep_set.add(rep)
|
|
274
|
+
pm = poly.algebra.permute_monom if isinstance(poly, PseudoPoly) else None
|
|
275
|
+
for perm in symmetry.elements:
|
|
276
|
+
if pm is not None:
|
|
277
|
+
reorder = rep.per({pm(m, perm): c for m, c in rep.items()})
|
|
278
|
+
else:
|
|
279
|
+
reorder = poly.reorder(*[gens[i] for i in perm._array_form]).rep
|
|
280
|
+
if rep == reorder:
|
|
281
|
+
continue
|
|
282
|
+
rep_set.add(reorder)
|
|
283
|
+
return [polylize(rep, *gens) for rep in rep_set]
|
|
@@ -239,12 +239,17 @@ class SDPSOSSolver(ProofNode):
|
|
|
239
239
|
preordering: str
|
|
240
240
|
The preordering method for extending the generators of the quadratic module. It can be
|
|
241
241
|
'none', 'linear', 'linear-progressive'. Default is 'linear-progressive'.
|
|
242
|
-
unstable_eig_threshold: float
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
and stops further search. Default is -0.1.
|
|
242
|
+
unstable_eig_threshold: Optional[float]
|
|
243
|
+
Optional early stop after rationalization failure if the smallest
|
|
244
|
+
eigenvalue exceeds this threshold. By default, continue the search.
|
|
246
245
|
normalize: bool
|
|
247
246
|
Use automatic normalization before solving SDP. Default is True.
|
|
247
|
+
retry_relaxation: float
|
|
248
|
+
Positive amount of PSD relaxation for a numerical retry after a stalled
|
|
249
|
+
solve. The candidate is verified against the original SDP. Default is 0.
|
|
250
|
+
recovery_rounds: int
|
|
251
|
+
Maximum number of retries on certified faces per SDP. Use 0 to disable
|
|
252
|
+
these retries. Default is 2.
|
|
248
253
|
verbose: bool
|
|
249
254
|
Whether to print the progress. Default is False.
|
|
250
255
|
"""
|
|
@@ -257,8 +262,10 @@ class SDPSOSSolver(ProofNode):
|
|
|
257
262
|
"solve_kwargs": {},
|
|
258
263
|
"ineq_constraints_with_trivial": True,
|
|
259
264
|
"preordering": "linear-progressive",
|
|
260
|
-
"unstable_eig_threshold":
|
|
265
|
+
"unstable_eig_threshold": None,
|
|
261
266
|
"normalize": True,
|
|
267
|
+
"retry_relaxation": 0.,
|
|
268
|
+
"recovery_rounds": 2,
|
|
262
269
|
"verbose": False,
|
|
263
270
|
}
|
|
264
271
|
|
|
@@ -335,7 +342,9 @@ class SDPSOSSolver(ProofNode):
|
|
|
335
342
|
else:
|
|
336
343
|
sos = SOSPoly(poly.zero, poly.gens,
|
|
337
344
|
qmodule = qmodule + poly_qmodule, ideal = ideal,
|
|
338
|
-
symmetry = symmetry.perm_group, roots = roots, degree=degree
|
|
345
|
+
symmetry = symmetry.perm_group, roots = roots, degree=degree,
|
|
346
|
+
# The zero target represents N - F*D, whose degree is known here.
|
|
347
|
+
is_homogeneous=self.problem.is_homogeneous,
|
|
339
348
|
)
|
|
340
349
|
sos.construct(
|
|
341
350
|
wedderburn=configs['wedderburn'],
|
|
@@ -423,6 +432,7 @@ class SDPSOSSolver(ProofNode):
|
|
|
423
432
|
eq_constraints = problem.eq_constraints
|
|
424
433
|
|
|
425
434
|
verbose = configs["verbose"]
|
|
435
|
+
unstable_eig_threshold = configs["unstable_eig_threshold"]
|
|
426
436
|
|
|
427
437
|
degree = poly.total_degree() + lift_degree
|
|
428
438
|
|
|
@@ -445,6 +455,8 @@ class SDPSOSSolver(ProofNode):
|
|
|
445
455
|
time_limit=configs['expected_end_time'] - perf_counter(),
|
|
446
456
|
allow_numer=configs['allow_numer'],
|
|
447
457
|
normalize=configs['normalize'],
|
|
458
|
+
retry_relaxation=configs['retry_relaxation'],
|
|
459
|
+
recovery_rounds=configs['recovery_rounds'],
|
|
448
460
|
kwargs=configs['solve_kwargs']
|
|
449
461
|
)
|
|
450
462
|
|
|
@@ -473,15 +485,15 @@ class SDPSOSSolver(ProofNode):
|
|
|
473
485
|
self.state = -1
|
|
474
486
|
self.finished = True
|
|
475
487
|
break
|
|
476
|
-
elif
|
|
477
|
-
|
|
488
|
+
elif (unstable_eig_threshold is not None and sos_problem is not None
|
|
489
|
+
and isinstance(e, SDPRationalizeError)):
|
|
478
490
|
y = e.y
|
|
479
491
|
if y is not None:
|
|
480
492
|
dr = DualRationalizer(sos_problem.sdpp)
|
|
481
493
|
# y[:-1] to discard the eigenvalue relaxation,
|
|
482
494
|
# see source code in SDPProblem.solve
|
|
483
495
|
mineig = dr.mineig(y[:-1])
|
|
484
|
-
if mineig >
|
|
496
|
+
if mineig > unstable_eig_threshold:
|
|
485
497
|
# we think that it is numerically unstable
|
|
486
498
|
self.state = -1
|
|
487
499
|
self.finished = True
|
|
@@ -577,8 +589,10 @@ def SDPSOS(
|
|
|
577
589
|
solve_kwargs: Dict[str, Any] = {},
|
|
578
590
|
ineq_constraints_with_trivial: bool = True,
|
|
579
591
|
preordering: str = 'linear-progressive',
|
|
580
|
-
unstable_eig_threshold: float =
|
|
592
|
+
unstable_eig_threshold: Optional[float] = None,
|
|
581
593
|
normalize: bool = True,
|
|
594
|
+
retry_relaxation: float = 0.,
|
|
595
|
+
recovery_rounds: int = 2,
|
|
582
596
|
verbose: bool = False,
|
|
583
597
|
time_limit: float = 3600.,
|
|
584
598
|
) -> Optional["Solution"]:
|
|
@@ -613,16 +627,21 @@ def SDPSOS(
|
|
|
613
627
|
exact solution by rationalization.
|
|
614
628
|
solve_kwargs: Dict[str, Any]
|
|
615
629
|
Extra keyword arguments to pass to the SDP solver.
|
|
630
|
+
recovery_rounds: int
|
|
631
|
+
Maximum number of retries on certified faces per SDP. Use 0 to disable
|
|
632
|
+
these retries. Default is 2.
|
|
633
|
+
retry_relaxation: float
|
|
634
|
+
Positive amount of PSD relaxation for a bounded numerical retry after
|
|
635
|
+
an inaccurate or failed solve. Default is 0 (disabled).
|
|
616
636
|
ineq_constraints_with_trivial: bool
|
|
617
637
|
Whether to add the trivial inequality constraint 1 >= 0. This is used to generate the
|
|
618
638
|
quadratic module. Default is True.
|
|
619
639
|
preordering: str
|
|
620
640
|
The preordering method for extending the generators of the quadratic module. It can be
|
|
621
641
|
'none', 'linear', 'linear-progressive'. Default is 'linear-progressive'.
|
|
622
|
-
unstable_eig_threshold: float
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
and stops further search. Default is -0.1.
|
|
642
|
+
unstable_eig_threshold: Optional[float]
|
|
643
|
+
Optional early stop after rationalization failure if the smallest
|
|
644
|
+
eigenvalue exceeds this threshold. By default, continue the search.
|
|
626
645
|
normalize: bool
|
|
627
646
|
Use automatic normalization before solving SDP. Default is True.
|
|
628
647
|
verbose: bool
|
|
@@ -691,6 +710,8 @@ def SDPSOS(
|
|
|
691
710
|
"ineq_constraints_with_trivial": ineq_constraints_with_trivial,
|
|
692
711
|
"preordering": preordering,
|
|
693
712
|
"normalize": normalize,
|
|
713
|
+
"retry_relaxation": retry_relaxation,
|
|
714
|
+
"recovery_rounds": recovery_rounds,
|
|
694
715
|
"unstable_eig_threshold": unstable_eig_threshold,
|
|
695
716
|
"verbose": verbose,
|
|
696
717
|
}
|