Difference between revisions of "Installing Eureqa"

From SUMOwiki
Jump to navigationJump to search
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
This page details how to get Eureqa ([http://creativemachines.cornell.edu/eureqa]) working in SUMO. The Matlab interface is a modified version of code found [http://www.mathworks.com/matlabcentral/fileexchange/32225-interface-with-eureqa-featuring-symbolic-regression here]. The original code and license agreement can be found in the EureqaModel folder in the SUMO Toolbox.
+
Eureqa is a symbolic regression tool which allows you to find mathematical equations behind your data. This page details how to get Eureqa ([http://creativemachines.cornell.edu/eureqa]) working in SUMO. The Matlab interface is a modified version of code found [http://www.mathworks.com/matlabcentral/fileexchange/32225-interface-with-eureqa-featuring-symbolic-regression here]. The original code and license agreement can be found in the EureqaModel folder in the SUMO Toolbox.
  
 
==Installation==
 
==Installation==
Line 5: Line 5:
 
* Go to [http://creativemachines.cornell.edu/eureqa the Eureqa website] and download the latest Eureqa standalone server for your operating system
 
* Go to [http://creativemachines.cornell.edu/eureqa 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.
 
* 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 [http://www.mathworks.com/matlabcentral/fileexchange/32225-interface-with-eureqa-featuring-symbolic-regression 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 <code>configure</code> from the SUMO root) and then typing in <code>eureqa_select</code>. 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.
+
* 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 [http://www.mathworks.com/matlabcentral/fileexchange/32225-interface-with-eureqa-featuring-symbolic-regression 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 <code>configure</code> from the SUMO root) and then typing in <code>eureqa_select</code>. 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==
 
==Building the mex files yourself==
Line 14: Line 14:
 
* Extract the eureqa_select.zip which you can find in the EureqaModel folder
 
* 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 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 <code>make</code> in a linux terminal and the building process should start
 
* Type in <code>make</code> 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.
+
* 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===
  
===On Windows using Visual Studio 2010 and Matlab 2009b===
+
These instructions are based on these [http://coachk.cs.ucf.edu/GPGPU/Compiling_a_MEX_file_with_Visual_Studio2.htm instructions] and came about with the help of [http://sumo.intec.ugent.be/?q=joerir Joeri Ruyssinck].
  
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 [http://coachk.cs.ucf.edu/GPGPU/Compiling_a_MEX_file_with_Visual_Studio2.htm instructions] and came about with the help of [http://sumo.intec.ugent.be/?q=joerir Joeri Ruyssinck].
+
* Install the Boost C++ libraries for Windows ([http://www.boost.org Boost.org]) following the "Getting started instructions". Alternatively you can watch this [http://www.youtube.com/watch?v=5AmwIwedTCM 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 [http://stackoverflow.com/questions/2629421/how-to-use-boost-in-visual-studio-2010 website] also has instructions on how to install Boost.
* Install the Boost C++ libraries for Windows ([http://www.boost.org Boost.org]) following the "Getting started instructions". Alternatively you can watch this [http://www.youtube.com/watch?v=5AmwIwedTCM 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.
 
* You can also try this [http://stackoverflow.com/questions/2629421/how-to-use-boost-in-visual-studio-2010 website] to install Boost.
 
 
* Start Visual Studio
 
* Start Visual Studio
 
* Create a new Win32 project -> click next and select empty project
 
* Create a new Win32 project -> click next and select empty project
* Name the project eureqa_select
+
* Name the project ''eureqa_select''
* Make sure you are working in ''Release'' mode if you only build the ''release'' version of Boost.
+
* 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''
* Add mexversion.rc (matlab root\extern\include) to your project (Project -> Add Existing Item).
+
* If you are using a '''64-bit system''', you need to change the ''Solution Platform" from ''Win32'' to ''x64''.
* Create a .def file with the following text
+
* 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)
 
<code>
 
<code>
 
   LIBRARY "eureqa_select.mexw32"
 
   LIBRARY "eureqa_select.mexw32"
 
   EXPORTS mexFunction  
 
   EXPORTS mexFunction  
 
</code>
 
</code>
if you are using a 32-bit system. Otherwise change the extension to mexw64
+
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_SUMO.cpp file.
+
* 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
 
* 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++ 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
+
** 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''' add to "Additional Library Directories" the folder MatlabRoot\extern\lib\win32 or win64\microsoft and the Boost library folder (BoostRoot\stage\lib)
** 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 General properties''' change the value of Output File to ''$(OutDir)$(TargetName).mexw32/64'' depending on your architecture
** Under Linker Command Line add: /export:mexFunction /dll
+
** 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
 
* Click apply and wait for Visual Studio to process all this
* Expand External Dependencies in Solution Explorer and include mex.h, eureqa.h and windows.h (Right click -> include in project).
 
  
  
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. It is possible that you will have to rename the file from eureqa_select.exe to eureqa_select.mexw32/64 depending on your architecture.
+
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!
 
Good luck!

Latest revision as of 00:34, 11 February 2012

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 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 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
  • Type in make in 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

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. 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.

Good luck!