Switch language:
The overall FFSM++ development environment requires a little bit of efforts in its start-up, due to the many tools used, but on the other hand once all these tools has been set-up it results in a very powerful one.
The FFSM development itself is done using Qt Creator, a multi-platform Integrated Development Environment (IDE) based on the popular Qt libraries.
This section contains detailed instructions on how to get and install the IDE and all the necessary prerequisites, in both Windows or Linux environment. For the former, third party libraries (IPOPT, Adol-C, ColPack) are already available within the FFSM source code repository, so the instruction for their installation refers only to the case that a new version of them is released and the user want to upgrade to it.
NOTE: It's many years we don't try the Windows procedure, so it is likely to be obsolete. We strongly suggest to use FFSM in Linux, eventually using a virtual machine or the Windows Subsystem for Linux (WSL).
See older revisions of this page for older Ubuntu systems and for tips to solving some errors no longer occurring in Ubuntu 18.04 and 16.10.
The following packages and their prerequisites should be installed:
sudo apt-get install build-essential gfortran gcc g++ gcc-12 sudo apt-get install libtool libtool-bin git patch wget pkg-config sudo apt-get install zlib1g-dev libboost-all-dev libblas-dev liblapack-dev liblapack64-dev libmetis-dev libatlas-base-dev sudo apt-get install qtbase5-dev qtbase5-dev-tools qtchooser qt5-qmake qtcreator
(not all are likely to be necessary, we just tried successfully this combination)
Create a folder for installing the various FFSM dependencies. Here we use `~/programs`:
cd ~ mkdir programs cd programs
Ipopt is the solver engine used by FFSM. Itself it uses several libraries. The procedure describe below installs all the “third parties” IPOPT libraries and finally IPOPT itself.
For using the HSL linear solver (optional, as it requires a free academic licence, but way faster than MUMS) go to http://www.hsl.rl.ac.uk/ipopt/ and download “Coin-HSL Full (Stable)”, “Source”. Wait for the email with the link and then unzip, rename and move the archive as to be `~/programs/Ipopt/ThirdParty/HSL/coinhsl`
mkdir Ipopt cd Ipopt wget https://github.com/coin-or/Ipopt/archive/refs/tags/releases/3.14.16.tar.gz tar -xzf 3.14.16.tar.gz cd ~/programs/Ipopt git clone https://github.com/coin-or-tools/ThirdParty-ASL.git cd ThirdParty-ASL ./get.ASL ./configure --prefix="/usr" 'CXXFLAGS=-O3' 'CFLAGS=-O3' make sudo make install cd .. git clone https://github.com/coin-or-tools/ThirdParty-HSL cd ThirdParty-HSL [extract the HSL archive as `~/programs/Ipopt/ThirdParty/HSL/coinhsl`] ./configure --prefix="/usr" 'CXXFLAGS=-O3' 'CFLAGS=-O3' make sudo make install cd ../Ipopt-releases-3.14.16/ mkdir build cd build ../configure --prefix="/usr" 'CXXFLAGS=-O3' 'CFLAGS=-O3' make sudo make install cd ../../..
git clone https://github.com/CSCsw/ColPack.git # Download ColPack as ~/programs/ColPack cd ColPack # ColPack Root Directory git checkout 10b780b52a25c6ccef3d2abc12055ee85b7e8667 # checkout a version know to works autoreconf -vif ./configure --prefix=/usr 'CXXFLAGS=-O3' 'CFLAGS=-O3' make sudo make install cd ..
git clone https://github.com/CSCsw/ColPack.git # Download ColPack as ~/programs/ColPack cd ColPack/build/automake/ autoreconf -vif mkdir mybuilds cd mybuilds ../configure --prefix=/usr 'CXXFLAGS=-O3' 'CFLAGS=-O3' make -j 8 sudo make install cd ../../../..
mkdir ADOL-C cd ADOL-C wget https://www.coin-or.org/download/source/ADOL-C/ADOL-C-2.7.2.zip unzip ADOL-C-2.7.2.zip cd ADOL-C-2.7.2/ ./configure --enable-docexa --enable-addexa --enable-sparse --prefix=/usr 'CXXFLAGS=-O3' 'CFLAGS=-O3' make sudo make install
cd /usr/lib sudo ln -s ../lib64/libadolc.la . sudo ln -s ../lib64/libadolc.so . sudo ln -s ../lib64/libadolc.so.2 . sudo ln -s ../lib64/libadolc.so.2.1.0 . sudo ln -s ../lib64/libadolc.so.2.2.0 .
cd /usr/include sudo ln -s coin-or coin
(may not be necessary)
libtool –finish /usr/local/lib
libtool –finish /usr/lib
New Sept 2018 (work in progress)
Download:
MinGW is the windows version of the g++ compiler, together with a minimal unix-style environment that allow to compile unix programs natively in windows.
Please follow the instructions below:
Alternative version for installing the Qt libraries from source
cd /c/Qt/5.x.x configure.exe -qt-zlib -opensource -release -platform win32-g++ mingw32-make
Notes: These instructions were written for the now obsolete Qt4. We didn't tested them with the newer Qt5 that are required by the model, but we think the procedure should be similar. Qt 4.8.3 had a know bug that required adding QMAKE_RCC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}rcc.exe after the QMAKE_IDC line in C:\Qt\4.8.3\mkspecs\win32-g++\qmake.conf
Update 20150929: We didn't yet tested Qt5, as unfortunately as they are now shipped together with MinGW, this would means to update also the windows MinGW compiler. In turn this mean to have to recompile all the ThirdParty libraries. We stuck with the Qt4.8/MinGW 4.6.2 for now.
To allow compilation of the code with Qt4.8 instead of Qt5, just comment “#include <QtWidgets>” and decomment “#include <QtGui>” on top of InputNode.cpp, MapBox.cpp, ScenarioSelectionWidget.cpp and MainWindow.cpp. On this last file also comment '#include “QApplication”'.
To use Qt5 attenction that most likely you will have to give the full path of the external libraries in the project file and you'll have to compile zlib by yourself (as it's no longer shipped with Qt5).
This step is not required, as a windows 32 version of IPOPT is already shipped with FFSM, but if you want to build your own version of ipopt, e.g. because a new version is available or you want to use a faster linear solver (and you have an academic licence) you can follow these instructions.
cd /c/ipopt/ mkdir build cd build ../configure make make install
./configure –prefix=/usr make g++ -shared -Wl,-soname,libColPack.so -o libColPack.so <list of object files>
Notes: If linking problems arise with method 2, copy also all the other libColPack.* libraries to [FFSM_ROOT]\src\ThirdParty\win32\lib\. ColPack compile but doesn't work with ADOL-C in MinGW g++ 4.7, so for now it must be retained MinGW g++ 4.6
cd /c/ADOL-C cd ADOL-C ln -s src adolc cd ..
./configure --enable-docexa --enable-addexa --enable-sparse –prefix=/usr make
./configure --enable-docexa --enable-addexa --enable-sparse --prefix=/usr –with-colpack=/usr make
Notes: If you have an error about libtool version mismatch run “autoreconf –force –install” before configure (http://stackoverflow.com/questions/3096989/libtool-version-mismatch-error). Tplease consider that the ln -s command in preparing the ADOL-C compilation actually copys, not links, the two folders.
git clone https://github.com/LEFNancy/ffsm_pp.git
Note: Git repository is currently set private untill we remove from it input data for which we do not have the copyright and hence we can't publicily release.
Once the development environment has been set up it is possible to inspect and change the source code of FFSM using the Qt Creator IDE:
A guide to Qt Creator is out of this paper scope, as abundant documentation can be retrieved from either official and unofficial sources. Hence, we describe here just the very basic operations required to modify and compile the code.
To start the IDE click on the file ffsm.pro. The first time Qt Creator will ask the version of Qt to be used for the project, where the default choices can be accepted.
A few tips (see screenshots):
The icons on the bottom of the left panel allow to perform the main actions at the project level: to compile it (hammer icon), debug it (bug icon) and run it (play icon).
The overlying switch allows to select the current mode between release and debug: the release mode produces a smaller and optimized program that run faster but doesn't allow to keep track of what's happening in the model. The debug mode instead, while running slower, allows to set breakpoints in the code (the red circles) where the execution of the model is halted and the modeller can inspect the situation of any variable within the current scope (right panel).
In the debug mode (to which the screenshot refers) the modeller can also inspect the whole stack leading to that specific point, that is, the list of function calls made up to the point, and can decide where to set the next breakpoint: to the next manually set breakpoint, to the next line, to the first line of the next called function or to the next line of the calling function (therefore executing all the remaining code of the current function until its return).
While the application is debugged it runs as a normal program on its own windows if in GUI mode or under the panel “Application Output” if in console mode.
Optionally FFSM can be packaged in an easy to be used self-installer for Windows.
It is enough to download and install the Nullsoft Install System and, from the windows explorer, right click on the provided windowsInstallerScript.nsi
file and select “Compile NSIS Script”. This is a very simple script that can be edited where appropriate with any text-editor.