Build and Installation instructions

This document outlines how to build and/or install Dippy.

Requirements

  • Windows
    • SVN, Microsoft Visual Studio or Visual Studio Express, Python 2.7
  • Linux, Mac, other
    • SVN, GCC, Python 2.7 or above

Building Dippy in Windows

From PyPI (the EASY way)

  1. Download and install Python 2.7

    1. Download and run the Windows x86 MSI Installer from the URL

      http://www.python.org/download/releases/2.7.2/

      I installed Python in the default directory C:\Python27

    Python is now set up to run on Windows.

  2. Download setuptools and install

    On Windows 32-bit I went to

    http://pypi.python.org/pypi/setuptools#files

    and ran

    setuptools-0.6c11.win32-py2.7.exe

    On Windows 64-bit (Windows 7) I went to

    http://www.lfd.uci.edu/~gohlke/pythonlibs/

    and ran

    setuptools-0.6c12dev.win-amd64-py2.7.exe

  3. Use easy_install to install Dippy (this will also install PuLP)

    Go to the Scripts directory created by setuptools, on my system this is C:\Python27\Scripts.

easy_install -U coinor.dippy
  1. Test your Dippy installation by running

    python testExs.py

    in the Dippy examples directory. This should run the main Dippy examples successfully.

From source (the HARD way)

  1. Download and install Python 2.7 (same as the EASY way)

    Download and run the Windows x86 MSI Installer from the URL

    http://www.python.org/download/releases/2.7.2/

    I installed Python in the default directory C:\Python27

    Python is now set up to run on Windows.

  2. Download setuptools and install (same as the EASY way)

    On Windows 32-bit I went to

    http://pypi.python.org/pypi/setuptools#files

    and ran

    setuptools-0.6c11.win32-py2.7.exe

    On Windows 64-bit (Windows 7) I went to

    http://www.lfd.uci.edu/~gohlke/pythonlibs/

    and ran

    setuptools-0.6c12dev.win-amd64-py2.7.exe

  3. Download and install PuLP

    Go to the Scripts directory created by setuptools, on my system this is C:\Python27\Scripts. Use easy_install to install PuLP

    easy_install -U coinor.pulp

  4. Download DIP

    1. Download DIP from the COIN svn

      https://projects.coin-or.org/svn/Dip/trunk

      I checked this out into C:\COIN\Dip.

      The latest version of Dippy is included with DIP in C:\COIN\Dip\Dippy.

  5. Build Dippy

    1. Open the Dippy solution in Visual Studio, I used Microsoft Visual C++ 2010 and opened C:\COIN\Dippy\MSVisualStudio\v10\Dippy.sln.

      If your DIP projects are not in the right place you may get errors like

      Project file xxx.vcproj could not be loaded. The project is either missing from the disk or access was denied.

      If this happens you will need to remove the project from the solution and then add them again using the correct DIP location. For example, I deleted libDecomp, then added an existing project to the solution and found libDecomp.vcproj. On my system the libDecomp project is at

      C:\COIN\Dip\Dip\MSVisualStudio\v10\Decomp\libDecomp.vcproj

      You should have a total of 12 projects in the solution.

    1. Fix include and library paths for Dippy. Right-click on the Dippy project and select Properties. Go to C/C++ > General and make sure the Additional Include Directories point to the right place for Python and DIP. On my system this path is

      C:\Python27\include;..\..\..\Dip\src;..\..\..\CoinUtils\src;..\..\..\Osi\src\Osi;..\..\..\Cbc\src\OsiCbc;..\..\..\BuildTools\headers;..\..\..\Osi\src\OsiSpx;..\..\..\Osi\src\OsiVol;..\..\..\Osi\src\OsiOsl;..\..\..\Osi\src\OsiXpr;..\..\..\Osi\src\OsiCpx;..\..\..\Clp\src\OsiClp;..\..\..\Cgl\src;..\..\..\Cgl\src\CglTwomir;..\..\..\Cgl\src\CglMixedIntegerRounding;..\..\..\Cgl\src\CglMixedIntegerRounding2;..\..\..\Cgl\src\CglFlowCover;..\..\..\Cgl\src\CglClique;..\..\..\Cgl\src\CglOddHole;..\..\..\Cgl\src\CglKnapsackCover;..\..\..\Cgl\src\CglGomory;..\..\..\Cgl\src\CglPreProcess;..\..\..\Cgl\src\CglProbing;..\..\..\Clp\src;..\..\..\Cbc\src;..\..\..\Bcps\src;..\..\..\Alps\src;%(AdditionalIncludeDirectories)

      Next go to Linker > General and make sure the Additional Library Directories points to the right place for Python. On my system this path is

      C:\Python27\libs;$(OutDir);%(AdditionalLibraryDirectories)

    2. Patch the DIP files. There are patches for various subfolders in the DIP folder, e.g., alpsMSVisualStudio.patch for the Alps folder

    3. Fix other COIN projects. Hopefully the pathces will fix the projects, but you may need to do some manual fixes.

      I had to change the libDecomp Additional Include Directories as follows:

      ..\..\..\..\..\Osi\src becomes ..\..\..\..\..\Osi\src\Osi

      ..\..\..\..\..\Osi\src\OsiCbc becomes ..\..\..\..\..\Cbc\src\OsiCbc

      ..\..\..\..\..\Osi\src\OsiClp becomes ..\..\..\..\..\Clp\src\OsiClp

      I also had to ensure all projects used the same runtime library. Use shift click to select Dippy and all the COIN libraries, then select Properties > Configuration Properties > C/C++ > Code Generation and set the runtime library to be Multi-threaded.

      I had to turn off common runtime support. Select Dippy and the COIN libraries again and select Properties > Configuration Properties > General and set Common Language Runtime support to be No Common Language Runtime support.

      I also had to make sure the preprocessor definitions were consistent across all my project configurations.

    4. Build the solution using the Release configuration with either the Win32 or x64 platform. The solution will create a Release directory (on my system this is C:\COIN\Dippy\MSVisualStudio\v10\Win32\Release or C:\COIN\Dippy\MSVisualStudio\v10\x64\Release) containing _dippy.pyd.

  6. Install Dippy

    1. Run make4windows32.bat or make4windows64.bat from the command line.

    2. Go to the Scripts directory created by setuptools, on my system this is C:\Python27\Scripts. Use easy_install to install Dippy

      easy_install -U C:\\COIN\\Dippy\\dist\\coinor.dippy-x.x.x-pyx.x.egg

      Note the x’s stand for version numbers of Dippy and Python in the previous command.

    3. Run Dippy from Python. By running python.exe (from C:\Python27) you can run Python scripts that use Dippy.

