Seasonal storage balance constraint

@constraint(Test_Model, SSBalance[t in T, ss in SS], vSSTORAGE[1:3,“SS_A”] <= 100)

There are multiple things wrong with this constraint. Why is it indexed over T and SS, when neither of them appear in the constraint?

This probably needs to be @constraint(Test_Model, SSBalance, vSSTORAGE[1:3,"SS_A"] .<= 100). Note the .<= instead of <=.

Or, you might have meant:
@constraint(Test_Model, SSBalance[t in T, ss in SS], vSSTORAGE[t, ss] <= 100)

But even better, would be to use set_upper_bound.(vSSTORAGE[1:3, "SS_A"], 10)

Edit: I just saw your table at the bottom. Do something like this:

upper_bound = Dict()
for t in 1:3
    upper_bound[(t, "SS_A")] = 100
    upper_bound[(t, "SS_B")] = 150
end
for t in 4:6
    upper_bound[(t, "SS_A")] = 160
    upper_bound[(t, "SS_B")] = 200
end
@variable(Test_Model, 0 <= vSSTORAGE[t in T, ss in SS] <= upper_bound[(t, ss)])
1 Like