Installing Eureqa

From SUMOwiki
Jump to navigationJump to search

Eureqa is a symbolic regression tool which allows you to find mathematical equations behind your data. This page details how to get Eureqa ([1]) 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.

Installation

  • 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 eureqa_select_SUMO.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 configure from 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

On linux

  • 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
  • Edit Makefile to change FILE = eureqa_select -> FILE = eureqa_select_SUMO
  • Type in make in a linux terminal and the building process should start
  • When the building process is done you will have eureqa_select.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 2009b

Note that these installation instructions require a file (mexversion.rc) which is not available in later versions of Matlab. We have yet to find a solution :). These instructions are based on these instructions and came about with the help of Joeri Ruyssinck.

  • 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.
  • Add mexversion.rc (matlab root\extern\include) to your project (Project -> Add Existing Item).
  • 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. Otherwise 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_SUMO.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.

Good luck!