Abstract
Linear and mixed-integer optimisation models are widely used across economics and engineering to study resource allocation, infrastructure planning, and energy-system transitions. Algebraic modelling languages such as GNU MathProg (GMPL), AMPL, and GAMS let researchers write these models close to their mathematical form, keeping them transparent and reviewable even without extensive coding experience. However, as models grow in scale, translating algebraic formulations into solver-ready sparse matrices becomes a major computational bottleneck. This paper introduces MOSOX, a Rust-based command-line tool and library that compiles a targeted subset of GMPL model and data files into sparse matrices, covering the constructs required by the OSeMOSYS energy-system model family. It expands sets, parameters, variables, objectives, and constraints into matrices, exports them in standard MPS format, and can solve models directly via the HiGHS solver. On OSeMOSYS benchmarks, MOSOX compiles matrices up to 6.5 times faster than GLPK's glpsol while also reducing peak memory use on the largest tested model. By combining fast, low-memory compilation with the readability of GMPL and solver-independent output, MOSOX - developed within the Climate Compatible Growth Program - supports reproducible, auditable, and automatable optimisation workflows for large-scale energy-system modelling.
Supplementary weblinks
Title
MOSOX GitHub Repository
Description
Source code, issue tracker, and benchmark scripts for MOSOX, the Rust-based GMPL-to-matrix compiler described in this paper.
Actions
View Title
MOSOX documentation
Description
Official documentation for MOSOX, covering installation, supported GMPL constructs, CLI commands, and usage examples.
Actions
View Title
Climate Compatible Growth: Data and Tools
Description
Overview of the open-source modelling tools and datasets developed within the Climate Compatible Growth programme
Actions
View Title
OSeMOSYS Community
Description
Homepage of the Open Source Energy Modelling System (OSeMOSYS), the primary model family used to validate MOSOX.
Actions
View 


![Author ORCID: We display the ORCID iD icon alongside authors names on our website to acknowledge that the ORCiD has been authenticated when entered by the user. To view the users ORCiD record click the icon. [opens in a new tab]](https://www.cambridge.org/engage/assets/public/coe/logo/orcid.png)