This release is a pre-release and may not be stable for production use.
kos-verify
An independent checker, in exact arithmetic, for the certificates that KOS (the Katsenia Optimization Solver) writes for linear programs (LP).
After solving an LP, KOS can write a certificate: a JSON file in the open kos-certificate format (version 1) that
says what the solve proves about the model and carries the numbers that prove it. kos-verify reads the model file
with its own MPS and LP readers, checks that the certificate belongs to that model (by a fingerprint it computes
itself) and checks every claim in exact rational arithmetic. It shares no code with KOS and does not trust its
numbers: the point, the duals and the ray are data, and what they prove is derived here from them and from the model.
What each kind of LP certificate proves:
optimal: the objective of the optimum, within a stated tolerance from both sides (a point that satisfies the constraints within the primal tolerance, and duals whose rigorous bound closes the gap);infeasible: Farkas multipliers that prove the LP has no feasible point;unbounded: a ray (and possibly a point) that proves the LP has no finite optimum;bound: duals that prove a bound on the objective, when the solve did not prove an optimum.
kos-verify checks certificates of linear programs only. A model with integer columns (a MIP) exits with status 3: MIP certificates are not part of this version.
Installation
pip install --pre kos-verify
Python 3.9 or newer, standard library only (no dependencies). The package installs the kos-verify command and the
kos_verify module.
Usage
Solve an LP with KOS and write its certificate, for example from Python with the kos-solver package (import kos):
import kos
m = kos.Model.read("model.mps")
m.solve()
m.write_certificate("model.cert.json")
(or kos solve model.mps --certificate model.cert.json from the KOS command line), then check it:
kos-verify model.mps model.cert.json
kos-verify MODEL CERTIFICATE [--format auto|mps|lp] [--primal-tolerance T] [--gap-tolerance T]
[--report FILE] [--quiet] [--version]
It prints kos-verify: PROVEN (...), with the tolerances the proof used, or kos-verify: REJECTED: reason.
--report FILE writes a JSON report. Exit status: 0 proven, 1 rejected (also a malformed certificate or one of
another model), 2 a usage error, 3 the model cannot be read or is not an LP, 4 an internal error. Only 0 means proven.
The format
The kos-certificate format, version 1, is specified in CERTIFICADO.md: the model and how the files are read, the
fingerprint, the certificate file, what each kind proves and what a verifier checks, precisely enough to write
another verifier. The specification is included in the source distribution and installed with the package in
share/doc/kos-verify/CERTIFICADO.md (under the Python prefix, for example the virtual environment).
License
kos-verify is licensed under the Apache License, Version 2.0 (see LICENSE). KOS itself is proprietary software of
Katsenia SpA, distributed separately (the kos-solver package) under its own license. More: https://katsenia.com.
Metadata
Release files for kos-verify 1.0.0b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kos_verify-1.0.0b1.tar.gz | 40.4 kB | Without provenance | Details for kos_verify-1.0.0b1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kos_verify-1.0.0b1-py3-none-any.whl | Python 3 | none | any | Details for kos_verify-1.0.0b1-py3-none-any.whl |
Total release size: 81.6 kB
Release files / kos_verify-1.0.0b1.tar.gz
| Download URL | kos_verify-1.0.0b1.tar.gz |
|---|---|
| Size | 40.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd6b65587264f373786f18a3af32258bc9ff5eb51e8c316b03e729867d58ca3c
|
|
BLAKE2b-256 checksum How to use checksums |
cef5a7f298911b6435ad447ccc3ade04de8809679509f1550e2c6ae01998355d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / kos_verify-1.0.0b1-py3-none-any.whl
| Download URL | kos_verify-1.0.0b1-py3-none-any.whl |
|---|---|
| Size | 41.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00d82d6a821d3487ede2719e9e30c4c55ae97453637c84f1a98bba5f12ef7676
|
|
BLAKE2b-256 checksum How to use checksums |
f0485cce6537b7764283f3498c403dcd5cf258685e65564bedd4271bda3096ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for kos-verify 1.0.0b1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.