How to create a huge set of variables (500k or more) in JUMP

jump

#1

Hello everybody, I’m completely new in Jump and I have a very large LP to solve. The number of variables depend of the input data. My variables are too nested, for example, for each given installation, there’s an associated technology( solar, wind), a region, and a period of time. I have already read about how to set variables, but I cannot really see how I can do it in my problem. If I use the sintaxe bellow, that’s not seems too readable… Anyone could give me a direction? Thanks in advance.
@variable
(m, x[1:M,1:N] >= 0 )


#2

I am not sure I understand you question, what do you want exactly?

You want to define variables with different names?

You can write LaTex between “$” signs. If its better to explain what you consider readable.


#3

Also, for JuMP questions it better to set the category to Domains > Oprimization (Mathematical)


#4

I’m not sure what you mean by this. I have to do problems like this all the time as well, and my primary method of declaring variables is with @variable just as you’ve shown.

I also frequently have to use sparse matrices as is probably common for people working on problems of this size. Fortunately, there is nothing stopping you from declaring scalar variables and populating sparse matrices with these in any way that you would populate sparse matrices with any other objects see here.


#5

For the record. I’ve create models with a million variables in JuMP, and it wasn’t a problem.

But, like @ExpandingMan said, maybe some of those variables don’t even need to be defined. My approach is to created dictionaries beforehand and use them when creating the variables.

For example

@variable(m, w[i in n.units, j in n.tasks[i], t in timeperiods], Bin)

as opposed to

@variable(m, w[i in n.units, j in n.tasks, t in timeperiods], Bin)

Here, I’m creating the w variable only for the tasks that are actually performed by unit i, and not by every element in the cross product units x tasks

cheers!