We use Pyomo to exchange data with AMPL-compatable solvers by NL-file (as input) and SOL-file (as output). For some models Pyomo ConcreteModel.write(...) function generates rather big NL-files in text format (each more that 200 Mb) which cause problems with data transfer in our distributed computing infrastructure. I know that native AMPL translator can write NL-files in much more compact binary format. Is it possible to do the same in last Pyomo releases?
In 2016 year we asked almost the same question to Pyomo support and they told us that "have this issue in mind" but it was not implemented yet. Of course we can "handle" big text NL-files by ZIPing them before transfer to the solver and UnZipping before solving. But it looks rather ugly approach...
As of now (June 2025), Pyomo's NL writer only produces text-mode NL files. The current NL writer was re-designed a couple years ago in part so that it shouldn't be too hard to adapt it to generate a binary-mode NL file. Unfortunately, no one has had the time to actually implement (and more importantly test) it. If you have time / interest in taking this on, the Pyomo developers would be more than happy to work with you.
As an aside, the "new" NL writer also includes the beginnings of a basic presolve step (it will perform variable aggregation with no fill-in). This feature needs a newer solver interface to correctly communicate the values for the presolved variables back to the user. Currently there is a beta interface for ipopt available that has the presolve activated by default (the new interface in pyomo.contrib.solver.solvers.ipopt
) has a "legacy" wrapper to it available from the default SolverFactory
under the name ipopt_v2
). This will make for potentially smaller NL files (based on the structure of your model).