Year: 2025
Type: other
Abstract: This thesis demonstrates the building of a Python interface for SHOT (Supporting Hyperplane Optimization Toolkit). SHOT is a program written in the programming language C++. Python interfaces are used for calling a program directly via Python. To this day, the only way to use SHOT via Python is by using Pyomo, which is a Python-based optimization modeling framework. Pyomo can be used to solve problem instances using commercial and open-source solvers. It is, however, quite slow and at the time of writing the only way you can call SHOT from it is by running a problem file from Python, meaning that there is no way to configure the behaviour of SHOT via Pyomo. Three different alternatives for creating Python interfaces was presented briefly; Pybind11, SWIG, and Cython. All the alternatives use some sort of Python bindings. The presentation of the different alternatives was done by showcasing a simple C++ function and creating the Python bindings with Pybind11, SWIG, and Cython. The framework chosen for SHOT’s Python interface was Pybind11, which is a lightweight header-only library. The implementation of Pybind11 as a Python interface was done by modifying the existing CMakeLists.txt file in the SHOT library. In the CMakeLists.txt file, all configuration for Pybind11 compilation was done. For the actual Pybind11 library, a separate .cpp file was created, containing all the necessary Python bindings for the Python interface. Based on this .cpp file, the dynamic shotpy library can be created when compiling SHOT. The result of this thesis is a Python interface that is included in the SHOT installation which makes it possible to call SHOT directly from Python. Using Python as a programming language opens many doors for further data analysis and manipulation. The Python interface created in this thesis proves that Python is a programming language that can be used to call existing C++ code, without any previous experience from C++. To utilize the full potential of SHOT, the Python interface should be developed further, hand-in-hand with SHOT.
Source: Doria (University of Helsinki)
Author: Ekman, Johan
Language: English
Subfield: Numerical Analysis
Field: Mathematics
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W7115353806
