[Coin-standards] SNOML ampl driver and some answers
Leonardo B. Lopes
leo at iems.nwu.edu
Sat Feb 23 01:11:04 EST 2002
Dear Colleagues,
I wrote a quick-and-dirty (but functional) ampl driver that
generates valid SNOML files for linear programs. It doesn't handle very
much right now (not even IP), but helps answer some questions and gives
some of you a flavor of working with xml.
Some Notes:
0) The important file is basicsnoml.c. You'll notice it has the same
structure as lin2.c from the AMPL ASL distribution. The DOMSerializer is
code I changed slightly from something changed slightly by someone else
(Evert Haasdijk, unrelated to this project) from an example that came with
xerces (an xml library by IBM/apache). Building the code is not trivial
because a bunch of libraries have to be in the right place. If someone
actually wants to build it let me know and I'll help.
1) Notice that at no point are we dealing with any of the file
parsing/writing details. For all we care, the XML file is a tree in
memory, and we access it by adding children, searching through the tree,
etc... In the future, it will be even easier, because...
2) ...in this code, there are many operations being done "by hand". In the
future we will have a library to access the file (a DOM in XML parlance),
which would make this code much cleaner and easier. Instead of appending
nodes to a <sparsevector>, we will simply write (or read) a sparsevector
with one call.
2) The DTD that is on the web has been changed. There is a copy in this
file if you would like to see it. Fundamental differences are: multiple
objectives (requested by lloyd), more general bounds on constraints, and a
different concept for the matrices for SP programs.
3) Some people were concerned about whether in order to be able to use the
file you would have to understand all of MathML. The anser to that is NO.
Even in the nonlinear case, you would interact with a SNOML parser in a
similar way to how you interact to AMPL ASL: You would request function
and derivative evaluations and the parser would supply them.
The difference is that instead of having function evaluation capability,
the parser would ask some application that understands mathml to evaluate
the expressions. If you WANTED to do something special with the function,
like for example run it through some Maple routine you wrote to detect
some structure, you would be able to do that by accessing the MathML
object and passing it to Maple.
4) The SNOML generated from .nl files doesn't take advantage of some
pretty neat features in SNOML for structure representation. As a result,
the file may look unnecessarily convoluted at first examination. If that
is your impresson, please *complain loudly*, so that we can figure out
which of those features are worth having and which are not.
Since I worked quite a bit on SNOML this week, I think I'll contiue with
that theme and go skiing tomorrow :). Hope everyone has a great weekend!
Cheers,
Leo.
========================================================================
Leonardo B. Lopes leo at iems.nwu.edu
Ph.D. Student (847)491-8470
IEMS - Northwestern University http://www.iems.nwu.edu/~leo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ampldriver0.1.zip
Type: application/zip
Size: 11708 bytes
Desc:
Url : http://list.coin-or.org/pipermail/coin-standards/attachments/20020223/ba3be8e3/ampldriver0.1.zip
More information about the Coin-standards
mailing list