After the ASL routines read the .nl file, they set up a data structure containing representations of the nonlinear expressions in the objective and constraints. At that point you can write your own code to scan the data structure and extract whatever information you need about the mathematical form and the specific coefficients. Unfortunately there is no guide to writing such code. A number of people have figured it out and have written quite complex structure processors -- for example, to check for convexity, to categorize the problem type, and to find structures equivalent to conic quadratic problems; but as far as I know, their code is not readily available or well documented.
The attached zipfile shows a small example that I did to walk through all the expression graphs and process different arithmetic and logical operators for use by ILOG CP. Others have used this as a start. In it you can see how to write an expression for the pointer to the root of a nonlinear expression tree, and how to use fields of the various data structures that appear in nodes of the tree. This code is designed for the original ASL at
https://ampl.com/netlib/ampl/solvers/ rather than the new one in
https://ampl.com/netlib/ampl/solvers2.tgz.
--
Robert Fourer
am...@googlegroups.com