Honors thesis - Instructions
These instructions are rudimentary and not very well tested—I'm relying on vague memory in a lot of cases, so if you run into an error that's not mentioned below, contact me and I can help resolve it (and then add to the instructions for future reference!).
Get the source code
Source archives are available in .zip and .tar.gz format. If you prefer using version control or would be interested in looking at the implementation history, you can also clone the git repository by running the following at the command line:
$ git clone http://stanford.edu/~wmonroe4/matrixmult.git
Install Python
The first thing you'll need to do is install Python, if you haven't already. I recommend grabbing the latest 2.x, 32-bit version from the Download page. 64-bit versions and versions that start with "3" are unlikely to work correctly. You'll then want to install setuptools, which makes figuring out Python libraries immeasurably easier.
Install NumPy
NumPy is the first library you'll want to tackle. Windows and Mac users will probably want to get the binary from SourceForge, which is pre-built so you don't have to deal with compiling C code for these operating systems. On Linux, I'm fairly sure that pip is the best option for installing NumPy:
$ easy_install-2.7 pip $ pip install scipy
On all OSs, make sure this worked by starting Python and typing
>>> import numpy
Install SymPy and PuLP
With NumPy and setuptools in hand, you can install two more of the dependencies, SymPy and PuLP. On Windows:
> \Python27\Scripts\easy_install sympy > \Python27\Scripts\easy_install pulp-orOn Linux/Mac (these instructions should apply equally to both, although if Mac users run into issues, let me know):
$ easy_install-2.7 pulp-or $ easy_install-2.7 sympy
(If your version of Python isn't 2.7, change these commands accordingly and cross your fingers.) Now these commands should work:
>>> import sympy >>> import pulp
Install GLPK
GLPK has a binary installer for Windows; after installing it, you should add GLPK's bin directory to your PATH (probably something like C:\Program Files\GnuWin32\bin). On Linux it can typically be installed from official distro sources, e.g. on Ubuntu
$ sudo apt-get install glpk
Mac users will probably have to compile from source, as far as I can tell. Another option is to instead try to use COIN-OR's LP solver (home page), which should also work smoothly with PuLP. The only change necessary should be to replace pulp.GLPK with pulp.COIN in solvers.py, but I haven't tested this.
Install NLopt
For NLopt, once again Windows users have it easier—they can simply download an executable installer. Others will have to install from source. Make sure Python and NumPy are installed, then download the source on the NLopt home page; you'll need to specify the shared library configuration to get it to play well with Python:
nlopt-2.3$ ./configure --enable-shared nlopt-2.3$ make nlopt-2.3$ make install
If this completes successfully, you should be able to open NLopt in Python as well:
>>> import nlopt
Try it out!
Finally, try starting a search for omega:
matrixmult\src> \Python27\python search.py
matrixmult/src$ python search.py