>        T_GENERATING_BUS[k] = union(T_GENERATING_BUS[k],j)

On this line, you are trying to access the k-th element of T_GENERATING_BUS,
but you've declared it as a 0-element vector. You need to initialize it
first. Instead of:

> T_GENERATING_BUS = Set[]

try using:

> T_GENERATING_BUS = [Set() for i = 1:maximum(BUS)]

On Sat, Apr 25, 2015 at 2:41 PM <[email protected]> wrote:

> Hi, very newby in Julia/JuMP, my problem is
>
> i have a set of power gen and attached nodes in a grid in this format
>
> PowerGen_ID Node
> 1                   1
> 2                   2
> 3                   1
> 4                   2
>
> i would like to construct a set "T_GENERATING_BUS" for each node that
> contains the Power Gen attached to it
> i.e.
> T_GENERATING_BUS[1]={1,3};
> T_GENERATING_BUS[2]={2,4};
>
> i tried something  like:
>
> T_GENERATING_BUS = Set[]
>
> for k in BUS
>     for j=1:gmax
>         if BUS_T[j] == k
>         T_GENERATING_BUS[k] = union(T_GENERATING_BUS[k],j)
>         end
>     end
> end
>
> but got an error bound
> ERROR: BoundsError()
>  in getindex at array.jl:246 (repeats 2 times)
> while loading E:\CodiciSorgente\ProgrammiJulia\UCOTS.jl, in expression
> starting on line 101
>
> the problem is that i don't know how to increase the dim of
> T_GENERATING_BUS
>
> Any hints?
>
> Thanks
>
> Fabrizio
>
>

Reply via email to