julia> p
1-dimensional DenseAxisArray{VariableRef,1,...} with index sets:
Dimension 1, [1, 3]
And data, a 2-element Array{VariableRef,1}:
p[1]
p[3]
julia> Pd
3-element Array{Int64,1}:
0
-4
0
julia> pij
2-dimensional DenseAxisArray{VariableRef,2,...} with index sets:
Dimension 1, [1, 2, 3]
Dimension 2, [1, 2, 3]
And data, a 3×3 Array{VariableRef,2}:
pij[1,1] pij[1,2] pij[1,3]
pij[2,1] pij[2,2] pij[2,3]
pij[3,1] pij[3,2] pij[3,3]

Note that p doesn’t have index “2” because it is defined with Gen_set. When you use i to index it (along with pij and Pd) it fails when the index is 2.