Name styles of variables, parameters, sets, etc...

When building a JuMP model, one thing I feel very important is to distinguish between variables and parameters in each equation. It’s important because, for example, the term “var. * par.” is linear but the term “var. * var.” is nonlinear, so linear solvers like CPLEX won’t return anything if you have a nonlinear equation like that.

So a good name style could not only give the model a good look but also helps to debug. I think it might be a good idea to have all the variables in lower cases and parameters in upper case, e.g., ’ @variable(m, x) ’ and X = 1 so you can tell immediately the different between @constraint(m, x * X <= 3) and @constraint(m, x * x <= 3)

How about the name of sets, models, equations?

The JuMP style guide has some things to say on this:

We would probably recommend something like

model = Model()
@variable(model, var_x)
par_x = 1
@constraint(model, con_1, par_x * var_x <= 3)