-
Notifications
You must be signed in to change notification settings - Fork 0
/
reference.py
42 lines (35 loc) · 1.95 KB
/
reference.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from TUNM import *
import math
model = TypicalUnifiedNetworkModel(
node_fitness=lambda chromosome, node, t: 1 if t > chromosome[node.t0] else
math.exp(chromosome[node.A] * (chromosome[node.t0] - t)),
edge_fitness=lambda chromosome, edge, t: 1
)
model.add_node(node_type="Router")
model.add_node(node_type="Router", connect_to='0')
model.add_node(node_type="Router", connect_to='0', openness=True)
model.add_node(node_type="Switch", connect_to='1')
model.add_node(node_type="Switch", connect_to='1')
model.add_node(node_type="Switch", connect_to='2')
model.add_node(node_type="Switch", connect_to='2')
model.add_node(node_type="Switch", connect_to='0')
model.add_node(node_type="End", connect_to='3', vlan_number='1')
model.add_node(node_type="End", connect_to='3', vlan_number='2')
model.add_node(node_type="End", connect_to='3', vlan_number='3')
model.add_node(node_type="End", connect_to='3', vlan_number='4')
model.add_node(node_type="End", connect_to='4', vlan_number='1')
model.add_node(node_type="End", connect_to='4', vlan_number='2')
model.add_node(node_type="End", connect_to='4', vlan_number='3')
model.add_node(node_type="End", connect_to='4', vlan_number='4')
model.add_node(node_type="End", connect_to='5', vlan_number='1')
model.add_node(node_type="End", connect_to='5', vlan_number='2')
model.add_node(node_type="End", connect_to='5', vlan_number='3')
model.add_node(node_type="End", connect_to='5', vlan_number='4')
model.add_node(node_type="End", connect_to='6', vlan_number='1')
model.add_node(node_type="End", connect_to='6', vlan_number='2')
model.add_node(node_type="End", connect_to='6', vlan_number='3')
model.add_node(node_type="End", connect_to='6', vlan_number='4')
model.add_node(node_type="End", connect_to='7', vlan_number='1', is_a_server=True)
model.add_node(node_type="End", connect_to='7', vlan_number='2', is_a_server=True)
model.add_node(node_type="End", connect_to='7', vlan_number='3', is_a_server=True)
model.write_graphml("reference.graphml")