Dear Johannes,

I am only just seeing this. Thanks for the message. I actually tried an alternative route which I think is ok but not entirely sure…

I have a binary variable X(l,m) for the existence of a link, l, in the Network (which, again is a 1 in the table defined).

Set

n /n1*n5/

*List of Nodes in Network

alias (n,e);

Set m /1,2/;

*Modules to which the Links (and Nodes) can be assigned.

table CM (n,n)

n1 n2 n3 n4 n5

n1 1 1

n2 1 1

n3 1

n4 1

n5 1 1

Binary Variables

X1(m), X2(m), X3(m), X4(m),X5(m), X6(m), X7(m), X8(m)

To reference the table within the constraints, I have used for example CM(‘n1’,‘n2’)*X1(m) to represent the first one in the table, where X1(m) refers to Link 1 being assigned to module ‘m’.

I was thinking there however may be a way in which I can instead say, in a loop of some sort, that for all CM(n,n)=1 (Since the matrix is sparse anyway), that the subsequent constraints would apply…

CM(‘n1’,‘n2’)*X1(m) =l=Y(n,m).

Y(n,m) is another binary variable for the assignment of nodes in the network,n, to modules, m.

In that way, I may not have to reference each link Individually from the table by stating explicitly what its location is in CM(‘n1’, ‘n2’). Further, I may not have to define a variable for each link (8 in this case) and can simply use X(l,m).

But I am not sure how to do this.

If you have an idea of what I am trying to do, your assistance will be greatly appreciated once again

Thank you.

Regards,

Monigram

On Tuesday, July 24, 2012 10:33:05 AM UTC+1, Johannes Hedtrich wrote:

Hello,

i’m not sure i understand your problem completely, but here is my guess:

set n /n1*n5/;*

alias(n, n1)

set m /m1m5/;

set modules(m,n) /

m1 . n2

m1 . n5

m2 . n3

m2 . n4/;

parameter network(n, n1);

network(n,n1) = uniformint(0,1);

parameter module_links(m);

module_links(m) = sum(n$modules(m,n),sum(n1$modules(m,n1),network(n,n1)));

display network, module_links;

this hopefully goes into the direction what you’re looking for and gives you a starting point from which to start

kind regards,

johannes

Am Samstag, 21. Juli 2012 14:41:24 UTC+2 schrieb MoniGram:

Good day,

I am fairly new to GAMs. I wanted to represent a network with the connection or links between its nodes, n, represented as 1’s. Essentially, I would like the nodes to be grouped into modules (called ‘m’) as well as have the links between nodes should be grouped to modules also.

However, in my code, I would like to sum over these links that I call ‘l’ from the table CM representing the network, and there by determine the number of links (or 1’s) assigned to a module. I am not sure how to do this. Here is the table of nodes and binary variables to assign the link ‘l’ to a module.

Can anyone suggest a way to link it together?

Table CM(n,n) “Connectivity Matrix for Links between nodes n and e”

n1 n2 n3 n4 n5

n1 1 1

n2 1 1

n3 1

n4 1

n5 1 1 ;

Binary Variables

Xlm(l,m)

cons6(m)…Lm(m)=e=sum(l,Xlm(l,m));

(Lm is the total number of links assigned to a module, m).

So the problem is, I am not sure where I should reference the table name CM since ‘l’ is a set and I have been getting no value by saying

Set

l /CM/

Thanks!

–

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/9lp1scwxqQcJ.

To post to this group, send email to gamsworld@googlegroups.com.

To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.