Metadata-Version: 2.4
Name: variable-adding
Version: 1.0.0
Summary: Adaptive fractional, weighted, and iterative variable addition
Author: Sourceduty
Keywords: variable adding,adaptive increments,weighting,optimization
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# Variable Adding 1.0.0

An experimental, dependency-free Python toolkit integrating **Variable Adding** and
**Optimation** ideas: fractional increments, 1–100 percent weighting, exploratory
trade-offs, coordinate-search models, and weighted gradient descent.

## Installation

```bash
pip install variable-adding
```

## Example

```python
from variable_adding import (
    apply_weight, weighted_blend, sweep_weights,
    Model, Variable, Objective, minimize, weighted_gradient_descent,
)

print(apply_weight(10, 20, 90))  # 29.0 = B + 90% of A
print(weighted_blend(10, 20, 90))  # 11.0 = 90% A + 10% B
print(sweep_weights(10, 20, [10, 50, 90]))

model = Model()
model.add_variable(Variable("x", 5, lower=-10, upper=10))
model.set_objective(Objective(lambda values: (values["x"] - 2)**2))
print(minimize(model))

history = weighted_gradient_descent(
    lambda x: x[0]**2,
    lambda x: (2*x[0],),
    (4.0,), weights=[25, 50, 100], c=1, lipschitz=2,
    iterations=100,
)
print(history[-1])
```

## API

- **Core**: `variable_add`, `half_add`, `quarter_add`, `double_add`,
  `percentage_add`, `weighted_add`, `exponential_add`.
- **Adaptive**: `adaptive_step`, `iterate_add`, `optimize_scalar`.
- **Weighting**: `apply_weight`, `weighted_blend`, `tradeoff_update`,
  `half_weighted_balance`, `exponential_blend`, `quadratic_blend`, `sweep_weights`.
- **Model API**: `Variable`, `Objective`, `Model`, `Result`, `minimize`.
- **Gradient**: `weight_law_rate`, `weighted_gradient_descent`, `GradientStep`.
- **Quantum-inspired parameter tools**: `tune_angle`, `rotation_matrix`.
  These do not implement quantum computing or quantum error correction.

The weighting formulas correspond to examples in the supplied Optimation documents.
The model API is a new compatible-style interface, not a claim of exact backward
compatibility with every previously published `optimation` version.

**Caution:** Coordinate search is heuristic and not guaranteed to find a global
optimum. The gradient law requires a smooth lower-bounded objective and a correct
Lipschitz gradient constant; this library cannot verify those assumptions.
Claims of empirical performance improvements or quantum hardware advantages are
not established by these implementations.

## Publishing

```bash
python -m pip install --upgrade build twine
python publish_pypi.py --dry-run
python publish_pypi.py --repository testpypi
python publish_pypi.py --repository pypi
```

Publishing needs a repository-specific API token. Version 1.0.0 must be unused
on the target index. Source material: Optimation, Examples, Optimation Weight Law,
Variable Adding and Variable Adding Theorem supplied by Sourceduty.
