Reading lots of variables and passing them to JuMP model's variables and constraints automatically




Let’s say that I have a dataframe (created from CSV) that looks like this but has a hundreds of variables:

And I want to create a set of variables and equations for JuMP in a way that model that look like that (assuming that upperbound for y1=5 and for y2=2):


Is there a good way to do this? I’ve been reading about converting string to variable name/metaprogramming etc. but that doesn’t seem to be correct answer for this.

Thank you,


I don’t know of anything ready for this, seems too specific; You’d have to write Your own solution, creating jump expression from e.g. an Array obtained by readdlm
see how to do it;

One thing to watch is that constraints are only (linearly) simplified when model is build, so You may or may not have to do that manually if memory is important (it shouldn’t happen with hundreds of variables though)