Eureqa is a symbolic regression tool which allows you to find mathematical equations behind your data. This page details how to get Eureqa () working in SUMO. The Matlab interface is a modified version of code found here. The original code and license agreement can be found in the EureqaModel folder in the SUMO Toolbox.
- Go to the Eureqa website and download the latest Eureqa standalone server for your operating system
- Place the Eureqa server in the @EureqaFactory folder which is located in the src folder of the SUMO root.
- Make sure you have a mex compilation of the modified eureqa_select.cpp which is based on code from Johannes Jenkner (which you can find here). There are two possibilities either the required mex file is already included with your SUMO installation in the contrib folder (a subfolder of the src folder) or you have to build it your self. You can check whether the mex is present by first configuring the toolbox (in the Matlab console type
configurefrom the SUMO root) and then typing in
eureqa_select. You will either see an instruction on how to the eureqa_select function or you will get an "Undefined function or variable 'eureqa_select'" error which means you will have to build or obtain the proper mex files.
Building the mex files yourself
- Install the Boost C++ libraries (Boost.org) following the instructions on the Boost website. Make sure you build the asio, system, thread, date_time and serialization libraries
- Download the Eureqa API
- Extract the eureqa_select.zip which you can find in the EureqaModel folder
- Edit the Makefile to point to your Matlab install, the Boost include files, the Boost library files and the Eureqa API files. Note that you don't need the "<" and ">" brackets
- Type in
makein a linux terminal and the building process should start
- When the building process is done you will have a eureqa_select_SUMO.mexglx file or a eureqa_select.mexa64 depending on your system architecture to put in the contrib folder.
On Windows using Visual Studio 2010 and Matlab
- Install the Boost C++ libraries for Windows (Boost.org) following the "Getting started instructions". Alternatively you can watch this youtube video. Note that if you are working on a 64-bit system you need to add this "address-model=64" option to the build options.
- This website also has instructions on how to install Boost.
- Start Visual Studio
- Create a new Win32 project -> click next and select empty project
- Name the project eureqa_select
- Make sure you are working in Release mode if you only build the release version of Boost. You can change this in the Solution Configurations
- If you are using a 64-bit system, you need to change the Solution Platform" from Win32 to x64.
- OPTIONAL STEP: Add mexversion.rc (matlab root\extern\include) to your project (Project -> Add Existing Item). Matlab 2010a and later do not have this file.
- Create a .def file with the following text (Project -> Add New Item)
LIBRARY "eureqa_select.mexw32" EXPORTS mexFunction
if you are using a 32-bit system. If you are using a 64-bit system change the extension to mexw64
- Right click on "Resource Files" in the Solution Explorer and select add Existing Item and browse to the eureqa_select.cpp file.
- Right click on eureqa_select in the Solution Explorer and select Properties
- In C/C++ General add to "Additional Include Directory" the Matlab include directory (MatlabRoot\extern\include), the Eureqa API (the folder that contains the folder eureqa, examples and the server folder) and the Boost include files
- In C/C++ Preprocessor properties add MATLAB_MEX_FILE as preprocessor definition
- Under Linker General properties add to "Additional Library Directories" the folder MatlabRoot\extern\lib\win32 or win64\microsoft and the Boost library folder (BoostRoot\stage\lib)
- Under Linker General properties change the value of Output File to $(OutDir)$(TargetName).mexw32/64 depending on your architecture
- In Linker Input properties add to Additional Dependencies: libmx.lib, libmat.lib, libmex.lib and libboost_serialization-vc100-mt-1_48.lib (which should be in the Boost library folder).
- Under Linker Command Line add: /export:mexFunction /dll
- Click apply and wait for Visual Studio to process all this
Push F7 to build and hopefully there are no bugs :). The mex file can be found in the Release subfolder of your Visual Studio project.