A little help
Posted: Thu Sep 20, 2018 6:54 pm
Dear all, I need your help with a modelling issue, I think this will be way easy to most of you, I was up until 3 am and couldn't figure this out.
I have been working on a network model lately and though I got it working, thanks to some index programming, I cannot help but notice certain patterns in the constraints where I have used such indexed programming, this makes me thinks there must be a way to write the code so that the model itself finds the connections between the nodes I am using for my network.
The situation is the following, say I have a set of nodes w(i) /v1*v12/ and every node has more than one edge connecting to the next nodes, so for instance I can have the following edges from " v1" to a "vn":
v1.v2
v1.v3
v1.v5
So as you can see there are several edges coming out of "v1" but in the end only one edge must connect to the next element in the set v, so that if there are some edges arriving to node v2 for example v1.v2 and v3.v2, I want my model to select the best option.
Later on I want to perform some calculation with the nodes.
I have included a simplified version of the data and the code I have typed so far and I would like you to please give me a hand with constraints R2 to R7. I think there is a way to write all of those constraints into one or maybe fewer constrains without the need of using indexed programming.
I thought that the following would make the trick but no luck:
*R11(w).. SUM[m$arcos(w,m),x(w,m)] =G= 1; With this I'm trying to say there are some edges coming out of splitter w to splitters m
*R12(m).. SUM[w$arcos(w,m),x(w,m)] =E= 1; With this I'm trying to say there is only one edge coming in splitter m from splitters w
Thanks a lot for reading this and most of all thanks a lot for your valuable help, you guys rock.
I have been working on a network model lately and though I got it working, thanks to some index programming, I cannot help but notice certain patterns in the constraints where I have used such indexed programming, this makes me thinks there must be a way to write the code so that the model itself finds the connections between the nodes I am using for my network.
The situation is the following, say I have a set of nodes w(i) /v1*v12/ and every node has more than one edge connecting to the next nodes, so for instance I can have the following edges from " v1" to a "vn":
v1.v2
v1.v3
v1.v5
So as you can see there are several edges coming out of "v1" but in the end only one edge must connect to the next element in the set v, so that if there are some edges arriving to node v2 for example v1.v2 and v3.v2, I want my model to select the best option.
Later on I want to perform some calculation with the nodes.
I have included a simplified version of the data and the code I have typed so far and I would like you to please give me a hand with constraints R2 to R7. I think there is a way to write all of those constraints into one or maybe fewer constrains without the need of using indexed programming.
I thought that the following would make the trick but no luck:
*R11(w).. SUM[m$arcos(w,m),x(w,m)] =G= 1; With this I'm trying to say there are some edges coming out of splitter w to splitters m
*R12(m).. SUM[w$arcos(w,m),x(w,m)] =E= 1; With this I'm trying to say there is only one edge coming in splitter m from splitters w
Thanks a lot for reading this and most of all thanks a lot for your valuable help, you guys rock.