FMI-compliant Model Estimation in Python
Description
modestpy facilitates parameter estimation in models compliant with Functional Mock-up Interface.
Features:
- combination of global and local search methods (genetic algorithm, pattern search, truncated Newton method, L-BFGS-B, sequential least squares),
- suitable also for non-continuous and non-differentiable models,
- scalable to multiple cores (genetic algorithm from modestga),
- Python 3.
Installation with pip (recommended)
It is now possible install ModestPy with a single command:
pip install modestpy
Alternatively:
pip install https://github.com/sdu-cfei/modest-py/archive/master.zip
Installation with conda
Conda is installation is less frequently tested, but should work:
conda config --add channels conda-forge conda install modestpy
Test your installation
The unit tests will work only if you installed modestpy with conda or cloned the project from GitHub. To run tests:
>>> from modestpy.test import run
>>> run.tests()
or
cd <project_directory> python ./bin/test.py
Usage
Users are supposed to call only the high level API included in
modestpy.Estimation
. The API is fully discussed in the docs.
You can also check out this simple example.
The basic usage is as follows:
from modestpy import Estimation
if __name__ == "__main__":
session = Estimation(workdir, fmu_path, inp, known, est, ideal)
estimates = session.estimate()
err, res = session.validate()
More control is possible via optional arguments, as discussed in the documentation.
The if __name__ == "__main__":
wrapper is needed on Windows, because modestpy
relies on multiprocessing
. You can find more explanation on why this is needed
here.
modestpy
automatically saves results in the working
directory including csv files with estimates and some useful plots,
e.g.:
- Error evolution in combined GA+PS estimation (dots represent switch from GA to PS):
- Visualization of GA evolution:
- Scatter matrix plot for interdependencies between parameters:
Cite
To cite ModestPy, please use:
K. Arendt, M. Jradi, M. Wetter, C.T. Veje, ModestPy: An Open-Source Python Tool for Parameter Estimation in Functional Mock-up Units, Proceedings of the American Modelica Conference 2018, Cambridge, MA, USA, October 9-10, 2018.
The preprint version of the conference paper presenting ModestPy is available here. The paper was based on v.0.0.8.
License
Copyright (c) 2017-2019, University of Southern Denmark. All rights reserved.
This code is licensed under BSD 2-clause license. See LICENSE file in the project root for license terms.