I use JuMP and Gurobi to set up and solve optimization problems. I have from time to time the problem that the built optimization problems are badly scaled. To take a first step in improved matrix ranges I have introduced general scaling factors for different groups of variables. However, this helps me only up to a certain extent.

My thought was to include dynamic variable and contraint scaling. According to my research JuMP has the goal to pass only the constraints without reformulations to the solver. Therefore I am thinking about writing a macro extension that can automatically apply different scaling approaches (e.g. geometric mean scaling or arithmetic mean scaling). However, at the moment I am still a bit lacking the approach to do this.

Therefore I wanted to ask if someone has ever coded something in this direction?

One way forward would be to create a Meta-Solver, which is a layer that will lie in between JuMP and the actual solver (eg. Gurobi) and will perform modifications in the data.

There are some packages that work similarly, getting JuMP data via MathOptInterface, performing modifications and forwarding the new MOI-based data to the solver:

Thanks for the reply. This sounds a lot more reasonable than my approach. I will try building a Meta-Solver.

I saw that you have a lot of contributions to these packages (respectively the one package is your own). If I get stuck I might get back to you with a specific question.