next up previous contents
Next: Using MATLAB Up: OSModelInterfaces Previous: Converting MPS Files   Contents


Converting AMPL nl Files

AMPL is a popular modeling language that saves model instances in the AMPL nl format. The OSModelInterfaces library provides a class, OSnl2osil for reading in an nl file and creating a corresponding in-memory osinstance object. It is used as follows.

OSnl2osil *nl2osil = NULL;
DefaultSolver *solver  = NULL;
solver = new LindoSolver();
nl2osil = new OSnl2osil( nlFileName);
nl2osil->createOSInstance() ;
solver->osinstance = nl2osil->osinstance;	
solver->solve();

The OSnl2osil class works much like the OSmps2osil class. The OSnl2osil class constructor takes a string which should be the file name of the instance in nl format. The constructor then uses the AMPL ASL library routines to read and parse the nl file. The class method createOSInstance then builds an in-memory osintance object that can be used by a solver.

In Section 12.1 we describe the OSAmplClient executable that acts as a ``solver'' for AMPL. The OSAmplClient uses the OSnl2osil class to convert the instance in nl format to OSiL format before calling a solver either locally or remotely.



Kipp Martin 2008-01-16