Running the code of the first post with the constraint I suggested in my last reply gives me:
ERROR: LoadError: BoundsError: attempt to access 8-element Array{Int64,1} at index [9, 1]
That comes from the fact that Q
is a 1D array of 8 elements, and therefore sum(Q[a,w]*x[a,t] for a in A)
will not work, Q
needs to be a 2D array (a matrix) of 79x?
where ?
is at least 1
(but essentially goes up to any value w
can assume). The same problem exists with WH
that is also a 1D array of 8 elements but is indexed like WH[w,t] for a in A
(remembering that t
is 18). Replacing both Q
and WH
by Q = ones(79, 1); WH = ones(1, 18)
makes the code execute with no error (but, obviously, probably with the wrong result).
The error message you are giving me say that you tried to index some array with a floating point. I cannot reproduce it with the code you posted here.