-
Notifications
You must be signed in to change notification settings - Fork 0
2.Installation
qpSWIFT can be downloaded from the following [link] as
git clone https://github.com/qpSWIFT/qpSWIFT
(Prerequisites: cmake, c/c++ compiler)
To build the qpSWIFT library from the source on your system, download the qpSWIFT repository and type the following commands from the qpSWIFT project source directory
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
To install the libraries, type
sudo cmake --build build --target install
or
cd build
sudo make install
You can now add qpSWIFT to your project. Instructions for this can be found in adding qpSWIFT to cmake. Take a look at the demo files in c/c++ interface.
To build the qpSWIFT library from the source on your system, download the qpSWIFT repository and type the following commands from the qpSWIFT project source directory
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
To install the libraries, type
sudo cmake --build build --target install
or
cd build
sudo make install
You can now add qpSWIFT to your project. Instructions for this can be found in adding qpSWIFT to cmake. Take a look at the demo files in c/c++ interface.
On Windows machine, download the qpSWIFT repository and type the following commands from the qpSWIFT project source directory in the command prompt or windows powershell
cmake -S . -B build
To generate build files for a specific MSVC version (e.g., Visual Studio 15 compiler), use
cmake -S . -B build -G "Visual Studio 15 2017"
This creates the necessary build files to generate qpSWIFT libraries. Alternatively, you can use the cmake-gui to generate build files. To compile the libraries, type
cmake --build build -j8 --config Release
Please ensure that you have permission to install libraries on your system. The install folder can be set via CMAKE_INSTALL_PREFIX. To install the libraries,
cmake --build build --target install
You can now add qpSWIFT to your project. Instructions for this can be found in adding qpSWIFT to cmake. Take a look at the demo files in c/c++ interface.
To incorporate qpSWIFT into your project, add the following lines into your cmake file
find_package(qpSWIFT)
// To incorporate static library
target_link_libraries(<target_name> PRIVATE qpSWIFT::qpSWIFT-static)
// To incorporate shared library
target_link_libraries(<target_name> PRIVATE qpSWIFT::qpSWIFT-shared)
(Prerequisites: Matlab compatible c compiler)
To build the qpSWIFT matlab interface from the source on your system, download the qpSWIFT repository and change the matlab working directory to qpSWIFT/matlab. Type the following command in the command window from the qpSWIFT matlab directory
Swift_make('qpSWIFT_mex.c')
This creates a mex file depending on the configuration of the system. To use qpSWIFT in your projects, copy this mex file into project working directory or add this folder to the matlab search path. You can run the demoqp.m file to check if the installation was successful. Instructions on using the qpSWIFT matlab interface can be found at the matlab examples
(Prerequisites: c compiler, numpy, distutils)
To build the qpSWIFT python interface from the source on your system, type the following command from the qpSWIFT python directory in the system command line.
pip3 install .
Depending on the system, you may require administrator privileges. This builds and installs the qpSWIFT module in your system. You can run the demoqp.py file to check if the installation is successful. Instructions on using the qpSWIFT python interface can be found at python examples
There are two Simulink s-functions available for qpSWIFT interface. The first s-function qpSWIFT_sfunc_e.c
provides an interface to qpSWIFT to handle QP's with both equality and inequality constraints. The second s-function provides the interface to qpSWIFT to handle QP's with only inequality constraints. Before, compiling the s-function, change the number of output variables a.k.a length of the solution of the QP. This can be done by changing the pre-processor definition NV (line 13) to required values in the respective s-functions.
#define NV 3 /* change 3 to required value */
To compile qpSWIFT simulink interface with both equality and inequality constraints, type
Swift_make('qpSWIFT_sfunc_e')
To compile qpSWIFT simulink interface with only inequality constraints, type
Swift_make('qpSWIFT_sfunc')
Demo simulink models can be found at demoqp_e.slx and demoqp.slx.