## How can I make this set?

User Posts: 15
Joined: 3 years ago

### How can I make this set?

Hi,
let s be a index of scenario and j index of Network Nodes.(s={1*200} , j={1*100})
d(s,j)= total impacts of contamination scenario s, if the contaminant is first detected by scenario at j.
W(s)=the subset of Network Nodes which d(s,j)<>0.
W'(s)= the subset of W(s) such that d(s,j)<>d(s,j') , for all j,j' belong to W'(s).

How can I make the subset W'(s)?
I attached data related to parameter d(s,j) too.

Attachments
data.xlsx

bussieck
Moderator Posts: 645
Joined: 5 years ago

### Re: How can I make this set?

Here is the code:

Code: Select all

``````set s /1*200/, j /1*100/;
parameter d(s,j);
d(s,j)\$(uniform(0,1)<0.05) = uniformInt(1,10);
*W(s)=the subset of Network Nodes which d(s,j)<>0.
*W'(s)= the subset of W(s) such that d(s,j)<>d(s,j') , for all j,j' belong to W'(s).
set W(s,j), Wuniq(s,j);

W(s,j) = d(s,j);
Wuniq(s,j) = W(s,j);
* Knock out the duplicate ones
alias (j,jj);
loop((s,j,jj)\$(W(s,j) and W(s,jj) and ord(jj)>ord(j) and d(s,j)=d(s,jj)), Wuniq(s,jj) = no);``````
-Michael 