This document outlines how to build and/or install Dippy.
Download and install Python 2.7
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.
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
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
Test your Dippy installation by running
python testExs.py
in the Dippy examples directory. This should run the main Dippy examples successfully. Note that there are multiple solutions for most of the examples, so make sure you are not getting a “false” fail because of an alternate, equivalent solution (this will be fixed in future releases).
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.
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
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
Download DIP
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.
Build Dippy
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.
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)
Patch the DIP files. There are patches for various subfolders in the DIP folder, e.g., alpsMSVisualStudio.patch for the Alps folder.
NOTE: One of the important changes sets Configuration Properties > General > Platform Toolset to v90 instead of v100 for all projects. This is because the Python releases are currently built using Visual Studio 2008, hence v90 not v100 (the default for Visual Studio 2010. If you want to use your compiled code with a Python release, i.e., installed with the MSI Installer, you need to use the v90 toolset. (5/3/2012)
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.
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.
Install Dippy
Run make4windows32.bat or make4windows64.bat from the command line.
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.
Run Dippy from Python. By running python.exe (from C:\Python27) you can run Python scripts that use Dippy.
First, follow the steps 1-5e for installing From Source (the HARD way).
Download and set up Python 2.7 for debugging
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
Unzip and extract the tarball. I used 7-Zip and created the folder C:\Python-2.7.2.
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.
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.
Build Dippy for debugging
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.
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.
Copy Dippy files to the script directory
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.
Add the Python debugging executable to the Dippy solution
If setuptools is installed in you system python
to install Dippy (and pulp) into your system python you will need to enter the following
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
$ bin/python
>>>
To build your own version of dippy download the DIP source code (includes Dippy) from svn
$ svn co https://projects.coin-or.org/svn/Dip/trunk DIP
$ cd ./DIP/Dippy
$ python ./amalPatches.py ${PWD%/*}/
$ patch -p0 -i ./linuxpatch
$ cd ..
$ ./configure --disable-shared --with-pic
$ make
$ make install
$ cd ./Dippy
$ python setup.py build_ext -I ../include/coin -L ../lib -i bdist_egg
$ cd dist
$ sudo easy_install <egg file>
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.
Once Dippy is installed you can test the examples by going to the examples\ subdirectory and running
python testExs.py