AMPL Model Reader Object
Systems and Computer Engineering
Carleton
University
Ottawa,
Canada
AMPL is a popular language for
describing mathematical programs – see www.ampl.com
for further information. The AMPL developers
provide a set of C language routines for hooking a solver or modeling system to
AMPL (known as the AMPLsolver library), however, it still requires significant
programming effort and knowledge to make the interface work smoothly. We have simplified this task by creating an
object wrapper for some of the more commonly used interface routines. This allows programmers to simply reference
the associated AMPL Model Reader object in their code, thereby exposing the
properties of the model and providing a set of useful methods.
Exposed properties include the names
of variables, constraints and objectives, variable bounds, constraint types,
etc. Methods include the ability to
calculate the value of a constraint or objective at a given point, ability to
return gradients at a point, etc. The
properties and methods exposed by the object can be conveniently viewed via the
object browser in the programming development environment. The object also simplifies other programming
tasks. For example, an appropriate
dialog box is provided when the user wishes to locate an AMPL model.
Two items are provided here:
- The AMPL Model Reader object. Two versions are available: a COM
object, and a .NET object. The
appropriate version should be downloaded and installed on your system.
- The source code for a demonstration program that
shows how to use the object. Two
versions are available: VB6 and VB.NET.
Read the help file after download to see how to attach the AMPL
Model Reader object to the demonstration program so that it will run.
Version History
- COM
object version 1.0 released August 13, 2003.
- .NET
object version 1.0 release August 14, 2003.
Download and Installation
The full-featured software is available for free
download. Instructions:
- Permission
to use the object is not needed, but as a courtesy, please email the author to indicate
that you are will be using it, and to be notified when new releases are
available.
- If you
use the object as part of your own software project, please acknowledge
the source.
Notes
- AMPL
(“ampl.exe”) must be installed on your computer in order to use the model
reader. AMPL is used to create the
.nl file with which the AMPL Model Reader interacts.
COM Object
- The
installation files are WinZipped.
First unzip the files into an installation directory.
- Run
setup.exe. Choose a different
directory as the installation target.
- The
final result of running the installation is a DLL by the name of
amplModelReader.dll.
- Once installed
on your computer, you will need to make a reference to the object in your
development environment in order to use it. For example, in Visual Basic, you need to open the dialog
box under Project|References and then check the box next to “AMPLModelReader”
.NET Object
- Download
AMPL Model Reader .NET object
- The
installation files are WinZipped.
First unzip the files into and installation directory.
- Run
setup.exe. Choose a different
directory as the installation target.
- The
final result of running the installation is:
- A
.NET DLL by the name of AMPLReaderClassLib.DLL located in the
"drive:\windows directory\system32" directory
- A
directory entitled “AMPLReaderDemo” which contains the VB source code for
a demonstration program which illustrates how to use the AMPL Model
Reader object.
- To
run the demonstration program, open the project on your computer and then
add the reference to the AMPLReaderClassLib.DLL. In Visual Basic .NET this is done by opening the dialog box
under Project|References and following the instructions.
Authors
Last
update: January 22, 2004.