I got in my problem some binary variable, thats a decision to install or not an equipment in a house. Among a lot of other variables and constraints, my problem is something like this:
N = 5; # number of houses
@variable(m, a[i=1:N], Bin)
@objective(m, Min, sum(a[i] for i = 1:N))
But for a larger N (around 30+), the problem gets to big to be solved in an acceptable time (using a Branch-and-Bound solver).
So, to reduce the number of binary variables, i was thinking in just choose some a[i] to be binary. For example, binary for i = 2:3:
@variable(m, a[i=2:3], Bin)
But i’m getting this error:
ERROR: LoadError: Failed attempt to index JuMPArray along dimension 1: 1 ∉ 2:3
Does anyone knows any trick in how work around this?
1 ∉ 2:3 says there was no index 1 in 2:3(i think…), it might’ve come from @objective if it wasn’t updated to 2:3 as well.
Otherwise it could just need to start from 1
…unless it really means dimensions when it says #1 is missing, but it doesn’t seem too likely
btw There seems to be something wrong with the JuMP documentation page, i had to Ctrl-F5 and then Esc to catch the page text before it disappeared
/Firefox 60.0.1 on windows 7