Metadata-Version: 2.3
Name: trano-optimization
Version: 0.2.0
Summary: Optimal control, moving horizon estimation and simulation of Modelica models with rumoca, CasADi and IPOPT.
Keywords: modelica,casadi,model predictive control,optimal control,building energy
Author: Ando Andriamamonjy
Author-email: Ando Andriamamonjy <andoludovic.andriamamonjy@gmail.com>
License: LGPL-3.0-or-later
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python
Classifier: Typing :: Typed
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: pydantic>=2.13.4,<3
Requires-Dist: numpy>=2.0,<3
Requires-Dist: casadi>=3.6.7,<4
Requires-Dist: rumoca>=0.10.2,<0.11
Requires-Python: >=3.11, <4.0
Project-URL: Repository, https://github.com/andoludo/trano-optimization
Description-Content-Type: text/markdown

# trano-optimization

Optimal control, moving horizon estimation and simulation of Modelica models: [rumoca](https://github.com/CogniPilot/rumoca)
translates the model into a CasADi function, solved by direct collocation with IPOPT.

It works on the Modelica text of an explicit ODE (for instance the `building_mpc` model that
[trano](https://github.com/andoludo/trano) generates with its FastModelMPC library) and does not depend on trano.

```python
from trano_optimization import CasadiModel, OptimalControl

model = CasadiModel.from_modelica(source, "house.building_mpc")
result = OptimalControl(model).solve(initial_state, disturbances, comfort_lower, price)
```

## Installation

```bash
pip install trano-optimization
```

This installs rumoca 0.10.2 from PyPI, which translates flat models. The models of trano's FastModel libraries are
made of connected components, which rumoca exports to CasADi from 0.10.3 only, not released yet: install it from
its main branch (Rust toolchain), as `[tool.uv.sources]` of `pyproject.toml` does.

```bash
pip install "rumoca @ git+https://github.com/CogniPilot/rumoca@33c21141791cbc341f4788ff6353d2f49d1c740a#subdirectory=crates/rumoca-bind-python"
```

## Development

```bash
uv sync         # builds rumoca from its git source (Rust toolchain)
make linting
make tests
```
