Debt Optimization — Tyrion Lannister Debt‑Paying Optimization (TL‑DPO)
A compact, extensible Python framework implementing the "Tyrion Lannister Debt‑Paying Optimization" (TL‑DPO) meta‑heuristic and utilities for Neural Architecture Search (NAS). TL‑DPO takes controlled "debt" (accepting worse solutions), then repays and overshoots in the opposite direction, plus a learning step toward the best found solution. This repository provides:
- A domain‑agnostic TL‑DPO core (
core/debt_core.py) - A NAS integration with a stable continuous encoding (
architecture/neural_architecture.py) - An optimizer wrapper for NAS experiments (
optimizer/optimizer.py) - A learned surrogate adapter & simple multi‑fidelity evaluation (
evaluation/adapter.py) - Benchmarking and visualization scripts (
benchmarks/) - Unit tests and example scripts (
examples/,tests/)
Features
- Conditional debt moves, severity‑scaled repayment, and double payment (overshoot)
- Directional intelligence toward the global best solution
- Multi‑agent council consensus for population guidance
- Stable continuous architecture encoding and decoding for NAS
- Optional learned surrogate (FAST mode) and real training with successive halving (ACCURATE mode)
- Benchmarking harness with baselines (random, hill‑climber, genetic, regularized evolution)
Installation
Recommended: editable install (for development):
cd "C:\Documents\MHO LAB\debt_optimization"
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -e .
Or install from the distribution wheel produced by python -m build:
python -m pip install dist\debt_optimization-1.0.0-py3-none-any.whl
Optional extras:
pip install ".[full]" # installs torch + matplotlib (if available for your platform)
Quickstart
Run a short example (from the workspace parent folder):
cd "C:\Documents\MHO LAB"
python -m debt_optimization.example_using_package
Or run the simple usage example directly:
python -m debt_optimization.examples.simple_usage
Typical workflow in code:
from debt_optimization import DebtOptimizer, EvaluationMode
opt = DebtOptimizer(mode=EvaluationMode.FAST, eval_budget=100, n_agents=3)
best_arch, best_fitness, history, evals = opt.search(max_iterations=100)
print(best_arch, best_fitness)
Benchmarks & Visualization
Run the quick benchmark suite (FAST mode) comparing TL‑DPO to simple baselines:
python -m debt_optimization.benchmarks.run_benchmarks
Visualize results (requires pandas, matplotlib, seaborn):
python -m debt_optimization.benchmarks.visualize_results benchmarks/results.csv
For rigorous NAS comparisons, integrate with NAS‑Bench datasets (recommended next step).
Testing
Run unit tests with pytest:
cd "C:\Documents\MHO LAB\debt_optimization"
pytest -q
The test suite includes core behavior checks, adapter tests, and optional visualization tests (skipped if plotting libs are unavailable).
Publishing to PyPI
Build distributions and upload (TestPyPI recommended first):
pip install --upgrade build twine
python -m build
twine check dist/*
# Upload to TestPyPI
$env:TWINE_USERNAME = "__token__"
$env:TWINE_PASSWORD = "pypi-...TESTTOKEN..."
twine upload --repository testpypi dist/*
# Upload to PyPI (when ready)
$env:TWINE_PASSWORD = "pypi-...PRODTOKEN..."
twine upload dist/*
Add a pyproject.toml and MANIFEST.in are already included for packaging.
Contributing
Contributions, issues, and PRs are welcome. Suggested next improvements:
- Full ENAS controller or wrappers for public NAS algorithms
- Integration with NAS‑Bench datasets for reproducible comparison
- More comprehensive evaluation metrics (parameters, FLOPs, latency)
- CI pipeline to run tests and optional benchmarks
Please open an issue describing the feature or bug before sending significant changes.
If you want, I can also add a short usage guide page, CI workflow, or a reproducible benchmark notebook — tell me which next.
Metadata
Release files for debt-optimization 1.0.1
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 | |
|---|---|---|---|---|
| debt_optimization-1.0.1.tar.gz | 26.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| debt_optimization-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.0 kB
Release files / debt_optimization-1.0.1.tar.gz
| Download URL | debt_optimization-1.0.1.tar.gz |
|---|---|
| Size | 26.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f703cfe147714b81f69081f9ebd48078fb1081335963cc73958e823a9bf8661d
|
|
BLAKE2b-256 checksum How to use checksums |
ffd6638c0b51af786564cb73ca6f026d6d0863b82e303decd46a4ae99e0ba1b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0
|
Release files / debt_optimization-1.0.1-py3-none-any.whl
| Download URL | debt_optimization-1.0.1-py3-none-any.whl |
|---|---|
| Size | 23.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce4295b840edc55d9fd8576bbc2dc35ae0db64574bc3feee59ccd66bb2ac072c
|
|
BLAKE2b-256 checksum How to use checksums |
d3f8209c697fc94d62f06a3fd26ce6de345ebfc546d1b7c71865581afeb079c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0
|
Security for debt-optimization 1.0.1
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.