Thanks Iain,

this seems to work, at least in the costruction, but i have to deepen the 
various commands. However...since i have to use this "object" in a cns like 
that, you can - certainly -  give me an hint since i get an error 
ERROR: key not found: 3

sorry I am an old C++ guy

for h=1:hmax
    for k in BUS
        @addConstraint(mod, sum{pt[j,h], j in T_GENERATING_BUS[k]} 
-node_load[k,h] == sum{p_flow[(n,b_from,b_to),h],(n,b_from,b_to) in 
BRANCH}-sum{p_flow[(n,b_to,b_from),h],(n,b_to,b_from) in BRANCH})
    end
end


On Saturday, April 25, 2015 at 8:41:56 PM UTC+2, Fabrizio 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