I am quite new at Julia and coding entirely, so I’d appreciate some help to the probably dumb question below.
I am trying to solve an optimisation problem for a nodal system of 24 points. At the moment I am trying to sum all demands that I have in each node, and create a vector with 24 elements (wherever I have no demands to get 0). But I am messing up somewhere and getting only 0 in all 24 nodes.
So the code so far looks like that:
Demand = collect(1:17) #Energy Demand Points
Nodes = collect(1:24) #Nodal points
Consumption = [84,75,139,58,55,106,97,132,135,150,205,150,245,77,258,141,100]
Demand_Node = [1,2,3,4,2,6,3,8,9,10,20,14,17,16,18,19,20]
for n in length(Nodes)
if n == (Demand_Node[d] for d in Demand)
sum(Consumption[d] for d in Demand)
I’ve even tried with this one below, but still nothing.
if Nodes[n] == (Demand_Node[d] for d in Demand)
Could anyone help me with this easy issue?
Thank you in advance.