Dear Open-Minded-Modellers ...
Introducing MOSOX - A simple route from model to solution
Energy models are often built with tools such as Linopy, Pyomo and JuMP. These are flexible, but they add code, packages and data structures between the equations and the solver.
MOSOX takes a narrower route. It compiles readable close to Maths models (AMPL/GNUMathProg) directly into standard matrices and can solve them with HiGHS, and other solvers. In OSeMOSYS tests, it compiled models up to
6.5 times faster than GLPK’s glpsol and used less peak memory on the largest case.
Linopy’s benchmarks show that it is faster and more memory-efficient than Pyomo, and broadly
comparable with JuMP. MOSOX asks a simpler question: when an LP or MIP can be written directly, is a full programming framework needed?
Faster model generation at similar memory use means less computing time and, in general, lower energy use and environmental impact.
A small algebraic language is also easier to learn. The equations remain visible, so students, engineers, economists and domain experts can inspect the model without learning a large software framework. The same property supports
AI-assisted modelling: an AI can draft the model while a human reviews every variable, constraint and assumption.
MOSOX is one tile in the emerging MOSAIC-modelling.ai ecosystem. It is free to use and designed to work with open standards and existing tools, not to lock users into a particular model, workflow or software stack.
Keep the model close to the mathematics. Keep the path to the solver short.
Sample LP maths:
/* Basketball Lineup Model */
set PLAYERS := 1..7;
/* Abilities: Assisting, Throwing, Rebounding, Defense */
param A{PLAYERS}; param T{PLAYERS}; param R{PLAYERS}; param D{PLAYERS};
/* Decision variable: 1 if player plays, 0 otherwise */
var y{i in PLAYERS} binary;
/* Objective: Maximize total defensive ability */
maximize total_defense: sum{i in PLAYERS} D[i] * y[i];
/* Constraints */
s.t. five_players: sum{i in PLAYERS} y[i] = 5;
/* Position constraints based on player capabilities */
s.t. backfield: y[1] + y[3] + y[5] + y[7] >= 3;
s.t. frontfield: y[4] + y[5] + y[6] + y[7] >= 2;
s.t. midfield: y[2] + y[3] + y[4] + y[6] >= 1;
/* Average ability constraints (Avg >= 2 across 5 players) */
s.t. avg_assist: sum{i in PLAYERS} A[i] * y[i] >= 10;
s.t. avg_throw: sum{i in PLAYERS} T[i] * y[i] >= 10;
s.t. avg_rebound: sum{i in PLAYERS} R[i] * y[i] >= 10;
/* Logical constraints */
s.t. exclusivity: y[3] + y[6] <= 1; /* If 3 plays, 6 cannot */
s.t. requirement_4: y[1] <= y[4]; /* If 1 plays, 4 must play */
s.t. requirement_5: y[1] <= y[5]; /* If 1 plays, 5 must play */
s.t. mandatory_choice: y[2] + y[3] >= 1; /* Either 2 or 3 must play */
data;
param A := 1 3 2 2 3 2 1 1 3 2 3 6 3 7 3;
param T := 1 3 2 1 3 3 4 3 5 3 6 1 7 2;
param R := 1 1 2 3 3 2 4 3 5 1 6 2 7 2;
param D := 1 3 2 2 3 2 4 1 5 2 6 3 7 1;
end;
Enjoy [!]
Best, Mark - and the MOSOX team [!]