Metadata-Version: 2.4
Name: optimization-library
Version: 1.0.4
Summary: A Python library for linear, nonlinear, and integer programming
Home-page: https://github.com/UWFms/optimization-library
Author: UwuFlames
Author-email: uwaterflames@gmail.com
License: MIT
Project-URL: Documentation, https://disk.yandex.ru/i/k7wqcUCCx1Ym9Q
Project-URL: Source, https://github.com/UWFms/optimization-library
Keywords: optimization linear-programming nonlinear-programming integer-programming
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy~=2.3.0
Requires-Dist: cvxpy~=1.6.5
Requires-Dist: pandas~=2.3.0
Requires-Dist: matplotlib~=3.10.3
Requires-Dist: PuLP~=3.2.1
Requires-Dist: scipy~=1.15.3
Requires-Dist: openpyxl~=3.1.5
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Optimization Library

A Python library for solving linear, nonlinear, and integer programming problems. The library provides a collection of optimization algorithms for tasks such as the diet problem, model parameter optimization, and the 0-1 knapsack problem.

## Features

- **Linear Programming**: Solve problems like the diet problem using methods such as Simplex, Relaxation, Column Generation, ADMM, and Mirror Descent.
- **Nonlinear Programming**: Optimize model parameters with methods like Gradient Descent, Newton's Method, Steepest Descent, Adam, and Nelder-Mead.
- **Integer Programming**: Solve the 0-1 knapsack problem using Branch and Bound, Gomory Cuts, Cutting Planes, Lagrangian Relaxation, and Sherali-Adams (Level 1).
- Visualization and logging of optimization results using Matplotlib and Pandas.

## Installation

Install the library using pip:

```bash
pip install optimization-library
```

Requirements
- numpy~=2.3.0
- cvxpy~=1.6.5
- pandas~=2.3.0
- matplotlib~=3.10.3
- PuLP~=3.2.1
- scipy~=1.15.3
- openpyxl~=3.1.5

# Usage
Linear Programming
```bash
import numpy as np
from optimization_library import solve_lp, post_processing_linear_approximation_logs

c = np.array([3, 2], dtype=float)
A = np.array([[1, 1], [2, 1]], dtype=float)
b = np.array([4, 5], dtype=float)
methods = ["simplex", "ADMM"]

results = [solve_lp(method, c, A, b, epsi=1e-6, is_maximization=True) for method in methods]
post_processing_linear_approximation_logs(results, visual=True, file_print=True)
```
Nonlinear Programming
```bash
import numpy as np
from optimization_library import solve_nlp, post_processing_non_linear_approximation_logs

t = np.linspace(0, 2 * np.pi, 10)
y = np.exp(-0.5 * t) + np.sin(-1.2 * t)
model = lambda x, t: np.exp(-x[0] * t) + np.sin(x[1] * t)
x0 = [0.25, 0.25]
bounds = [(-3.5, 2.5), (-4.2, 2.8)]
methods = ["adam", "nelder-mead"]

results = [solve_nlp(method, x0, t, y, model=model, bounds=bounds, epsilon=1e-6) for method in methods]
post_processing_non_linear_approximation_logs(results, visual=True, file_print=True)
```
Integer Programming
```bash
from optimization_library import solve_ip, post_processing_integer_approximation_logs

weights = [2, 3, 4, 5]
values = [3, 4, 5, 6]
capacity = 10
methods = ["branch_and_bound", "gomory"]

results = [solve_ip(method, weights, values, capacity, epsilon=1e-4) for method in methods]
post_processing_integer_approximation_logs(results, visual=True, file_print=True)
```

# Examples
A console application demonstrating the usage of the library is available in the GitHub repository under the examples/ directory. Run it with:
```bash
git clone https://github.com/UWFms/optimization-library.git
cd optimization-library
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
python example\main.py
```
# License
This project is licensed under the MIT License. See the LICENSE file for details.

# Contributing
Contributions are welcome! Please submit issues or pull requests to the GitHub repository https://github.com/UWFms/optimization-library.

# Documentation
Full documentation is available at https://disk.yandex.ru/i/k7wqcUCCx1Ym9Q.
