Skip to content

Commit

Permalink
Adding solver documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwl committed Jul 21, 2011
1 parent 16342c1 commit 8c419b4
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PYPOWER documentation
copyright
install
usage
solvers
support

.. only:: html
Expand Down
4 changes: 4 additions & 0 deletions doc/link_names.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@
.. _GitHub: http://github.com/rwl/PYPOWER
.. _`GNU General Public License`: http://www.gnu.org/licenses/
.. _`API documentation`: http://www.pypower.org/api
.. _PyIPOPT: http://code.google.com/p/pyipopt/
.. _IPOPT: https://projects.coin-or.org/Ipopt
.. _MUMPS: http://graal.ens-lyon.fr/MUMPS/
.. _lp_solve: http://sourceforge.net/projects/lpsolve/
105 changes: 105 additions & 0 deletions doc/solvers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
Third Party Solvers
-------------------

PYPOWER includes interfaces to several third party solvers. This section
provides some notes on how to install the solvers.

IPOPT
+++++

AC optimal power flow (OPF) problems and DC OPF problems with quadratic cost
functions can be solved using IPOPT_. To install the Python interface to
IPOPT, PyIPOPT_, on Debian first obtain the latest stable release of IPOPT.
It must be newer than version 3.9.1::

$ wget http://www.coin-or.org/download/source/Ipopt/Ipopt-3.9.3.tgz
$ tar xvf Ipopt-3.9.3.tgz
$ cd Ipopt-3.9.3/

IPOPT requires a third party linear solver. MUMPS_ is the only compatible
solver available under a free software license. IPOPT provides a convenient
script for downloading and patching MUMPS::

$ cd ThirdParty/Mumps
$ ./get.Mumps
$ cd ../..

IPOPT will compile MUMPS automatically when it is compiled. By default the
IPOPT libraries will be installed into ``./lib/`` and the headers into
``./include/coin``. This can be changed by specifying the ``prefix`` flag::

$ ./configure --prefix=/usr/local
$ make
$ sudo make install

To let the linker know where the new libraries are create a file::

$ sudo nano -w /etc/ld.so.conf.d/ipopt.conf

containing the paths to IPOPT and MUMPS::

/usr/local/lib/coin
/usr/local/lib/coin/ThirdParty

Next, obtain the latest PyIPOPT source code::

$ cd ..
$ svn checkout https://pyipopt.googlecode.com/svn/trunk/ pyipopt
$ cd pyipopt/

Modify the makefile paths to match your environment::

CC = gcc
CFLAGS = -O3 -fpic -shared #-g
DFLAGS = -fpic -shared
LDFLAGS = -lipopt -lm -llapack -lblas -lcoinmumps

PY_DIR = /usr/local/lib/python2.6/dist-packages
IPOPT_INCLUDE = /usr/local/include/coin

IPOPT_LIB = /usr/local/lib/coin

MUMPS_INCLUDE=/usr/local/include/coin/ThirdParty
MUMPS_LIB = /usr/local/lib/coin/ThirdParty

PYTHON_INCLUDE = /usr/include/python2.6

NUMPY_INCLUDE = /usr/include/numpy

pyipopt: src/callback.c src/pyipopt.c
$(CC) -o pyipopt.so -L$(IPOPT_LIB) -I$(IPOPT_INCLUDE) -L$(MUMPS_LIB) -I$(MUMPS_INCLUDE) -I$(PYTHON_INCLUDE) -I$(NUMPY_INCLUDE) $(CFLAGS) $(LDFLAGS) src/pyipopt.c src/callback.c

install: pyipopt
cp ./pyipopt.so $(PY_DIR)
clean:
rm pyipopt.so

Compile and install to ``PY_DIR``::

$ make
$ make install


LP Solve
++++++++

DC OPF problems with piecewise linear can be solved using a Python interface to
lp_solve_. Download and unpack the latest source archive
(lp_solve_5.5.2.0_source.tar.gz) build::

$ cd lp_solve_5.5/lpsolve55
$ sh ./ccc

Copy the ``liblpsolve55`` files to the library path::

$ cp bin/ux32/* /usr/loca/lib/

Download and unpack the Python source code
(lp_solve_5.5.2.0_Python_source.tar.gz) into the same directory as the lp_solve
source. Compile the Python extension::

$ cd ../extra/Python/
$ sudo python setup.py install


.. include:: ./link_names.txt

0 comments on commit 8c419b4

Please sign in to comment.