MOO4Modelica
A Multi-objective Optimization framework and workflow for Modelica.
GitHub Page: https://wangzizhe.github.io/MOO4Modelica

Motivation: The paper "A Multi-objective Optimization Algorithm and Process for Modelica Model" stated two challenges:
- the functions for multi-objective optimization are limited in Modelica,
- MOO is slow.
I want to design a general framework to solve these two challenges by
-
coupling Python's MOO frameworks to Modelica using OMPython,
-
Speed up MOO by enabling parallel computing.
Framework
Highlights:
-
Easy to configure: All settings and configurations can be defined in
config.py
. - SoTA algorithms for MOO: Support different libraries and algorithms.
- Enable use of parallel computing: For accelerated process.
- Support transformation into feature models: To better analyze and understand large-scale models.
- Comprehensive debugging system: Debugging functions for all critical steps.
Structure:
./src/
(Feature Model Transformation)
|-- modelica.g4
|-- parse_modelica.py
|-- feature_model.py
(Optimization Operation)
|-- config.py
|-- optimize_main.py
|-- parallel_computing.py
|-- optimization_libraries.py
- (Feature Model Transformation)
-
modelica.g4
: an ANTLR4 grammar for Modelica files -
parse_modelica.py
: parse a Modelica model to extract it components and their parameters -
feature_model.py
: create a feature model and add the extracted components
-
- (Optimization Operation)
-
config.py
: global settings and configurations -
optimize_main.py
: main optimization script -
parallel_computing.py
: parallel_computing -
optimization_libraries
: initialization libraries and algorithms
-
(*) There is another one-script Python file provided, which corresponds to the 4 optimization scripts.
Usage
https://wangzizhe.github.io/MOO4Modelica/docs/Usage.html
Example
https://wangzizhe.github.io/MOO4Modelica/docs/Example.html)
Related Work
I. Publications
1. A Multi-objective Optimization Algorithm and Process for Modelica Model
Zhang, Congcong, et al. "A Multi-objective Optimization Algorithm and Process for Modelica Model." 2022 4th International Conference on Artificial Intelligence and Advanced Manufacturing (AIAM). IEEE, 2022.
Problem: In the current commercial software based on Modelica model, there are few functions for multi-objective optimization, and the current multi-objective optimization algorithm has the problems of insufficient approximation of the optimal solution set and uneven distribution of the solution set.
Objective: To solve this problem, Combined with the characteristics of Modelica model and NSGA-II algorithm, this paper proposes a multi-objective optimization algorithm and process for Modelica model.
Solution: This paper provides a multi-objective optimization design process for the current modeling and simulation platform. The process analyzes the model variables according to ANTLR4 and transforms the tree structure.
Future Work: MOO takes huge computing resources, so it is slow, the future work would be to implement parallel computing to solve this problem.
Zizhe's thoughts:
- This paper only provides the idea of the overall process, I can't find it anywhere or reproduce it. Also, the ANTLR method seems complicated.
- The future work part in this paper is interesting for me and the authors are not doing it. So I could think about implementing parallel computing.
2. DESA - Optimization of variable structure Modelica models using custom annotations
Bender, Daniel. "DESA: Optimization of variable structure modelica models using custom annotations." Proceedings of the 7th International Workshop on Equation-Based Object-Oriented Modeling Languages and Tools. 2016.
Contribution: The library DESA uses custom annotations to implement the optimization task to the model. Further, the model is exported including this meta-information. The DESA optimization tool then allows to set of the optimization task in a Matlab environment and operates the optimization run. In this way, the optimization of variable structure models is achieved.
Zizhe's thoughts:
- This only works in Dymola...
II. Frameworks
0. pymoo: Multi-objective Optimization in Python
The framework offers state-of-the-art single- and multi-objective optimization algorithms and many more features related to multi-objective optimization such as visualization and decision-making.
1. DEAP (Distributed Evolutionary Algorithms in Python)
DEAP is a flexible framework for evolutionary algorithms. It provides tools for single and multi-objective optimization, making it suitable for a wide range of optimization problems.
- Documentation: https://deap.readthedocs.io
- GitHub: https://github.com/DEAP/deap
2. Platypus
Platypus is a framework for evolutionary computing with a focus on multi-objective optimization. It supports a variety of algorithms and is designed to be user-friendly.
- Documentation: https://platypus.readthedocs.io
- GitHub: https://github.com/Project-Platypus/Platypus
3. PyGMO (Python Global Multiobjective Optimizer)
PyGMO is a scientific library for massively parallel optimization. It provides a wide range of optimization algorithms, including those for multi-objective optimization.
- Documentation: https://esa.github.io/pygmo2/
- GitHub: https://github.com/esa/pygmo2
4. SciPy
SciPy is a fundamental library for scientific computing in Python, which includes several optimization routines. While it focuses more on classical optimization algorithms, it is still quite powerful for certain types of optimization problems.
- Documentation: https://docs.scipy.org/doc/scipy/reference/optimize.html
5. Nevergrad
Nevergrad is a gradient-free optimization platform by Facebook AI Research. It provides a variety of algorithms suitable for optimization tasks where gradients are not available.
- Documentation: https://facebookresearch.github.io/nevergrad/
- GitHub: https://github.com/facebookresearch/nevergrad
6. Optuna
Optuna is an automatic hyperparameter optimization software framework, particularly for machine learning, but it can be used for general optimization tasks. It supports both single-objective and multi-objective optimization.
- Documentation: https://optuna.readthedocs.io/en/stable/
- GitHub: https://github.com/optuna/optuna
7. NSGA-II (Non-dominated Sorting Genetic Algorithm II) Implementations
While NSGA-II is available in pymoo
, other libraries also provide implementations of this popular algorithm for multi-objective optimization:
- jMetalPy: https://jmetalpy.readthedocs.io/en/latest/ (focused on multi-objective optimization)
- Inspyred: http://aarongarrett.inspyred.github.io/ (another evolutionary computing framework)
8. CMA-ES (Covariance Matrix Adaptation Evolution Strategy)
CMA-ES is a robust optimization algorithm suitable for difficult optimization problems. Libraries such as pycma
provide implementations of this algorithm.
- Documentation: https://pypi.org/project/cma/
- GitHub: https://github.com/CMA-ES/pycma