ALGENCAN 1.0 Python interface
Note that this interface corresponds to an old
version of ALGENCAN! Click here to
download the ALGENCAN latest version (including all the
interfaces).
-
algencanma.py
- This file contains an example of a "main program" that sets the
problem data and calls the optimization solver.
-
algencan.py
- This is the Python wrapper for the solver. It calls the optimization
solver (GENCAN for bound-constrainted problems and ALGENCAN for
general nonlinear programming problems).
-
toyprob.py
- This file contains the definition (objective function, constraints,
initial point, bounds on the variables, etc.) of a very easy problem.
This is the file that the user should modify to solve his/her own
problem.
-
pywrapper.c
- This is the file responsible for the interface between Python and
C/C++.
-
pywrapper.h
- pywrapper header file.
-
cfortran.h
- This is the file responsible for the interface between C/C++
and Fortran.
- Makefile
- This (optionaly) file can be used to easily compile the codes
using the make command.
Quick start
| 1) | Copy the 7 files above.
| | 2) | Compile typing
make or, manually, typing
g77 -O4 -c -fPIC -xf77-cpp-input algencan.f
gcc -O4 -c -fPIC -Df2cFortran -I$PYTHONDIR -I$PYTHONLIB/site-packages/numpy/core/include pywrapper.c
g77 -O4 -shared pywrapper.o algencan.o -o pywrapper.so
|
| 3) | Run typing python algencanma.py. |
| 4) | If everything was ok, the output in the
screen should be very similar to the content of the file algencan.out
that comes with ALGENCAN. |
| 5) |
Modify the toyprob.py file to solve your own problem. |
| Obs1: |
To use this interface you need to have downloaded
ALGENCAN 1.0. |
| Obs2: |
It is assumed that (i) packages python, python-dev, python-numpy and
python-numpy-dev are installed; that (ii) the environment
variable PYTHONDIR points to the directory
containing the include files needed for developing Python extensions
and embedding the interpreter (for example, /usr/include/python2.5);
and that (iii) the environment variable
PYTHONLIB points to the directory
containing the standard Python modules (for example,
/usr/lib/python2.5).
|
Additional information
1) Would you like to use this ALGENCAN interface in a Windows environment? Click here for details.
2) Although this ALGENCAN interface was written to work as a standalone Python application, it can also be connected to scikits.openopt, a recently developed optimization framework released under the BSD license. To do so, please refer to the OpenOpt Project website.
|