Setting up Dippy for Debugging

  1. First, follow the steps 1-5e for installing From Source (the HARD way).

  2. Download and set up Python 2.7 for debugging

    1. Go to the URL

      http://www.python.org/download/releases/2.7.2/

      I used the bzipped source tar ball:

      Python-2.7.2.tar.bz2

    2. Unzip and extract the tarball. I used 7-Zip and created the folder C:\Python-2.7.2.

    3. Open the PCBuild solution in Visual Studio, I used Microsoft Visual C++ 2008 with SP1 and opened C:\Python-2.7.2\PCBuild\pcbuild.sln. There was an error opning and I couldn’t see Solution Items, but this didn’t affect the rest of the process.

    4. Build the python project using the Debug configuration with either the Win32 or x64 platform

      The Debug configuration created python_d.exe, python27_d.dll and python27_d.lib in C:\Python-2.7.2\PCbuild if you used Win32 or C:\Python-2.7.2\PCbuildamd64 if you used x64.

  3. Build Dippy for debugging

    1. Go to Linker > General and make sure the Additional Library Directories points to the right place for Python. On my system this path is

      C:\Python-2.7.2\PCbuild;$(OutDir);%(AdditionalLibraryDirectories)

      for the Win32 platform or

      C:\Python-2.7.2\PCbuild\amd64;$(OutDir);%(AdditionalLibraryDirectories)

      for the x64 platform.

    2. Build the solution using the Debug configuration with either the Win32 or x64 platform. The solution will create a Debug directory (on my system this is C:\COIN\Dippy\MSVisualStudio\v10\Win32\Debug or C:\COIN\Dippy\MSVisualStudio\v10\x64\Debug) containing _dippy_d.pyd. It will also contain the debugging symbols in a file _dippy_d.pdb.

  4. Copy Dippy files to the script directory

    1. Place dippy.py, _dippy_d.pyd and _dippy_d.pdb in the directory of the model script file you want to debug
    2. Edit your model script file and replace

    import coinor.dippy as dippy

    with

    import dippy

    in the model script file. The model script file will now use the local copies in its directory, so they can be altered to aid in debugging without “breaking” the current Dippy installation.

  5. Add the Python debugging executable to the Dippy solution

    1. Open the Dippy solution in Visual Studio, I used Microsoft Visual C++ 2010 and opened C:\COIN\Dippy\MSVisualStudio\v10\Dippy.sln.
    2. Right click on the Dippy solution and select Add > Existing Project.... Navigate to python_d.exe (from C:\Python-2.7.2\PCbuild for Win32 or C:\Python-2.7.2\PCbuild\amd64 for x64) and add it to the solution.
    3. Right click on python_d.exe, select Properties and enter the name of the model script file (full path name) you want to debug.
    4. Right click on python_d.exe again and select Set as StartUp Project.
    5. Use Debug > Start Debugging to debug the Dippy source with your model script file.

Building Dippy in Linux, other platforms

Note These Linux installation instructions are out of date and may no longer work. If you would like to update them please email michael.osullivan@auckland.ac.nz.

Using easy_install and prebuilt eggs

If setuptools is installed in you system python

to install dippy (and pulp) into your system python you will need to enter the following

$ sudo easy_install  -U coinor.dippy

if you do not have root permissions to install dippy into your system python do the following to install dippy into a virtualenv environment located in the current directory (note virtualenv will have to be installed on the system python)

$ virtualenv .
$ bin/easy_install -U coinor.dippy

To use the python in this virtualenv do the following

$ bin/python
>>>

Build your own dippy

To build your own version of dippy download the source code from svn

$ svn co https://projects.coin-or.org/svn/CoinBazaar/projects/Dippy/trunk coin-dippy
$ cd coin-dippy
$ sudo make install

To install dippy in a virtual env development environment (useful if you wnat to change dippy code)

$ make develop

To run the tests (requires setuptools and virtual env)

$ make tests

To create your own egg

$ make bdist_egg

Building the Documentation

This documentation has been written using Sphinx. To build the documentation, execute make html in the docs/ subdirectory. Output in other formats can also be produced.

Troubleshooting

  • Make sure that PuLP is installed correctly and is on your PYTHONPATH.
  • PuLP is currently bundled with a bunch of COIN shared library binaries, but you’ll most likely be building your own when you compile DIP. Make sure that the DIP versions are the ones that are loaded.