CONOPT
Loading...
Searching...
No Matches
Python examples using automatic differentiation

Topics

 tutorial.py
 the tutorial example using the automatic differentiation library ADOL-C.
 
 tutorial2.py
 this extends the tutorial by including the computation of the Lagrangian of the Hessian.
 
 tutorial2str.py
 this extends the tutorial by including the computation of the structure of the Hessian and the value of the Lagrangian of the Hessian.
 

Detailed Description

Examples written in Python using the ADOL-C package for automatic differentiation.

Before running the Python examples, it is necessary to build and install ADOL-C and the SWIG-generated Python interface. The instructions on how to achieve this are given here.

In the following, it is assumed that the ADOL-C libraries for the Python interface are located in my/adol-c/python/lib. Also, the CONOPT Python interface libraries are assumed to be located in lib/.

  1. Change to the directory examples/AD/Python_1thread/.
  2. An example can be executed by calling:
    PYTHONPATH=my/adol-c/python/lib/:lib/:../../common/ python3 <example>.py
    • Note that on Windows, instead of python3, the correct command is python.