Is it possible to ask JuMp to just show some particular indicies of varaiables? For instance let’s say we have a binary variable @variable(model, x[i = 2:3, j = 1:2:30, ["A", "B",..."Z"]] >= 0, Bin) and after solving models we are interested to first knowing if x[i,j,"C"] takes value and if so for which combination of i,j?

One question: How to fix the ERROR: Invalid number of column names provided: Got 4, expected 2. when calling import DataFrames df = DataFrames.DataFrame(Containers.rowtable(x; header=[:i, :j, :k, :value])) df[df[!, :value] .> 0.5, :]

I’ve tried DataFrames.DataFrame(Containers.rowtable(x; header=[:i, :j, :k])) but now says ERROR: Invalid number of column names provided: Got 3, expected 2.

Even the first one returns a key error. I want to print the value of i,j. For instance:

for i in 2:3, j in 1:2:30
if value(x[i, j, "C"]) > 0.5
print((i,j)
end
end

This returns returns a key error. So, for example something similar to this KeyError: key (2, 10, "C") not found in the above.

Yes. The code you write to index a variable needs to match how you defined it. Your first example needs x[1, 2, "C"] and your second example needs x[(1, 2, "C")]. The first has three dimensions, and the second has one.

I think you need something like:

indices = [(i, j) for (i, j, k) in idx if k == "C" && value(x[(i, k, k)]) > 0.5]

The rowtable example is Containers.rowtable(x; header=[:idx, :value]).