complete coding is done based on the paper [SEES](SEES.pdf)
## Major Project

```python
#we need to connect to a GUI event loop. This tells IPython where (and how) to display plots.
%matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
import math
```

### we need

N    - the total number of HN nodes

Fs   - scalability factor which define as the maximum number of nodes to be accommodated in a single zone

L    - length of area

B    - cardinality of local base station(LBS)

n    - number of heterogeneity level

If N is the total number of nodes and n is the number of heterogeneity levels, then the network has n categories (types) of nodes: cate-1, cate-2, cate-3, ..., cate-n nodes with their cardinalities: N1t , N2t , N3t , ..., Nnt and energy levels: E1t , E2t , E3t , ..., Ent respectively, where:

                            N1t > N2t > N3t > ⋯ > Nnt

                            E1t < E2t < E3t < ⋯ < Ent

The different levels of node energies are related according to the following formula, where the initial energy of cate-i
nodes is alpha times more than that of cate-(i − 1):

                            Eit = E1t × (1 + (i − 1) × aplha)

where alpha is constant. The number of cate-i nodes in the network is given by:

                            Nit = N × (beta − gamma1) × (beta − gamma2) × (beta − gamma3)×⋯× (beta − gammai)

                            N1t + N2t + N3t + ⋯ + Nnt  = N

alpha and betai are the primary and secondary parameters of heterogeneity in the Singh model respectively (Singh 2017), and
are related according to the following formula:

            (beta − gamma1) × (1 + (beta − gamma2) × (1 + (beta − gamma3)×⋯× (1 + (beta − gamman)))) = 1

and gammai is given by:

                            gammai = gammai−1 − 2 × theta

where Θ(theta) is constant. The value of first secondary parameter gamma1 is predefined and must satisfy the following inequality:

                            gamma1 / (2 × (n − 1)) > Θ

```python
#taking inputs
N = int(input("Enter N( the total number of HN nodes)"))
Fs = int(input("Enter Fs()"))
L = int(input("Enter L(length of area)"))
B = int(input("Enter B(LBS)"))
n = int(input("Enter n(number of heterogeneity level)"))

#taking constants
alpha = float(input("Enter alpha"))#singh has taken this as 0.5
#beta = input("Enter beta")
gamma = float(input("Enter gamma"))#intial gamma will be given
theta = float(input("Enter theta"))#should validate a equation

Einti = float(input("Enter E1(initial energy)"))

print(N,Fs,L,B,n,alpha,gamma,theta,Einti)
#setting parameters are given based 4.2 section setting parameters
```

    Enter N( the total number of HN nodes)2000
    Enter Fs()20
    Enter L(length of area)200
    Enter B(LBS)12
    Enter n(number of heterogeneity level)2
    Enter alpha2
    Enter gamma0.4
    Enter theta0.025
    Enter E1(initial energy)0.5
    2000 20 200 12 2 2.0 0.4 0.025 0.5

```python
#we need to validate theta and gamma values and find beta constant
if((gamma /  (2*(n-1)) ) > theta):
    print("proceed")
else:
    print("error in input values")
```

    proceed

```python
#assume i need 6 level heterogenity
#so now beta = gamma7
#finding gamma values

gammavalues = [gamma]
#getting gamma values
for i in range(1,n+1):
    #gammai = gammai-1 - 2*theta
    gammavalues.append(round(gammavalues[i-1] - 2*theta,3))

print(gammavalues)
```

    [0.4, 0.35, 0.3]

```python
#number of nodes in each level
beta = gammavalues[len(gammavalues)-1]
lastgamma = beta
gammavalues[:] = gammavalues[:len(gammavalues)-1]

print(gammavalues)

#https://docs.sympy.org/latest/modules/solvers/solvers.html#systems-of-polynomial-equations
```

    [0.4, 0.35]

```python
from sympy.solvers import solve
from sympy import Symbol
beta = Symbol('x',positive=True)
#https://docs.sympy.org/latest/modules/solvers/solvers.html#systems-of-polynomial-equations
f =1
for i in range(n-1,-1,-1):
    f = f*(beta-gammavalues[i])
    f= f+1

f = f-2
print(f)
beta = solve(f, beta)
print(beta)
```

    (x - 0.4)*(x + 0.65) - 1
    [1.00443569980765]

it is given that
Etot = N*[(beta-gamma1)*E1 + (beta-gamma1*(beta-gamma2)*E2)+.....+(beta-gamm1)(beta-gamma2)..*En]
Energies are in Et
gamma values are in gammavalues

Singh as considered this

For beta == gamma2, the model describes the homogenous network or
1-level heterogeneity as the network contains only one type of
nodes. The number of nodes in the network is 100 for
MLHEED-1, which are of same type.

For beta == gamma3, the model describes 2-level heterogeneity as the
network contains two types of nodes. The number of type-1 and
type-2 nodes are 60 and 40, respectively, for MLHEED-2.

For beta == gamma4, the model describes 3-level heterogeneity as the
network contains three types of nodes. The number of type-1,
type-2, and type-3 nodes are 52, 30, and 18, respectively, for
MLHEED-3.

For beta == gamma5, the model describes 4-level heterogeneity as the
network contains four types of nodes. The number of type-1,
type-2, type-3, and type-4 nodes are 49, 26, 15, and 10, respectively,
for MLHEED-4.

For beta == gamma6, the model describes 5-level heterogeneity as the
network contains five types of nodes. The number of type-1,
type-2, type-3, type-4 and type-5 nodes are 47, 24, 14, 9 and 6,
respectively, for MLHEED-5.

For beta == gamma7, the model describes 6-level heterogeneity as the
network contains six types of nodes. The number of type-1, type-
2, type-3, type-4, type-5 and type-6 nodes are 46, 24, 13, 8, 5
and 4, respectively, for MLHEED-6.

why he did this?i don't know,i didn't read the paper..

so proceed further i will accept it..

let's take beta = gamma6 for 5 level heterogenity

```python
#we have taken beta as 0.8544 for building temporarly as mentioned in singh's paper
#testing
print(alpha,beta,gamma,gammavalues)
print(N,Fs,L,B,n,alpha,gamma,theta,Einti)
```

    2.0 [1.00443569980765] 0.4 [0.4, 0.35]
    2000 20 200 12 2 2.0 0.4 0.025 0.5

```python

Nt = [] #indicate cardinality of n categories
Et = [] #indicate Energy of n categories
EnergySinghTotal = []

for i in range(1,n+1):
    # we compute Nit and Eit and append them to Nt and Et,formulea are shown below
    #(Einti * (1 + ((i − 1) * alpha)))
    et = i-1
    et = et*alpha
    et = et+1
    et = et*Einti
    Et.append(et)
    #Nit = N × (beta − gamma1) × (beta − gamma2) × (beta − gamma3)×⋯× (beta − gammai)
    nt = N
    for j in range(0,i):
        nt = nt *(beta[0] - gammavalues[j])
    Nt.append(nt)

print(Et)
print(Nt)

import math
Nt1 = [round(Nt[i],1) for i in range(len(Nt))]
for i in range(len(Nt1)):
    if (Nt1[i]-int(Nt1[i])) >= 0.5:
        Nt1[i] = math.ceil(Nt1[i])
    else:
        Nt1[i] = math.floor(Nt1[i])

print(Nt1)

Nt[:] = Nt1[:]
for i in range(len(Nt1)):
    print("Nodes in level - ",i+1," = ",Nt[i] ," , Energy = ",Et[i])

for i in range(len(Nt)):
    EnergySinghTotal.append(Nt[i]*Et[i])
#https://www.geeksforgeeks.org/precision-handling-python/
print("According to singh's ")
for i in range(len(Nt1)):
    print("total Energy in level -",i," = ",EnergySinghTotal[i])
```

    [0.5, 1.5]
    [1208.87139961530, 791.128600384697]
    [1209, 791]
    Nodes in level -  1  =  1209  , Energy =  0.5
    Nodes in level -  2  =  791  , Energy =  1.5
    According to singh's
    total Energy in level - 0  =  604.5
    total Energy in level - 1  =  1186.5

```python
#checking
if N == sum(Nt):
    print("sum of nodes in all the level is equal to N ")
else:
    print("sum of nodes in all the level is not equal to N,Something went wrong ")
```

    sum of nodes in all the level is equal to N

```python
#for sake of solving
print(Nt)
for i in range(len(Nt)):
    Nt[i] = float(Nt[i]/100)
    #print(Nt[i])
    if (Nt[i] - int(Nt[i])) >= 0.5:
        Nt[i] = math.ceil(Nt[i])*100
    else:
        Nt[i] = math.floor(Nt[i])*100

print(Nt)
```

    [1209, 791]
    [1200, 800]

# Now starts Hybrid Placement Algorithm

### note

First, it determines the number of zones Z, into
which A will be divided based on two main parameters: the
total number of HN nodes (N) in the network, and the scalability
factor ( Fs ) which we define as the maximum number
of nodes to be accommodated in a single zone. The value of
Z is given by:

```python
Z = math.pow(math.ceil(math.sqrt(N)/math.sqrt(Fs)),2)
print(Z)
```

    100.0

Second, it decides the number of HN nodes that will be deployed
in each single zone. according to the following formula:

```python
Nz = []
for z in range(1,int(Z)+1):
    if z==1:
        Nz.append(math.ceil(N/Z))
    else:
        k = 0
        for i in Nz:
            k = k + i

        Nz.append(math.ceil((N - k)/(Z - z + 1)))

print(Nz)
```

    [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]

the working area A is divided into Z
equal zones each L /√Z × L /√Z . Then each Nz heterogeneous
nodes are randomly deployed in the respective zone in a
uniform manner such that the vertical and horizontal coordinates
of each node are randomly selected within the minimum
and maximum limits of the zone dimensions. Here, we
assume that the node sensing and communication ranges rs
and rc are set to L/ √Z.√2 and 2. L /√Z.√2 respectively.

```python
#so 100 zones each with 20 nodes,for each node we need to find rsmax,rcmax

rsmax = []#node sensing
rcmax = []#communication ranges

for i in range(0,int(Z)):
    rsmax.append(  (L/math.sqrt(int(Z)  ))  *     math.sqrt(2)      )
    rcmax.append( (L/math.sqrt(int(Z)))*math.sqrt(2)*2)

print(rsmax,"                ",rcmax)

```

    [28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902, 28.284271247461902]                  [56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804, 56.568542494923804]

### Note
Third, it defines the value of R, the total number of EHs
that should be deployed as relay nodes over all the zones
as given by:

```python
R = int(math.pow( math.sqrt(int(Z))+1 , 2 ))
print(R)
```

    121

## NETWORK FORMATION

the working area A is divided into Z equal zones each L /√Z × L /√Z .

```python
D = int(L/math.sqrt(Z))
print(D)
```

    20

You can use ticker to set the tick locations for the grid. The user can specify the input to MultipleLocator which will "Set a tick on every integer that is multiple of base in the view interval."

```python
#this is testing plot
from matplotlib import pyplot as plt
from matplotlib.ticker import MultipleLocator
import numpy as np

fig = plt.figure(figsize=(30, 30))#defining size
ax1 = fig.add_subplot(2,2,1)#adding a plot to figure

spacing = D # This can be your user specified spacing.
minorLocator = MultipleLocator(spacing)
ax1.plot(9 * np.random.rand(10))#testing
ax1.plot([1,2,3,4], [1,4,9,16], 'ro')#testing
# Set minor tick locations.
ax1.yaxis.set_minor_locator(minorLocator)
ax1.xaxis.set_minor_locator(minorLocator)

plt.axis([0, L, 0, L])#defining axix x and y
# Set grid to use minor tick locations.

ax1.grid(which = 'minor')#only major works fine

plt.show()
```

Now we need to process each zone

In each zone find Nzi random (x,y) with the zone limits and plot them

distribute R EH node at the corners of each node so it becomes 121 it hope

```python
#this is for one zone we need to do it for all the zones
import random

rangeX = (0, 20)
rangeY = (0, 20)

# deltas = set()
# for x in range(1, 20):
#     for y in range(1, 20):
#         deltas.add((x,y))

randPoints = []
excluded = set()
i = 0
while i<D:
    x = random.randrange(*rangeX)
    y = random.randrange(*rangeY)
    if (x,y) in excluded: continue
    randPoints.append((x,y))
    i += 1
    excluded.update((x, y))
print(randPoints)
randomPoints = randPoints
#https://stackoverflow.com/questions/19668463/generating-multiple-random-x-y-coordinates-excluding-duplicates

#as i need to deploy a node in an x,y position with energy append to it,i am doing this
#randomly selelcting a node
#https://stackoverflow.com/questions/306400/how-to-randomly-select-an-item-from-a-list

#no of nodes in each level
nodesinlevel = []
for i in range(len(Nt)):
    nodesinlevel.append(int(Nt[i]/100))

id = 1
secure_random = random.SystemRandom()
nodeswithenergy = []#(x,y),energy,id
for j in range(len(nodesinlevel)):
    for i in range(nodesinlevel[j]):
        list1 = []
        list1.append(secure_random.choice(randPoints))
        randPoints.remove(list1[0])
        list1.append(Et[j])
        list1.append(id)
        id = id+1
        nodeswithenergy.append(list1)

print(nodeswithenergy)

def getpoints(startx,starty,endx,endy,id):
    rangeX = (startx,endx)
    rangeY = (starty,endy)
    randPoints = []
    excluded = set()
    i = 0
    while i<D:
        x = random.randrange(*rangeX)
        y = random.randrange(*rangeY)
        if (x,y) in excluded: continue
        randPoints.append((x,y))
        i += 1
        excluded.update((x, y))

    secure_random = random.SystemRandom()
    nodeswithenergy = []#(x,y),energy,id
    for j in range(len(nodesinlevel)):
        for i in range(nodesinlevel[j]):
            list1 = []
            list1.append(secure_random.choice(randPoints))
            randPoints.remove(list1[0])
            list1.append(Et[j])
            list1.append(id)
            id = id+1
            nodeswithenergy.append(list1)
    return(nodeswithenergy)
```

    [(6, 6), (17, 0), (12, 8), (11, 8), (2, 2), (17, 3), (10, 4), (1, 17), (7, 10), (18, 16), (1, 8), (15, 18), (4, 8), (19, 4), (7, 3), (1, 17), (3, 16), (14, 9), (16, 7), (12, 3)]
    [[(12, 3), 0.5, 1], [(11, 8), 0.5, 2], [(15, 18), 0.5, 3], [(3, 16), 0.5, 4], [(14, 9), 0.5, 5], [(4, 8), 0.5, 6], [(12, 8), 0.5, 7], [(19, 4), 0.5, 8], [(16, 7), 0.5, 9], [(7, 10), 0.5, 10], [(6, 6), 0.5, 11], [(18, 16), 0.5, 12], [(7, 3), 1.5, 13], [(17, 3), 1.5, 14], [(10, 4), 1.5, 15], [(17, 0), 1.5, 16], [(2, 2), 1.5, 17], [(1, 8), 1.5, 18], [(1, 17), 1.5, 19], [(1, 17), 1.5, 20]]

```python
zonespoints = []
for i in range(0,int(math.sqrt(int(Z)))):#for y axis
    for j in range(0,int(math.sqrt(int(Z)))):#for x axis
        zonespoints.append(getpoints(j*20,i*20,(j+1)*20,(i+1)*20,j*20+1+200*i))

for i in zonespoints:
    print(i)
```

    [[(11, 8), 0.5, 1], [(0, 11), 0.5, 2], [(16, 0), 0.5, 3], [(8, 16), 0.5, 4], [(0, 14), 0.5, 5], [(4, 13), 0.5, 6], [(2, 9), 0.5, 7], [(7, 2), 0.5, 8], [(14, 16), 0.5, 9], [(13, 15), 0.5, 10], [(7, 18), 0.5, 11], [(19, 10), 0.5, 12], [(18, 12), 1.5, 13], [(0, 4), 1.5, 14], [(1, 13), 1.5, 15], [(7, 16), 1.5, 16], [(12, 15), 1.5, 17], [(15, 4), 1.5, 18], [(11, 6), 1.5, 19], [(16, 11), 1.5, 20]]
    [[(36, 6), 0.5, 21], [(39, 11), 0.5, 22], [(29, 6), 0.5, 23], [(29, 9), 0.5, 24], [(24, 5), 0.5, 25], [(29, 0), 0.5, 26], [(39, 13), 0.5, 27], [(30, 6), 0.5, 28], [(21, 6), 0.5, 29], [(32, 8), 0.5, 30], [(25, 9), 0.5, 31], [(26, 3), 0.5, 32], [(33, 17), 1.5, 33], [(24, 7), 1.5, 34], [(20, 12), 1.5, 35], [(23, 7), 1.5, 36], [(31, 7), 1.5, 37], [(27, 6), 1.5, 38], [(29, 8), 1.5, 39], [(28, 6), 1.5, 40]]
    [[(40, 15), 0.5, 41], [(52, 13), 0.5, 42], [(45, 4), 0.5, 43], [(53, 1), 0.5, 44], [(41, 18), 0.5, 45], [(55, 3), 0.5, 46], [(51, 14), 0.5, 47], [(54, 5), 0.5, 48], [(58, 3), 0.5, 49], [(59, 11), 0.5, 50], [(43, 9), 0.5, 51], [(53, 6), 0.5, 52], [(52, 8), 1.5, 53], [(40, 7), 1.5, 54], [(53, 13), 1.5, 55], [(54, 9), 1.5, 56], [(57, 18), 1.5, 57], [(45, 2), 1.5, 58], [(59, 11), 1.5, 59], [(44, 9), 1.5, 60]]
    [[(76, 6), 0.5, 61], [(67, 11), 0.5, 62], [(79, 12), 0.5, 63], [(72, 10), 0.5, 64], [(61, 8), 0.5, 65], [(67, 13), 0.5, 66], [(79, 4), 0.5, 67], [(70, 11), 0.5, 68], [(74, 5), 0.5, 69], [(76, 16), 0.5, 70], [(73, 17), 0.5, 71], [(75, 18), 0.5, 72], [(63, 4), 1.5, 73], [(72, 5), 1.5, 74], [(77, 12), 1.5, 75], [(77, 5), 1.5, 76], [(78, 12), 1.5, 77], [(70, 7), 1.5, 78], [(64, 5), 1.5, 79], [(67, 16), 1.5, 80]]
    [[(80, 8), 0.5, 81], [(93, 4), 0.5, 82], [(87, 13), 0.5, 83], [(88, 5), 0.5, 84], [(89, 13), 0.5, 85], [(88, 9), 0.5, 86], [(84, 19), 0.5, 87], [(94, 1), 0.5, 88], [(92, 11), 0.5, 89], [(84, 9), 0.5, 90], [(83, 18), 0.5, 91], [(88, 4), 0.5, 92], [(82, 16), 1.5, 93], [(82, 4), 1.5, 94], [(94, 17), 1.5, 95], [(85, 5), 1.5, 96], [(97, 10), 1.5, 97], [(95, 10), 1.5, 98], [(89, 7), 1.5, 99], [(85, 17), 1.5, 100]]
    [[(103, 14), 0.5, 101], [(118, 11), 0.5, 102], [(100, 17), 0.5, 103], [(104, 6), 0.5, 104], [(101, 9), 0.5, 105], [(116, 0), 0.5, 106], [(103, 3), 0.5, 107], [(117, 1), 0.5, 108], [(104, 18), 0.5, 109], [(106, 9), 0.5, 110], [(103, 4), 0.5, 111], [(110, 8), 0.5, 112], [(117, 2), 1.5, 113], [(112, 6), 1.5, 114], [(112, 18), 1.5, 115], [(101, 2), 1.5, 116], [(115, 4), 1.5, 117], [(105, 0), 1.5, 118], [(106, 13), 1.5, 119], [(113, 6), 1.5, 120]]
    [[(127, 11), 0.5, 121], [(136, 14), 0.5, 122], [(127, 10), 0.5, 123], [(134, 16), 0.5, 124], [(125, 10), 0.5, 125], [(136, 0), 0.5, 126], [(131, 4), 0.5, 127], [(138, 5), 0.5, 128], [(128, 2), 0.5, 129], [(122, 3), 0.5, 130], [(129, 17), 0.5, 131], [(134, 6), 0.5, 132], [(120, 14), 1.5, 133], [(134, 16), 1.5, 134], [(126, 9), 1.5, 135], [(129, 3), 1.5, 136], [(137, 10), 1.5, 137], [(134, 1), 1.5, 138], [(126, 6), 1.5, 139], [(132, 3), 1.5, 140]]
    [[(151, 18), 0.5, 141], [(146, 7), 0.5, 142], [(158, 15), 0.5, 143], [(145, 15), 0.5, 144], [(149, 9), 0.5, 145], [(144, 2), 0.5, 146], [(141, 7), 0.5, 147], [(146, 1), 0.5, 148], [(156, 4), 0.5, 149], [(146, 0), 0.5, 150], [(153, 2), 0.5, 151], [(155, 16), 0.5, 152], [(151, 9), 1.5, 153], [(152, 11), 1.5, 154], [(144, 12), 1.5, 155], [(143, 2), 1.5, 156], [(158, 7), 1.5, 157], [(145, 9), 1.5, 158], [(154, 9), 1.5, 159], [(154, 19), 1.5, 160]]
    [[(167, 3), 0.5, 161], [(163, 17), 0.5, 162], [(161, 1), 0.5, 163], [(171, 15), 0.5, 164], [(173, 12), 0.5, 165], [(179, 13), 0.5, 166], [(179, 8), 0.5, 167], [(162, 2), 0.5, 168], [(170, 3), 0.5, 169], [(173, 11), 0.5, 170], [(170, 18), 0.5, 171], [(160, 11), 0.5, 172], [(173, 8), 1.5, 173], [(169, 9), 1.5, 174], [(160, 1), 1.5, 175], [(169, 19), 1.5, 176], [(167, 3), 1.5, 177], [(171, 1), 1.5, 178], [(175, 3), 1.5, 179], [(175, 19), 1.5, 180]]
    [[(199, 18), 0.5, 181], [(185, 17), 0.5, 182], [(192, 7), 0.5, 183], [(196, 18), 0.5, 184], [(183, 7), 0.5, 185], [(194, 14), 0.5, 186], [(180, 0), 0.5, 187], [(196, 18), 0.5, 188], [(190, 1), 0.5, 189], [(180, 3), 0.5, 190], [(196, 1), 0.5, 191], [(194, 18), 0.5, 192], [(199, 8), 1.5, 193], [(183, 19), 1.5, 194], [(182, 0), 1.5, 195], [(197, 7), 1.5, 196], [(189, 1), 1.5, 197], [(195, 5), 1.5, 198], [(194, 7), 1.5, 199], [(196, 10), 1.5, 200]]
    [[(14, 27), 0.5, 201], [(14, 29), 0.5, 202], [(15, 23), 0.5, 203], [(1, 37), 0.5, 204], [(6, 24), 0.5, 205], [(17, 34), 0.5, 206], [(7, 38), 0.5, 207], [(12, 28), 0.5, 208], [(15, 30), 0.5, 209], [(4, 26), 0.5, 210], [(0, 29), 0.5, 211], [(7, 20), 0.5, 212], [(0, 28), 1.5, 213], [(18, 35), 1.5, 214], [(11, 28), 1.5, 215], [(1, 30), 1.5, 216], [(11, 25), 1.5, 217], [(3, 24), 1.5, 218], [(0, 35), 1.5, 219], [(5, 39), 1.5, 220]]
    [[(20, 22), 0.5, 221], [(22, 34), 0.5, 222], [(22, 25), 0.5, 223], [(24, 35), 0.5, 224], [(20, 37), 0.5, 225], [(25, 20), 0.5, 226], [(22, 38), 0.5, 227], [(28, 27), 0.5, 228], [(22, 37), 0.5, 229], [(31, 24), 0.5, 230], [(37, 27), 0.5, 231], [(38, 25), 0.5, 232], [(27, 22), 1.5, 233], [(23, 39), 1.5, 234], [(35, 37), 1.5, 235], [(39, 28), 1.5, 236], [(21, 27), 1.5, 237], [(35, 22), 1.5, 238], [(27, 26), 1.5, 239], [(34, 21), 1.5, 240]]
    [[(47, 21), 0.5, 241], [(44, 32), 0.5, 242], [(53, 29), 0.5, 243], [(48, 35), 0.5, 244], [(41, 21), 0.5, 245], [(54, 34), 0.5, 246], [(45, 22), 0.5, 247], [(54, 32), 0.5, 248], [(58, 34), 0.5, 249], [(47, 32), 0.5, 250], [(55, 35), 0.5, 251], [(43, 26), 0.5, 252], [(50, 32), 1.5, 253], [(55, 28), 1.5, 254], [(54, 24), 1.5, 255], [(51, 27), 1.5, 256], [(56, 33), 1.5, 257], [(57, 23), 1.5, 258], [(43, 31), 1.5, 259], [(41, 39), 1.5, 260]]
    [[(71, 33), 0.5, 261], [(60, 23), 0.5, 262], [(69, 33), 0.5, 263], [(78, 28), 0.5, 264], [(77, 36), 0.5, 265], [(74, 37), 0.5, 266], [(60, 36), 0.5, 267], [(66, 26), 0.5, 268], [(60, 28), 0.5, 269], [(60, 39), 0.5, 270], [(69, 25), 0.5, 271], [(69, 29), 0.5, 272], [(72, 26), 1.5, 273], [(68, 23), 1.5, 274], [(66, 22), 1.5, 275], [(73, 28), 1.5, 276], [(77, 22), 1.5, 277], [(75, 39), 1.5, 278], [(61, 25), 1.5, 279], [(64, 20), 1.5, 280]]
    [[(97, 24), 0.5, 281], [(86, 38), 0.5, 282], [(80, 35), 0.5, 283], [(96, 34), 0.5, 284], [(92, 39), 0.5, 285], [(95, 20), 0.5, 286], [(98, 39), 0.5, 287], [(80, 34), 0.5, 288], [(86, 26), 0.5, 289], [(93, 22), 0.5, 290], [(83, 32), 0.5, 291], [(82, 38), 0.5, 292], [(99, 28), 1.5, 293], [(95, 28), 1.5, 294], [(84, 20), 1.5, 295], [(86, 26), 1.5, 296], [(86, 32), 1.5, 297], [(89, 36), 1.5, 298], [(83, 38), 1.5, 299], [(83, 21), 1.5, 300]]
    [[(104, 29), 0.5, 301], [(105, 33), 0.5, 302], [(103, 20), 0.5, 303], [(118, 22), 0.5, 304], [(117, 38), 0.5, 305], [(110, 39), 0.5, 306], [(109, 35), 0.5, 307], [(105, 26), 0.5, 308], [(118, 38), 0.5, 309], [(108, 38), 0.5, 310], [(116, 21), 0.5, 311], [(100, 27), 0.5, 312], [(105, 39), 1.5, 313], [(104, 39), 1.5, 314], [(118, 33), 1.5, 315], [(102, 26), 1.5, 316], [(111, 26), 1.5, 317], [(103, 32), 1.5, 318], [(107, 26), 1.5, 319], [(111, 27), 1.5, 320]]
    [[(125, 37), 0.5, 321], [(127, 29), 0.5, 322], [(121, 27), 0.5, 323], [(126, 25), 0.5, 324], [(138, 29), 0.5, 325], [(130, 35), 0.5, 326], [(122, 26), 0.5, 327], [(136, 39), 0.5, 328], [(135, 24), 0.5, 329], [(134, 22), 0.5, 330], [(131, 30), 0.5, 331], [(126, 25), 0.5, 332], [(124, 24), 1.5, 333], [(133, 28), 1.5, 334], [(132, 23), 1.5, 335], [(129, 28), 1.5, 336], [(123, 35), 1.5, 337], [(120, 30), 1.5, 338], [(120, 35), 1.5, 339], [(132, 38), 1.5, 340]]
    [[(145, 28), 0.5, 341], [(155, 37), 0.5, 342], [(150, 33), 0.5, 343], [(143, 21), 0.5, 344], [(157, 35), 0.5, 345], [(140, 35), 0.5, 346], [(157, 24), 0.5, 347], [(151, 38), 0.5, 348], [(158, 30), 0.5, 349], [(158, 36), 0.5, 350], [(156, 33), 0.5, 351], [(154, 29), 0.5, 352], [(146, 28), 1.5, 353], [(159, 38), 1.5, 354], [(153, 29), 1.5, 355], [(155, 25), 1.5, 356], [(155, 27), 1.5, 357], [(150, 37), 1.5, 358], [(151, 28), 1.5, 359], [(141, 24), 1.5, 360]]
    [[(179, 34), 0.5, 361], [(171, 27), 0.5, 362], [(164, 21), 0.5, 363], [(161, 25), 0.5, 364], [(174, 29), 0.5, 365], [(165, 31), 0.5, 366], [(175, 26), 0.5, 367], [(165, 30), 0.5, 368], [(160, 28), 0.5, 369], [(171, 35), 0.5, 370], [(179, 31), 0.5, 371], [(176, 32), 0.5, 372], [(176, 28), 1.5, 373], [(176, 24), 1.5, 374], [(171, 32), 1.5, 375], [(172, 21), 1.5, 376], [(170, 38), 1.5, 377], [(175, 36), 1.5, 378], [(178, 28), 1.5, 379], [(161, 25), 1.5, 380]]
    [[(198, 20), 0.5, 381], [(189, 29), 0.5, 382], [(185, 27), 0.5, 383], [(185, 28), 0.5, 384], [(182, 37), 0.5, 385], [(190, 27), 0.5, 386], [(184, 36), 0.5, 387], [(198, 33), 0.5, 388], [(196, 34), 0.5, 389], [(198, 24), 0.5, 390], [(190, 22), 0.5, 391], [(191, 29), 0.5, 392], [(180, 35), 1.5, 393], [(185, 26), 1.5, 394], [(195, 34), 1.5, 395], [(195, 35), 1.5, 396], [(198, 22), 1.5, 397], [(190, 30), 1.5, 398], [(191, 28), 1.5, 399], [(180, 34), 1.5, 400]]
    [[(4, 59), 0.5, 401], [(12, 48), 0.5, 402], [(4, 56), 0.5, 403], [(7, 52), 0.5, 404], [(2, 59), 0.5, 405], [(2, 46), 0.5, 406], [(19, 57), 0.5, 407], [(6, 48), 0.5, 408], [(9, 44), 0.5, 409], [(18, 55), 0.5, 410], [(12, 50), 0.5, 411], [(15, 42), 0.5, 412], [(3, 48), 1.5, 413], [(2, 42), 1.5, 414], [(1, 55), 1.5, 415], [(6, 44), 1.5, 416], [(18, 47), 1.5, 417], [(17, 46), 1.5, 418], [(1, 48), 1.5, 419], [(9, 52), 1.5, 420]]
    [[(39, 54), 0.5, 421], [(28, 58), 0.5, 422], [(38, 41), 0.5, 423], [(33, 41), 0.5, 424], [(21, 50), 0.5, 425], [(24, 56), 0.5, 426], [(26, 41), 0.5, 427], [(32, 49), 0.5, 428], [(36, 55), 0.5, 429], [(33, 40), 0.5, 430], [(32, 43), 0.5, 431], [(37, 46), 0.5, 432], [(39, 55), 1.5, 433], [(27, 43), 1.5, 434], [(31, 51), 1.5, 435], [(38, 42), 1.5, 436], [(30, 54), 1.5, 437], [(22, 49), 1.5, 438], [(35, 43), 1.5, 439], [(24, 54), 1.5, 440]]
    [[(42, 49), 0.5, 441], [(40, 59), 0.5, 442], [(49, 44), 0.5, 443], [(42, 58), 0.5, 444], [(49, 46), 0.5, 445], [(58, 58), 0.5, 446], [(52, 59), 0.5, 447], [(45, 52), 0.5, 448], [(48, 40), 0.5, 449], [(54, 55), 0.5, 450], [(42, 54), 0.5, 451], [(43, 50), 0.5, 452], [(54, 54), 1.5, 453], [(47, 57), 1.5, 454], [(58, 55), 1.5, 455], [(42, 54), 1.5, 456], [(44, 49), 1.5, 457], [(49, 59), 1.5, 458], [(48, 50), 1.5, 459], [(41, 45), 1.5, 460]]
    [[(64, 43), 0.5, 461], [(60, 46), 0.5, 462], [(60, 51), 0.5, 463], [(76, 55), 0.5, 464], [(72, 54), 0.5, 465], [(70, 58), 0.5, 466], [(74, 44), 0.5, 467], [(76, 41), 0.5, 468], [(71, 59), 0.5, 469], [(65, 54), 0.5, 470], [(67, 45), 0.5, 471], [(68, 52), 0.5, 472], [(66, 46), 1.5, 473], [(72, 40), 1.5, 474], [(64, 57), 1.5, 475], [(68, 49), 1.5, 476], [(63, 43), 1.5, 477], [(66, 51), 1.5, 478], [(79, 52), 1.5, 479], [(68, 44), 1.5, 480]]
    [[(90, 40), 0.5, 481], [(91, 58), 0.5, 482], [(81, 44), 0.5, 483], [(97, 44), 0.5, 484], [(96, 57), 0.5, 485], [(93, 51), 0.5, 486], [(85, 53), 0.5, 487], [(82, 41), 0.5, 488], [(81, 46), 0.5, 489], [(83, 58), 0.5, 490], [(87, 53), 0.5, 491], [(84, 41), 0.5, 492], [(90, 55), 1.5, 493], [(91, 42), 1.5, 494], [(87, 54), 1.5, 495], [(90, 48), 1.5, 496], [(87, 47), 1.5, 497], [(86, 47), 1.5, 498], [(99, 49), 1.5, 499], [(82, 57), 1.5, 500]]
    [[(101, 41), 0.5, 501], [(106, 41), 0.5, 502], [(103, 42), 0.5, 503], [(117, 56), 0.5, 504], [(100, 40), 0.5, 505], [(110, 41), 0.5, 506], [(114, 45), 0.5, 507], [(105, 54), 0.5, 508], [(113, 49), 0.5, 509], [(111, 59), 0.5, 510], [(119, 56), 0.5, 511], [(119, 49), 0.5, 512], [(116, 58), 1.5, 513], [(101, 45), 1.5, 514], [(118, 58), 1.5, 515], [(118, 58), 1.5, 516], [(115, 40), 1.5, 517], [(102, 52), 1.5, 518], [(101, 52), 1.5, 519], [(109, 50), 1.5, 520]]
    [[(134, 58), 0.5, 521], [(128, 44), 0.5, 522], [(123, 50), 0.5, 523], [(132, 40), 0.5, 524], [(123, 46), 0.5, 525], [(122, 58), 0.5, 526], [(138, 51), 0.5, 527], [(133, 53), 0.5, 528], [(129, 56), 0.5, 529], [(130, 41), 0.5, 530], [(122, 52), 0.5, 531], [(132, 49), 0.5, 532], [(139, 45), 1.5, 533], [(131, 47), 1.5, 534], [(123, 50), 1.5, 535], [(126, 53), 1.5, 536], [(135, 49), 1.5, 537], [(129, 53), 1.5, 538], [(130, 40), 1.5, 539], [(127, 44), 1.5, 540]]
    [[(143, 54), 0.5, 541], [(142, 53), 0.5, 542], [(157, 43), 0.5, 543], [(156, 44), 0.5, 544], [(156, 53), 0.5, 545], [(155, 44), 0.5, 546], [(157, 56), 0.5, 547], [(152, 44), 0.5, 548], [(152, 55), 0.5, 549], [(147, 43), 0.5, 550], [(141, 43), 0.5, 551], [(155, 50), 0.5, 552], [(158, 56), 1.5, 553], [(156, 51), 1.5, 554], [(140, 44), 1.5, 555], [(146, 56), 1.5, 556], [(149, 43), 1.5, 557], [(153, 42), 1.5, 558], [(148, 42), 1.5, 559], [(159, 51), 1.5, 560]]
    [[(177, 55), 0.5, 561], [(163, 57), 0.5, 562], [(174, 41), 0.5, 563], [(172, 54), 0.5, 564], [(167, 50), 0.5, 565], [(177, 43), 0.5, 566], [(174, 42), 0.5, 567], [(168, 41), 0.5, 568], [(162, 50), 0.5, 569], [(176, 56), 0.5, 570], [(175, 52), 0.5, 571], [(169, 40), 0.5, 572], [(174, 51), 1.5, 573], [(173, 44), 1.5, 574], [(179, 51), 1.5, 575], [(175, 59), 1.5, 576], [(166, 54), 1.5, 577], [(175, 40), 1.5, 578], [(173, 45), 1.5, 579], [(161, 52), 1.5, 580]]
    [[(184, 55), 0.5, 581], [(199, 46), 0.5, 582], [(197, 41), 0.5, 583], [(183, 42), 0.5, 584], [(194, 48), 0.5, 585], [(189, 53), 0.5, 586], [(197, 55), 0.5, 587], [(184, 41), 0.5, 588], [(188, 48), 0.5, 589], [(195, 48), 0.5, 590], [(187, 49), 0.5, 591], [(187, 53), 0.5, 592], [(198, 42), 1.5, 593], [(188, 57), 1.5, 594], [(197, 41), 1.5, 595], [(196, 44), 1.5, 596], [(196, 42), 1.5, 597], [(191, 55), 1.5, 598], [(193, 43), 1.5, 599], [(180, 42), 1.5, 600]]
    [[(2, 66), 0.5, 601], [(6, 65), 0.5, 602], [(13, 64), 0.5, 603], [(15, 61), 0.5, 604], [(8, 69), 0.5, 605], [(12, 69), 0.5, 606], [(10, 67), 0.5, 607], [(18, 78), 0.5, 608], [(2, 78), 0.5, 609], [(17, 61), 0.5, 610], [(11, 79), 0.5, 611], [(14, 66), 0.5, 612], [(13, 76), 1.5, 613], [(13, 74), 1.5, 614], [(5, 62), 1.5, 615], [(0, 69), 1.5, 616], [(5, 70), 1.5, 617], [(1, 74), 1.5, 618], [(7, 69), 1.5, 619], [(17, 61), 1.5, 620]]
    [[(23, 64), 0.5, 621], [(37, 65), 0.5, 622], [(20, 74), 0.5, 623], [(21, 71), 0.5, 624], [(25, 68), 0.5, 625], [(25, 68), 0.5, 626], [(20, 67), 0.5, 627], [(30, 76), 0.5, 628], [(36, 64), 0.5, 629], [(35, 73), 0.5, 630], [(38, 76), 0.5, 631], [(32, 74), 0.5, 632], [(31, 64), 1.5, 633], [(29, 71), 1.5, 634], [(38, 78), 1.5, 635], [(34, 64), 1.5, 636], [(35, 77), 1.5, 637], [(37, 64), 1.5, 638], [(20, 64), 1.5, 639], [(26, 61), 1.5, 640]]
    [[(47, 79), 0.5, 641], [(43, 66), 0.5, 642], [(54, 67), 0.5, 643], [(46, 74), 0.5, 644], [(52, 69), 0.5, 645], [(51, 64), 0.5, 646], [(46, 65), 0.5, 647], [(42, 77), 0.5, 648], [(48, 75), 0.5, 649], [(54, 61), 0.5, 650], [(50, 74), 0.5, 651], [(51, 70), 0.5, 652], [(49, 79), 1.5, 653], [(51, 73), 1.5, 654], [(52, 68), 1.5, 655], [(40, 66), 1.5, 656], [(41, 61), 1.5, 657], [(42, 68), 1.5, 658], [(49, 73), 1.5, 659], [(55, 69), 1.5, 660]]
    [[(66, 74), 0.5, 661], [(63, 64), 0.5, 662], [(75, 64), 0.5, 663], [(73, 65), 0.5, 664], [(65, 69), 0.5, 665], [(75, 75), 0.5, 666], [(74, 63), 0.5, 667], [(79, 69), 0.5, 668], [(68, 64), 0.5, 669], [(71, 71), 0.5, 670], [(64, 67), 0.5, 671], [(76, 73), 0.5, 672], [(61, 75), 1.5, 673], [(61, 62), 1.5, 674], [(69, 77), 1.5, 675], [(78, 67), 1.5, 676], [(72, 64), 1.5, 677], [(77, 71), 1.5, 678], [(65, 62), 1.5, 679], [(64, 71), 1.5, 680]]
    [[(90, 77), 0.5, 681], [(89, 74), 0.5, 682], [(83, 74), 0.5, 683], [(82, 75), 0.5, 684], [(96, 75), 0.5, 685], [(85, 78), 0.5, 686], [(85, 69), 0.5, 687], [(96, 67), 0.5, 688], [(92, 71), 0.5, 689], [(80, 78), 0.5, 690], [(98, 71), 0.5, 691], [(83, 61), 0.5, 692], [(83, 75), 1.5, 693], [(96, 69), 1.5, 694], [(90, 77), 1.5, 695], [(85, 63), 1.5, 696], [(82, 77), 1.5, 697], [(94, 73), 1.5, 698], [(94, 62), 1.5, 699], [(83, 69), 1.5, 700]]
    [[(112, 79), 0.5, 701], [(102, 76), 0.5, 702], [(116, 76), 0.5, 703], [(115, 66), 0.5, 704], [(106, 69), 0.5, 705], [(103, 70), 0.5, 706], [(115, 72), 0.5, 707], [(107, 62), 0.5, 708], [(113, 79), 0.5, 709], [(103, 74), 0.5, 710], [(117, 76), 0.5, 711], [(108, 73), 0.5, 712], [(119, 61), 1.5, 713], [(109, 62), 1.5, 714], [(105, 72), 1.5, 715], [(114, 70), 1.5, 716], [(107, 67), 1.5, 717], [(105, 71), 1.5, 718], [(119, 72), 1.5, 719], [(107, 63), 1.5, 720]]
    [[(134, 76), 0.5, 721], [(139, 69), 0.5, 722], [(120, 62), 0.5, 723], [(135, 75), 0.5, 724], [(123, 60), 0.5, 725], [(120, 66), 0.5, 726], [(120, 74), 0.5, 727], [(135, 62), 0.5, 728], [(132, 61), 0.5, 729], [(125, 69), 0.5, 730], [(133, 65), 0.5, 731], [(136, 76), 0.5, 732], [(128, 63), 1.5, 733], [(133, 71), 1.5, 734], [(139, 70), 1.5, 735], [(134, 60), 1.5, 736], [(134, 71), 1.5, 737], [(135, 68), 1.5, 738], [(120, 70), 1.5, 739], [(129, 64), 1.5, 740]]
    [[(141, 66), 0.5, 741], [(145, 66), 0.5, 742], [(155, 62), 0.5, 743], [(143, 73), 0.5, 744], [(155, 61), 0.5, 745], [(143, 63), 0.5, 746], [(155, 71), 0.5, 747], [(148, 79), 0.5, 748], [(145, 67), 0.5, 749], [(154, 65), 0.5, 750], [(148, 76), 0.5, 751], [(140, 71), 0.5, 752], [(158, 76), 1.5, 753], [(156, 69), 1.5, 754], [(145, 67), 1.5, 755], [(145, 78), 1.5, 756], [(155, 63), 1.5, 757], [(144, 76), 1.5, 758], [(153, 79), 1.5, 759], [(141, 77), 1.5, 760]]
    [[(173, 78), 0.5, 761], [(161, 79), 0.5, 762], [(172, 63), 0.5, 763], [(169, 62), 0.5, 764], [(170, 71), 0.5, 765], [(177, 75), 0.5, 766], [(172, 62), 0.5, 767], [(173, 60), 0.5, 768], [(165, 69), 0.5, 769], [(179, 73), 0.5, 770], [(174, 61), 0.5, 771], [(167, 73), 0.5, 772], [(160, 62), 1.5, 773], [(176, 79), 1.5, 774], [(161, 67), 1.5, 775], [(170, 63), 1.5, 776], [(160, 65), 1.5, 777], [(161, 78), 1.5, 778], [(171, 77), 1.5, 779], [(162, 75), 1.5, 780]]
    [[(195, 72), 0.5, 781], [(183, 65), 0.5, 782], [(196, 64), 0.5, 783], [(190, 60), 0.5, 784], [(183, 69), 0.5, 785], [(190, 74), 0.5, 786], [(190, 60), 0.5, 787], [(183, 72), 0.5, 788], [(184, 60), 0.5, 789], [(186, 76), 0.5, 790], [(195, 68), 0.5, 791], [(193, 69), 0.5, 792], [(197, 70), 1.5, 793], [(180, 79), 1.5, 794], [(188, 69), 1.5, 795], [(190, 79), 1.5, 796], [(188, 73), 1.5, 797], [(188, 61), 1.5, 798], [(198, 61), 1.5, 799], [(197, 66), 1.5, 800]]
    [[(6, 80), 0.5, 801], [(4, 86), 0.5, 802], [(5, 92), 0.5, 803], [(3, 96), 0.5, 804], [(0, 89), 0.5, 805], [(3, 88), 0.5, 806], [(10, 92), 0.5, 807], [(4, 92), 0.5, 808], [(4, 86), 0.5, 809], [(15, 89), 0.5, 810], [(9, 81), 0.5, 811], [(8, 93), 0.5, 812], [(7, 80), 1.5, 813], [(2, 92), 1.5, 814], [(11, 98), 1.5, 815], [(5, 95), 1.5, 816], [(16, 94), 1.5, 817], [(18, 88), 1.5, 818], [(11, 84), 1.5, 819], [(4, 81), 1.5, 820]]
    [[(24, 92), 0.5, 821], [(22, 99), 0.5, 822], [(27, 94), 0.5, 823], [(22, 90), 0.5, 824], [(22, 84), 0.5, 825], [(34, 86), 0.5, 826], [(39, 81), 0.5, 827], [(37, 84), 0.5, 828], [(21, 96), 0.5, 829], [(26, 96), 0.5, 830], [(38, 97), 0.5, 831], [(26, 85), 0.5, 832], [(32, 85), 1.5, 833], [(31, 96), 1.5, 834], [(20, 84), 1.5, 835], [(23, 98), 1.5, 836], [(26, 87), 1.5, 837], [(36, 86), 1.5, 838], [(30, 96), 1.5, 839], [(30, 97), 1.5, 840]]
    [[(59, 99), 0.5, 841], [(40, 90), 0.5, 842], [(41, 90), 0.5, 843], [(42, 86), 0.5, 844], [(51, 82), 0.5, 845], [(42, 80), 0.5, 846], [(41, 98), 0.5, 847], [(43, 80), 0.5, 848], [(46, 99), 0.5, 849], [(44, 91), 0.5, 850], [(44, 87), 0.5, 851], [(49, 97), 0.5, 852], [(50, 83), 1.5, 853], [(51, 80), 1.5, 854], [(52, 91), 1.5, 855], [(42, 89), 1.5, 856], [(46, 93), 1.5, 857], [(40, 85), 1.5, 858], [(44, 99), 1.5, 859], [(57, 85), 1.5, 860]]
    [[(71, 95), 0.5, 861], [(67, 92), 0.5, 862], [(69, 88), 0.5, 863], [(65, 82), 0.5, 864], [(71, 82), 0.5, 865], [(62, 89), 0.5, 866], [(79, 99), 0.5, 867], [(72, 98), 0.5, 868], [(61, 97), 0.5, 869], [(70, 83), 0.5, 870], [(69, 87), 0.5, 871], [(65, 89), 0.5, 872], [(79, 94), 1.5, 873], [(69, 83), 1.5, 874], [(63, 83), 1.5, 875], [(70, 80), 1.5, 876], [(69, 91), 1.5, 877], [(65, 84), 1.5, 878], [(70, 96), 1.5, 879], [(61, 98), 1.5, 880]]
    [[(87, 95), 0.5, 881], [(83, 83), 0.5, 882], [(87, 81), 0.5, 883], [(80, 84), 0.5, 884], [(99, 94), 0.5, 885], [(94, 90), 0.5, 886], [(83, 94), 0.5, 887], [(92, 85), 0.5, 888], [(97, 88), 0.5, 889], [(82, 95), 0.5, 890], [(97, 96), 0.5, 891], [(95, 98), 0.5, 892], [(87, 99), 1.5, 893], [(95, 92), 1.5, 894], [(96, 97), 1.5, 895], [(95, 95), 1.5, 896], [(89, 99), 1.5, 897], [(93, 89), 1.5, 898], [(87, 84), 1.5, 899], [(99, 97), 1.5, 900]]
    [[(100, 93), 0.5, 901], [(102, 89), 0.5, 902], [(110, 92), 0.5, 903], [(110, 95), 0.5, 904], [(116, 83), 0.5, 905], [(108, 93), 0.5, 906], [(107, 83), 0.5, 907], [(100, 92), 0.5, 908], [(102, 89), 0.5, 909], [(113, 99), 0.5, 910], [(102, 97), 0.5, 911], [(100, 99), 0.5, 912], [(102, 81), 1.5, 913], [(117, 82), 1.5, 914], [(117, 91), 1.5, 915], [(109, 83), 1.5, 916], [(106, 83), 1.5, 917], [(114, 86), 1.5, 918], [(119, 99), 1.5, 919], [(102, 80), 1.5, 920]]
    [[(132, 80), 0.5, 921], [(127, 86), 0.5, 922], [(131, 84), 0.5, 923], [(121, 93), 0.5, 924], [(132, 92), 0.5, 925], [(126, 93), 0.5, 926], [(125, 95), 0.5, 927], [(137, 96), 0.5, 928], [(139, 87), 0.5, 929], [(136, 83), 0.5, 930], [(121, 87), 0.5, 931], [(122, 96), 0.5, 932], [(133, 93), 1.5, 933], [(127, 87), 1.5, 934], [(130, 96), 1.5, 935], [(133, 98), 1.5, 936], [(120, 95), 1.5, 937], [(122, 81), 1.5, 938], [(133, 88), 1.5, 939], [(121, 84), 1.5, 940]]
    [[(153, 95), 0.5, 941], [(149, 86), 0.5, 942], [(156, 87), 0.5, 943], [(150, 82), 0.5, 944], [(142, 98), 0.5, 945], [(145, 93), 0.5, 946], [(151, 88), 0.5, 947], [(155, 82), 0.5, 948], [(144, 91), 0.5, 949], [(147, 81), 0.5, 950], [(146, 88), 0.5, 951], [(142, 98), 0.5, 952], [(141, 90), 1.5, 953], [(146, 88), 1.5, 954], [(143, 86), 1.5, 955], [(154, 95), 1.5, 956], [(159, 87), 1.5, 957], [(154, 81), 1.5, 958], [(148, 91), 1.5, 959], [(152, 98), 1.5, 960]]
    [[(177, 80), 0.5, 961], [(175, 99), 0.5, 962], [(171, 97), 0.5, 963], [(174, 91), 0.5, 964], [(165, 85), 0.5, 965], [(174, 98), 0.5, 966], [(168, 80), 0.5, 967], [(167, 90), 0.5, 968], [(160, 96), 0.5, 969], [(179, 87), 0.5, 970], [(179, 97), 0.5, 971], [(178, 95), 0.5, 972], [(179, 97), 1.5, 973], [(175, 97), 1.5, 974], [(165, 85), 1.5, 975], [(167, 93), 1.5, 976], [(170, 82), 1.5, 977], [(175, 89), 1.5, 978], [(174, 93), 1.5, 979], [(160, 87), 1.5, 980]]
    [[(195, 93), 0.5, 981], [(180, 89), 0.5, 982], [(192, 80), 0.5, 983], [(180, 84), 0.5, 984], [(190, 99), 0.5, 985], [(191, 84), 0.5, 986], [(191, 84), 0.5, 987], [(183, 87), 0.5, 988], [(190, 95), 0.5, 989], [(193, 84), 0.5, 990], [(180, 84), 0.5, 991], [(194, 98), 0.5, 992], [(182, 83), 1.5, 993], [(196, 86), 1.5, 994], [(195, 84), 1.5, 995], [(199, 87), 1.5, 996], [(188, 83), 1.5, 997], [(184, 82), 1.5, 998], [(187, 82), 1.5, 999], [(190, 96), 1.5, 1000]]
    [[(18, 110), 0.5, 1001], [(8, 113), 0.5, 1002], [(9, 109), 0.5, 1003], [(10, 111), 0.5, 1004], [(16, 113), 0.5, 1005], [(10, 116), 0.5, 1006], [(14, 115), 0.5, 1007], [(8, 118), 0.5, 1008], [(17, 119), 0.5, 1009], [(16, 102), 0.5, 1010], [(5, 103), 0.5, 1011], [(2, 117), 0.5, 1012], [(17, 104), 1.5, 1013], [(9, 115), 1.5, 1014], [(14, 103), 1.5, 1015], [(3, 105), 1.5, 1016], [(5, 113), 1.5, 1017], [(8, 118), 1.5, 1018], [(13, 113), 1.5, 1019], [(16, 114), 1.5, 1020]]
    [[(30, 119), 0.5, 1021], [(32, 112), 0.5, 1022], [(27, 104), 0.5, 1023], [(26, 101), 0.5, 1024], [(31, 101), 0.5, 1025], [(20, 109), 0.5, 1026], [(36, 111), 0.5, 1027], [(20, 118), 0.5, 1028], [(36, 107), 0.5, 1029], [(26, 110), 0.5, 1030], [(26, 111), 0.5, 1031], [(35, 113), 0.5, 1032], [(32, 109), 1.5, 1033], [(35, 115), 1.5, 1034], [(24, 113), 1.5, 1035], [(29, 103), 1.5, 1036], [(36, 116), 1.5, 1037], [(25, 117), 1.5, 1038], [(35, 110), 1.5, 1039], [(31, 108), 1.5, 1040]]
    [[(58, 110), 0.5, 1041], [(52, 114), 0.5, 1042], [(44, 108), 0.5, 1043], [(55, 110), 0.5, 1044], [(44, 106), 0.5, 1045], [(43, 117), 0.5, 1046], [(42, 101), 0.5, 1047], [(47, 117), 0.5, 1048], [(56, 119), 0.5, 1049], [(54, 116), 0.5, 1050], [(59, 101), 0.5, 1051], [(55, 109), 0.5, 1052], [(51, 117), 1.5, 1053], [(59, 107), 1.5, 1054], [(44, 114), 1.5, 1055], [(53, 101), 1.5, 1056], [(49, 116), 1.5, 1057], [(50, 114), 1.5, 1058], [(59, 100), 1.5, 1059], [(59, 111), 1.5, 1060]]
    [[(77, 102), 0.5, 1061], [(66, 113), 0.5, 1062], [(63, 108), 0.5, 1063], [(76, 100), 0.5, 1064], [(69, 109), 0.5, 1065], [(72, 100), 0.5, 1066], [(63, 113), 0.5, 1067], [(66, 114), 0.5, 1068], [(77, 117), 0.5, 1069], [(68, 114), 0.5, 1070], [(64, 102), 0.5, 1071], [(78, 102), 0.5, 1072], [(75, 110), 1.5, 1073], [(72, 114), 1.5, 1074], [(61, 115), 1.5, 1075], [(69, 113), 1.5, 1076], [(71, 100), 1.5, 1077], [(66, 100), 1.5, 1078], [(75, 107), 1.5, 1079], [(62, 106), 1.5, 1080]]
    [[(98, 115), 0.5, 1081], [(90, 109), 0.5, 1082], [(88, 119), 0.5, 1083], [(97, 103), 0.5, 1084], [(80, 119), 0.5, 1085], [(84, 103), 0.5, 1086], [(80, 107), 0.5, 1087], [(94, 101), 0.5, 1088], [(91, 110), 0.5, 1089], [(96, 118), 0.5, 1090], [(83, 108), 0.5, 1091], [(90, 117), 0.5, 1092], [(82, 106), 1.5, 1093], [(94, 109), 1.5, 1094], [(83, 102), 1.5, 1095], [(82, 102), 1.5, 1096], [(85, 108), 1.5, 1097], [(83, 119), 1.5, 1098], [(91, 102), 1.5, 1099], [(93, 103), 1.5, 1100]]
    [[(115, 104), 0.5, 1101], [(112, 101), 0.5, 1102], [(107, 117), 0.5, 1103], [(115, 116), 0.5, 1104], [(100, 100), 0.5, 1105], [(118, 117), 0.5, 1106], [(118, 117), 0.5, 1107], [(108, 100), 0.5, 1108], [(110, 114), 0.5, 1109], [(107, 115), 0.5, 1110], [(114, 112), 0.5, 1111], [(113, 118), 0.5, 1112], [(103, 104), 1.5, 1113], [(119, 108), 1.5, 1114], [(119, 103), 1.5, 1115], [(109, 103), 1.5, 1116], [(101, 118), 1.5, 1117], [(104, 102), 1.5, 1118], [(101, 118), 1.5, 1119], [(103, 109), 1.5, 1120]]
    [[(120, 101), 0.5, 1121], [(130, 108), 0.5, 1122], [(123, 119), 0.5, 1123], [(121, 116), 0.5, 1124], [(123, 100), 0.5, 1125], [(137, 107), 0.5, 1126], [(134, 105), 0.5, 1127], [(121, 100), 0.5, 1128], [(120, 116), 0.5, 1129], [(138, 111), 0.5, 1130], [(124, 115), 0.5, 1131], [(135, 108), 0.5, 1132], [(128, 102), 1.5, 1133], [(121, 112), 1.5, 1134], [(128, 105), 1.5, 1135], [(136, 110), 1.5, 1136], [(122, 101), 1.5, 1137], [(132, 110), 1.5, 1138], [(131, 108), 1.5, 1139], [(134, 119), 1.5, 1140]]
    [[(140, 105), 0.5, 1141], [(153, 102), 0.5, 1142], [(150, 115), 0.5, 1143], [(157, 109), 0.5, 1144], [(146, 113), 0.5, 1145], [(157, 104), 0.5, 1146], [(147, 103), 0.5, 1147], [(155, 111), 0.5, 1148], [(152, 117), 0.5, 1149], [(142, 103), 0.5, 1150], [(156, 114), 0.5, 1151], [(150, 105), 0.5, 1152], [(153, 102), 1.5, 1153], [(159, 103), 1.5, 1154], [(146, 107), 1.5, 1155], [(141, 111), 1.5, 1156], [(158, 104), 1.5, 1157], [(157, 119), 1.5, 1158], [(144, 110), 1.5, 1159], [(154, 107), 1.5, 1160]]
    [[(177, 106), 0.5, 1161], [(172, 115), 0.5, 1162], [(167, 118), 0.5, 1163], [(169, 100), 0.5, 1164], [(165, 100), 0.5, 1165], [(167, 105), 0.5, 1166], [(179, 114), 0.5, 1167], [(170, 103), 0.5, 1168], [(164, 102), 0.5, 1169], [(163, 105), 0.5, 1170], [(179, 115), 0.5, 1171], [(164, 104), 0.5, 1172], [(167, 102), 1.5, 1173], [(176, 111), 1.5, 1174], [(164, 113), 1.5, 1175], [(167, 113), 1.5, 1176], [(178, 109), 1.5, 1177], [(170, 102), 1.5, 1178], [(168, 111), 1.5, 1179], [(173, 110), 1.5, 1180]]
    [[(196, 103), 0.5, 1181], [(193, 100), 0.5, 1182], [(184, 104), 0.5, 1183], [(184, 109), 0.5, 1184], [(193, 101), 0.5, 1185], [(193, 110), 0.5, 1186], [(193, 114), 0.5, 1187], [(197, 110), 0.5, 1188], [(187, 111), 0.5, 1189], [(189, 110), 0.5, 1190], [(195, 104), 0.5, 1191], [(196, 107), 0.5, 1192], [(190, 115), 1.5, 1193], [(180, 118), 1.5, 1194], [(192, 113), 1.5, 1195], [(194, 101), 1.5, 1196], [(186, 110), 1.5, 1197], [(191, 119), 1.5, 1198], [(196, 115), 1.5, 1199], [(190, 118), 1.5, 1200]]
    [[(15, 139), 0.5, 1201], [(4, 120), 0.5, 1202], [(1, 137), 0.5, 1203], [(12, 122), 0.5, 1204], [(0, 132), 0.5, 1205], [(17, 125), 0.5, 1206], [(18, 132), 0.5, 1207], [(0, 133), 0.5, 1208], [(13, 135), 0.5, 1209], [(0, 131), 0.5, 1210], [(8, 133), 0.5, 1211], [(12, 123), 0.5, 1212], [(16, 124), 1.5, 1213], [(14, 124), 1.5, 1214], [(18, 126), 1.5, 1215], [(18, 130), 1.5, 1216], [(16, 134), 1.5, 1217], [(4, 122), 1.5, 1218], [(18, 122), 1.5, 1219], [(0, 120), 1.5, 1220]]
    [[(24, 126), 0.5, 1221], [(33, 127), 0.5, 1222], [(32, 131), 0.5, 1223], [(31, 125), 0.5, 1224], [(37, 136), 0.5, 1225], [(28, 129), 0.5, 1226], [(25, 121), 0.5, 1227], [(22, 131), 0.5, 1228], [(32, 136), 0.5, 1229], [(25, 120), 0.5, 1230], [(36, 124), 0.5, 1231], [(21, 139), 0.5, 1232], [(31, 123), 1.5, 1233], [(27, 128), 1.5, 1234], [(36, 133), 1.5, 1235], [(26, 139), 1.5, 1236], [(27, 129), 1.5, 1237], [(39, 128), 1.5, 1238], [(31, 136), 1.5, 1239], [(20, 127), 1.5, 1240]]
    [[(43, 123), 0.5, 1241], [(51, 124), 0.5, 1242], [(41, 127), 0.5, 1243], [(47, 135), 0.5, 1244], [(41, 131), 0.5, 1245], [(45, 122), 0.5, 1246], [(54, 126), 0.5, 1247], [(50, 123), 0.5, 1248], [(58, 129), 0.5, 1249], [(40, 121), 0.5, 1250], [(53, 138), 0.5, 1251], [(50, 121), 0.5, 1252], [(51, 139), 1.5, 1253], [(58, 128), 1.5, 1254], [(55, 125), 1.5, 1255], [(41, 133), 1.5, 1256], [(52, 130), 1.5, 1257], [(47, 133), 1.5, 1258], [(42, 122), 1.5, 1259], [(54, 135), 1.5, 1260]]
    [[(74, 129), 0.5, 1261], [(70, 138), 0.5, 1262], [(72, 122), 0.5, 1263], [(70, 137), 0.5, 1264], [(72, 121), 0.5, 1265], [(74, 128), 0.5, 1266], [(60, 123), 0.5, 1267], [(77, 123), 0.5, 1268], [(66, 123), 0.5, 1269], [(73, 121), 0.5, 1270], [(66, 139), 0.5, 1271], [(67, 136), 0.5, 1272], [(60, 137), 1.5, 1273], [(73, 121), 1.5, 1274], [(78, 124), 1.5, 1275], [(74, 128), 1.5, 1276], [(72, 129), 1.5, 1277], [(78, 130), 1.5, 1278], [(77, 132), 1.5, 1279], [(71, 134), 1.5, 1280]]
    [[(96, 130), 0.5, 1281], [(81, 128), 0.5, 1282], [(88, 134), 0.5, 1283], [(88, 131), 0.5, 1284], [(96, 127), 0.5, 1285], [(86, 120), 0.5, 1286], [(80, 136), 0.5, 1287], [(89, 131), 0.5, 1288], [(80, 134), 0.5, 1289], [(85, 135), 0.5, 1290], [(86, 126), 0.5, 1291], [(92, 124), 0.5, 1292], [(88, 135), 1.5, 1293], [(95, 135), 1.5, 1294], [(88, 124), 1.5, 1295], [(85, 135), 1.5, 1296], [(80, 130), 1.5, 1297], [(88, 127), 1.5, 1298], [(94, 134), 1.5, 1299], [(86, 138), 1.5, 1300]]
    [[(109, 128), 0.5, 1301], [(101, 127), 0.5, 1302], [(118, 138), 0.5, 1303], [(107, 123), 0.5, 1304], [(102, 137), 0.5, 1305], [(115, 122), 0.5, 1306], [(118, 136), 0.5, 1307], [(118, 135), 0.5, 1308], [(114, 135), 0.5, 1309], [(119, 136), 0.5, 1310], [(112, 122), 0.5, 1311], [(109, 132), 0.5, 1312], [(118, 139), 1.5, 1313], [(115, 124), 1.5, 1314], [(111, 130), 1.5, 1315], [(119, 136), 1.5, 1316], [(111, 134), 1.5, 1317], [(102, 128), 1.5, 1318], [(107, 127), 1.5, 1319], [(103, 125), 1.5, 1320]]
    [[(133, 122), 0.5, 1321], [(125, 134), 0.5, 1322], [(138, 124), 0.5, 1323], [(132, 124), 0.5, 1324], [(139, 126), 0.5, 1325], [(137, 135), 0.5, 1326], [(134, 122), 0.5, 1327], [(134, 125), 0.5, 1328], [(125, 138), 0.5, 1329], [(120, 132), 0.5, 1330], [(137, 120), 0.5, 1331], [(135, 127), 0.5, 1332], [(121, 137), 1.5, 1333], [(126, 121), 1.5, 1334], [(126, 121), 1.5, 1335], [(129, 136), 1.5, 1336], [(126, 129), 1.5, 1337], [(130, 130), 1.5, 1338], [(127, 138), 1.5, 1339], [(131, 122), 1.5, 1340]]
    [[(143, 122), 0.5, 1341], [(150, 123), 0.5, 1342], [(140, 120), 0.5, 1343], [(140, 122), 0.5, 1344], [(147, 133), 0.5, 1345], [(144, 122), 0.5, 1346], [(145, 136), 0.5, 1347], [(143, 135), 0.5, 1348], [(159, 122), 0.5, 1349], [(151, 121), 0.5, 1350], [(151, 132), 0.5, 1351], [(151, 134), 0.5, 1352], [(140, 126), 1.5, 1353], [(157, 132), 1.5, 1354], [(156, 127), 1.5, 1355], [(159, 120), 1.5, 1356], [(140, 132), 1.5, 1357], [(147, 138), 1.5, 1358], [(153, 133), 1.5, 1359], [(149, 137), 1.5, 1360]]
    [[(169, 129), 0.5, 1361], [(176, 129), 0.5, 1362], [(169, 133), 0.5, 1363], [(179, 126), 0.5, 1364], [(164, 122), 0.5, 1365], [(166, 126), 0.5, 1366], [(175, 121), 0.5, 1367], [(172, 136), 0.5, 1368], [(168, 135), 0.5, 1369], [(178, 134), 0.5, 1370], [(171, 120), 0.5, 1371], [(171, 135), 0.5, 1372], [(169, 128), 1.5, 1373], [(172, 134), 1.5, 1374], [(175, 122), 1.5, 1375], [(160, 128), 1.5, 1376], [(161, 135), 1.5, 1377], [(163, 127), 1.5, 1378], [(173, 123), 1.5, 1379], [(167, 133), 1.5, 1380]]
    [[(196, 133), 0.5, 1381], [(199, 131), 0.5, 1382], [(182, 131), 0.5, 1383], [(184, 122), 0.5, 1384], [(184, 125), 0.5, 1385], [(196, 120), 0.5, 1386], [(188, 128), 0.5, 1387], [(191, 139), 0.5, 1388], [(197, 133), 0.5, 1389], [(195, 132), 0.5, 1390], [(187, 125), 0.5, 1391], [(184, 135), 0.5, 1392], [(199, 128), 1.5, 1393], [(193, 128), 1.5, 1394], [(194, 132), 1.5, 1395], [(182, 127), 1.5, 1396], [(195, 130), 1.5, 1397], [(198, 123), 1.5, 1398], [(194, 132), 1.5, 1399], [(197, 131), 1.5, 1400]]
    [[(3, 140), 0.5, 1401], [(16, 145), 0.5, 1402], [(12, 155), 0.5, 1403], [(2, 150), 0.5, 1404], [(0, 154), 0.5, 1405], [(1, 151), 0.5, 1406], [(3, 158), 0.5, 1407], [(4, 152), 0.5, 1408], [(18, 144), 0.5, 1409], [(12, 159), 0.5, 1410], [(5, 159), 0.5, 1411], [(4, 153), 0.5, 1412], [(18, 155), 1.5, 1413], [(5, 151), 1.5, 1414], [(10, 151), 1.5, 1415], [(6, 158), 1.5, 1416], [(9, 152), 1.5, 1417], [(19, 153), 1.5, 1418], [(4, 152), 1.5, 1419], [(1, 147), 1.5, 1420]]
    [[(30, 158), 0.5, 1421], [(24, 145), 0.5, 1422], [(23, 146), 0.5, 1423], [(29, 148), 0.5, 1424], [(21, 140), 0.5, 1425], [(23, 142), 0.5, 1426], [(37, 159), 0.5, 1427], [(28, 159), 0.5, 1428], [(39, 156), 0.5, 1429], [(31, 146), 0.5, 1430], [(32, 141), 0.5, 1431], [(28, 146), 0.5, 1432], [(25, 151), 1.5, 1433], [(23, 159), 1.5, 1434], [(20, 145), 1.5, 1435], [(33, 152), 1.5, 1436], [(29, 155), 1.5, 1437], [(39, 150), 1.5, 1438], [(22, 156), 1.5, 1439], [(32, 151), 1.5, 1440]]
    [[(42, 152), 0.5, 1441], [(55, 151), 0.5, 1442], [(41, 152), 0.5, 1443], [(49, 151), 0.5, 1444], [(53, 153), 0.5, 1445], [(56, 152), 0.5, 1446], [(49, 158), 0.5, 1447], [(59, 142), 0.5, 1448], [(45, 152), 0.5, 1449], [(43, 140), 0.5, 1450], [(45, 151), 0.5, 1451], [(49, 143), 0.5, 1452], [(47, 142), 1.5, 1453], [(53, 142), 1.5, 1454], [(46, 157), 1.5, 1455], [(55, 149), 1.5, 1456], [(53, 153), 1.5, 1457], [(56, 154), 1.5, 1458], [(50, 155), 1.5, 1459], [(40, 150), 1.5, 1460]]
    [[(74, 142), 0.5, 1461], [(76, 148), 0.5, 1462], [(66, 148), 0.5, 1463], [(60, 157), 0.5, 1464], [(67, 147), 0.5, 1465], [(70, 144), 0.5, 1466], [(78, 158), 0.5, 1467], [(77, 153), 0.5, 1468], [(67, 152), 0.5, 1469], [(65, 156), 0.5, 1470], [(71, 149), 0.5, 1471], [(63, 158), 0.5, 1472], [(74, 158), 1.5, 1473], [(62, 153), 1.5, 1474], [(75, 147), 1.5, 1475], [(64, 142), 1.5, 1476], [(70, 147), 1.5, 1477], [(77, 151), 1.5, 1478], [(75, 156), 1.5, 1479], [(66, 140), 1.5, 1480]]
    [[(99, 153), 0.5, 1481], [(97, 146), 0.5, 1482], [(97, 159), 0.5, 1483], [(88, 159), 0.5, 1484], [(96, 144), 0.5, 1485], [(97, 151), 0.5, 1486], [(92, 141), 0.5, 1487], [(89, 142), 0.5, 1488], [(83, 142), 0.5, 1489], [(97, 157), 0.5, 1490], [(87, 149), 0.5, 1491], [(94, 152), 0.5, 1492], [(84, 152), 1.5, 1493], [(91, 158), 1.5, 1494], [(89, 145), 1.5, 1495], [(88, 144), 1.5, 1496], [(94, 148), 1.5, 1497], [(86, 151), 1.5, 1498], [(97, 146), 1.5, 1499], [(83, 150), 1.5, 1500]]
    [[(106, 144), 0.5, 1501], [(117, 141), 0.5, 1502], [(104, 158), 0.5, 1503], [(117, 144), 0.5, 1504], [(117, 153), 0.5, 1505], [(112, 155), 0.5, 1506], [(114, 142), 0.5, 1507], [(105, 142), 0.5, 1508], [(113, 150), 0.5, 1509], [(100, 152), 0.5, 1510], [(111, 140), 0.5, 1511], [(101, 143), 0.5, 1512], [(108, 157), 1.5, 1513], [(100, 148), 1.5, 1514], [(114, 155), 1.5, 1515], [(109, 144), 1.5, 1516], [(101, 141), 1.5, 1517], [(107, 145), 1.5, 1518], [(108, 159), 1.5, 1519], [(104, 141), 1.5, 1520]]
    [[(133, 152), 0.5, 1521], [(122, 155), 0.5, 1522], [(138, 159), 0.5, 1523], [(130, 149), 0.5, 1524], [(130, 153), 0.5, 1525], [(133, 155), 0.5, 1526], [(138, 143), 0.5, 1527], [(138, 142), 0.5, 1528], [(127, 146), 0.5, 1529], [(121, 142), 0.5, 1530], [(127, 151), 0.5, 1531], [(123, 147), 0.5, 1532], [(120, 154), 1.5, 1533], [(125, 144), 1.5, 1534], [(129, 152), 1.5, 1535], [(124, 147), 1.5, 1536], [(130, 140), 1.5, 1537], [(127, 142), 1.5, 1538], [(136, 142), 1.5, 1539], [(129, 147), 1.5, 1540]]
    [[(147, 158), 0.5, 1541], [(140, 147), 0.5, 1542], [(150, 147), 0.5, 1543], [(149, 145), 0.5, 1544], [(149, 154), 0.5, 1545], [(151, 150), 0.5, 1546], [(141, 148), 0.5, 1547], [(153, 150), 0.5, 1548], [(148, 155), 0.5, 1549], [(156, 150), 0.5, 1550], [(157, 155), 0.5, 1551], [(154, 156), 0.5, 1552], [(142, 141), 1.5, 1553], [(146, 158), 1.5, 1554], [(143, 145), 1.5, 1555], [(142, 149), 1.5, 1556], [(145, 153), 1.5, 1557], [(144, 148), 1.5, 1558], [(157, 143), 1.5, 1559], [(155, 153), 1.5, 1560]]
    [[(167, 158), 0.5, 1561], [(162, 153), 0.5, 1562], [(179, 142), 0.5, 1563], [(169, 155), 0.5, 1564], [(174, 159), 0.5, 1565], [(162, 152), 0.5, 1566], [(160, 144), 0.5, 1567], [(178, 151), 0.5, 1568], [(179, 145), 0.5, 1569], [(166, 154), 0.5, 1570], [(166, 154), 0.5, 1571], [(174, 152), 0.5, 1572], [(167, 143), 1.5, 1573], [(161, 140), 1.5, 1574], [(165, 155), 1.5, 1575], [(170, 157), 1.5, 1576], [(169, 148), 1.5, 1577], [(171, 150), 1.5, 1578], [(163, 159), 1.5, 1579], [(178, 144), 1.5, 1580]]
    [[(194, 140), 0.5, 1581], [(189, 148), 0.5, 1582], [(199, 145), 0.5, 1583], [(198, 146), 0.5, 1584], [(183, 142), 0.5, 1585], [(197, 141), 0.5, 1586], [(193, 147), 0.5, 1587], [(196, 140), 0.5, 1588], [(187, 151), 0.5, 1589], [(181, 157), 0.5, 1590], [(185, 151), 0.5, 1591], [(198, 145), 0.5, 1592], [(190, 157), 1.5, 1593], [(184, 147), 1.5, 1594], [(181, 146), 1.5, 1595], [(191, 143), 1.5, 1596], [(197, 142), 1.5, 1597], [(183, 151), 1.5, 1598], [(184, 144), 1.5, 1599], [(199, 143), 1.5, 1600]]
    [[(8, 168), 0.5, 1601], [(4, 160), 0.5, 1602], [(5, 176), 0.5, 1603], [(15, 161), 0.5, 1604], [(6, 167), 0.5, 1605], [(14, 173), 0.5, 1606], [(17, 163), 0.5, 1607], [(0, 172), 0.5, 1608], [(19, 176), 0.5, 1609], [(11, 165), 0.5, 1610], [(3, 179), 0.5, 1611], [(6, 172), 0.5, 1612], [(12, 175), 1.5, 1613], [(16, 165), 1.5, 1614], [(11, 173), 1.5, 1615], [(18, 160), 1.5, 1616], [(11, 167), 1.5, 1617], [(18, 171), 1.5, 1618], [(1, 175), 1.5, 1619], [(12, 174), 1.5, 1620]]
    [[(29, 172), 0.5, 1621], [(29, 164), 0.5, 1622], [(24, 174), 0.5, 1623], [(22, 160), 0.5, 1624], [(38, 165), 0.5, 1625], [(29, 160), 0.5, 1626], [(21, 171), 0.5, 1627], [(37, 160), 0.5, 1628], [(30, 171), 0.5, 1629], [(22, 168), 0.5, 1630], [(35, 169), 0.5, 1631], [(26, 162), 0.5, 1632], [(20, 168), 1.5, 1633], [(20, 172), 1.5, 1634], [(29, 169), 1.5, 1635], [(31, 178), 1.5, 1636], [(28, 169), 1.5, 1637], [(30, 176), 1.5, 1638], [(21, 160), 1.5, 1639], [(32, 163), 1.5, 1640]]
    [[(43, 175), 0.5, 1641], [(46, 163), 0.5, 1642], [(48, 166), 0.5, 1643], [(41, 178), 0.5, 1644], [(46, 164), 0.5, 1645], [(41, 171), 0.5, 1646], [(41, 172), 0.5, 1647], [(57, 177), 0.5, 1648], [(41, 175), 0.5, 1649], [(51, 177), 0.5, 1650], [(57, 168), 0.5, 1651], [(44, 177), 0.5, 1652], [(52, 166), 1.5, 1653], [(40, 178), 1.5, 1654], [(50, 164), 1.5, 1655], [(54, 170), 1.5, 1656], [(52, 168), 1.5, 1657], [(58, 178), 1.5, 1658], [(49, 160), 1.5, 1659], [(56, 173), 1.5, 1660]]
    [[(72, 169), 0.5, 1661], [(79, 162), 0.5, 1662], [(71, 160), 0.5, 1663], [(65, 176), 0.5, 1664], [(64, 175), 0.5, 1665], [(72, 172), 0.5, 1666], [(77, 160), 0.5, 1667], [(72, 175), 0.5, 1668], [(62, 164), 0.5, 1669], [(68, 170), 0.5, 1670], [(66, 169), 0.5, 1671], [(79, 166), 0.5, 1672], [(64, 163), 1.5, 1673], [(72, 176), 1.5, 1674], [(72, 177), 1.5, 1675], [(78, 174), 1.5, 1676], [(67, 166), 1.5, 1677], [(67, 170), 1.5, 1678], [(64, 163), 1.5, 1679], [(77, 176), 1.5, 1680]]
    [[(87, 162), 0.5, 1681], [(91, 167), 0.5, 1682], [(84, 173), 0.5, 1683], [(99, 172), 0.5, 1684], [(93, 165), 0.5, 1685], [(88, 164), 0.5, 1686], [(90, 165), 0.5, 1687], [(86, 172), 0.5, 1688], [(82, 166), 0.5, 1689], [(83, 179), 0.5, 1690], [(80, 165), 0.5, 1691], [(80, 173), 0.5, 1692], [(95, 172), 1.5, 1693], [(91, 174), 1.5, 1694], [(87, 170), 1.5, 1695], [(98, 162), 1.5, 1696], [(82, 176), 1.5, 1697], [(99, 175), 1.5, 1698], [(87, 177), 1.5, 1699], [(93, 166), 1.5, 1700]]
    [[(106, 169), 0.5, 1701], [(112, 178), 0.5, 1702], [(118, 174), 0.5, 1703], [(117, 161), 0.5, 1704], [(102, 163), 0.5, 1705], [(100, 162), 0.5, 1706], [(117, 173), 0.5, 1707], [(110, 161), 0.5, 1708], [(114, 162), 0.5, 1709], [(114, 165), 0.5, 1710], [(113, 163), 0.5, 1711], [(113, 163), 0.5, 1712], [(108, 177), 1.5, 1713], [(109, 177), 1.5, 1714], [(110, 172), 1.5, 1715], [(118, 161), 1.5, 1716], [(106, 177), 1.5, 1717], [(108, 172), 1.5, 1718], [(101, 170), 1.5, 1719], [(116, 175), 1.5, 1720]]
    [[(126, 171), 0.5, 1721], [(129, 173), 0.5, 1722], [(130, 173), 0.5, 1723], [(127, 165), 0.5, 1724], [(138, 179), 0.5, 1725], [(122, 164), 0.5, 1726], [(122, 169), 0.5, 1727], [(133, 175), 0.5, 1728], [(132, 165), 0.5, 1729], [(123, 174), 0.5, 1730], [(135, 168), 0.5, 1731], [(129, 161), 0.5, 1732], [(130, 170), 1.5, 1733], [(121, 162), 1.5, 1734], [(127, 166), 1.5, 1735], [(121, 179), 1.5, 1736], [(126, 175), 1.5, 1737], [(128, 163), 1.5, 1738], [(130, 165), 1.5, 1739], [(138, 165), 1.5, 1740]]
    [[(144, 163), 0.5, 1741], [(149, 170), 0.5, 1742], [(141, 178), 0.5, 1743], [(146, 171), 0.5, 1744], [(149, 175), 0.5, 1745], [(148, 163), 0.5, 1746], [(150, 178), 0.5, 1747], [(140, 162), 0.5, 1748], [(148, 169), 0.5, 1749], [(148, 173), 0.5, 1750], [(151, 179), 0.5, 1751], [(159, 168), 0.5, 1752], [(147, 165), 1.5, 1753], [(147, 160), 1.5, 1754], [(153, 176), 1.5, 1755], [(148, 163), 1.5, 1756], [(152, 167), 1.5, 1757], [(141, 164), 1.5, 1758], [(142, 166), 1.5, 1759], [(141, 161), 1.5, 1760]]
    [[(171, 174), 0.5, 1761], [(179, 169), 0.5, 1762], [(168, 177), 0.5, 1763], [(166, 164), 0.5, 1764], [(169, 177), 0.5, 1765], [(163, 164), 0.5, 1766], [(173, 176), 0.5, 1767], [(163, 176), 0.5, 1768], [(174, 167), 0.5, 1769], [(163, 163), 0.5, 1770], [(166, 163), 0.5, 1771], [(160, 176), 0.5, 1772], [(176, 175), 1.5, 1773], [(162, 175), 1.5, 1774], [(165, 164), 1.5, 1775], [(167, 171), 1.5, 1776], [(160, 178), 1.5, 1777], [(160, 160), 1.5, 1778], [(171, 163), 1.5, 1779], [(167, 165), 1.5, 1780]]
    [[(188, 171), 0.5, 1781], [(190, 174), 0.5, 1782], [(195, 175), 0.5, 1783], [(186, 163), 0.5, 1784], [(180, 168), 0.5, 1785], [(181, 172), 0.5, 1786], [(182, 167), 0.5, 1787], [(182, 165), 0.5, 1788], [(187, 165), 0.5, 1789], [(185, 163), 0.5, 1790], [(188, 177), 0.5, 1791], [(192, 178), 0.5, 1792], [(194, 172), 1.5, 1793], [(199, 177), 1.5, 1794], [(191, 161), 1.5, 1795], [(180, 173), 1.5, 1796], [(185, 174), 1.5, 1797], [(182, 168), 1.5, 1798], [(180, 165), 1.5, 1799], [(180, 173), 1.5, 1800]]
    [[(14, 197), 0.5, 1801], [(17, 184), 0.5, 1802], [(0, 196), 0.5, 1803], [(3, 182), 0.5, 1804], [(3, 182), 0.5, 1805], [(18, 196), 0.5, 1806], [(12, 195), 0.5, 1807], [(12, 188), 0.5, 1808], [(10, 192), 0.5, 1809], [(4, 191), 0.5, 1810], [(12, 191), 0.5, 1811], [(17, 197), 0.5, 1812], [(14, 180), 1.5, 1813], [(1, 180), 1.5, 1814], [(14, 192), 1.5, 1815], [(7, 196), 1.5, 1816], [(1, 188), 1.5, 1817], [(7, 187), 1.5, 1818], [(15, 180), 1.5, 1819], [(19, 180), 1.5, 1820]]
    [[(24, 192), 0.5, 1821], [(30, 190), 0.5, 1822], [(23, 196), 0.5, 1823], [(38, 188), 0.5, 1824], [(31, 182), 0.5, 1825], [(22, 194), 0.5, 1826], [(31, 189), 0.5, 1827], [(27, 187), 0.5, 1828], [(25, 187), 0.5, 1829], [(22, 180), 0.5, 1830], [(38, 181), 0.5, 1831], [(37, 185), 0.5, 1832], [(33, 193), 1.5, 1833], [(35, 191), 1.5, 1834], [(22, 199), 1.5, 1835], [(32, 187), 1.5, 1836], [(29, 184), 1.5, 1837], [(26, 188), 1.5, 1838], [(21, 194), 1.5, 1839], [(30, 199), 1.5, 1840]]
    [[(45, 198), 0.5, 1841], [(48, 187), 0.5, 1842], [(55, 182), 0.5, 1843], [(46, 183), 0.5, 1844], [(57, 188), 0.5, 1845], [(56, 192), 0.5, 1846], [(42, 188), 0.5, 1847], [(43, 190), 0.5, 1848], [(50, 197), 0.5, 1849], [(48, 191), 0.5, 1850], [(44, 188), 0.5, 1851], [(46, 196), 0.5, 1852], [(49, 183), 1.5, 1853], [(59, 182), 1.5, 1854], [(59, 186), 1.5, 1855], [(56, 189), 1.5, 1856], [(56, 196), 1.5, 1857], [(48, 182), 1.5, 1858], [(45, 189), 1.5, 1859], [(54, 185), 1.5, 1860]]
    [[(70, 196), 0.5, 1861], [(69, 182), 0.5, 1862], [(71, 189), 0.5, 1863], [(60, 198), 0.5, 1864], [(73, 198), 0.5, 1865], [(60, 188), 0.5, 1866], [(71, 195), 0.5, 1867], [(68, 182), 0.5, 1868], [(76, 192), 0.5, 1869], [(64, 193), 0.5, 1870], [(65, 184), 0.5, 1871], [(63, 193), 0.5, 1872], [(69, 182), 1.5, 1873], [(70, 184), 1.5, 1874], [(76, 194), 1.5, 1875], [(73, 197), 1.5, 1876], [(60, 191), 1.5, 1877], [(78, 196), 1.5, 1878], [(72, 193), 1.5, 1879], [(67, 186), 1.5, 1880]]
    [[(97, 181), 0.5, 1881], [(82, 197), 0.5, 1882], [(94, 193), 0.5, 1883], [(96, 182), 0.5, 1884], [(89, 196), 0.5, 1885], [(96, 194), 0.5, 1886], [(90, 186), 0.5, 1887], [(86, 193), 0.5, 1888], [(91, 183), 0.5, 1889], [(82, 191), 0.5, 1890], [(97, 184), 0.5, 1891], [(87, 197), 0.5, 1892], [(82, 198), 1.5, 1893], [(83, 196), 1.5, 1894], [(97, 189), 1.5, 1895], [(96, 198), 1.5, 1896], [(94, 186), 1.5, 1897], [(91, 189), 1.5, 1898], [(95, 183), 1.5, 1899], [(99, 187), 1.5, 1900]]
    [[(114, 187), 0.5, 1901], [(106, 198), 0.5, 1902], [(108, 194), 0.5, 1903], [(103, 189), 0.5, 1904], [(107, 186), 0.5, 1905], [(117, 189), 0.5, 1906], [(106, 184), 0.5, 1907], [(112, 196), 0.5, 1908], [(113, 194), 0.5, 1909], [(110, 183), 0.5, 1910], [(100, 186), 0.5, 1911], [(105, 183), 0.5, 1912], [(112, 181), 1.5, 1913], [(102, 192), 1.5, 1914], [(112, 182), 1.5, 1915], [(104, 186), 1.5, 1916], [(109, 196), 1.5, 1917], [(107, 191), 1.5, 1918], [(113, 186), 1.5, 1919], [(119, 197), 1.5, 1920]]
    [[(139, 181), 0.5, 1921], [(129, 183), 0.5, 1922], [(130, 188), 0.5, 1923], [(129, 193), 0.5, 1924], [(128, 186), 0.5, 1925], [(131, 191), 0.5, 1926], [(132, 191), 0.5, 1927], [(127, 197), 0.5, 1928], [(134, 182), 0.5, 1929], [(136, 190), 0.5, 1930], [(128, 195), 0.5, 1931], [(137, 190), 0.5, 1932], [(131, 190), 1.5, 1933], [(131, 189), 1.5, 1934], [(128, 195), 1.5, 1935], [(120, 198), 1.5, 1936], [(121, 189), 1.5, 1937], [(131, 191), 1.5, 1938], [(121, 180), 1.5, 1939], [(128, 197), 1.5, 1940]]
    [[(155, 196), 0.5, 1941], [(145, 184), 0.5, 1942], [(153, 187), 0.5, 1943], [(148, 190), 0.5, 1944], [(142, 185), 0.5, 1945], [(154, 195), 0.5, 1946], [(149, 199), 0.5, 1947], [(142, 198), 0.5, 1948], [(153, 185), 0.5, 1949], [(152, 194), 0.5, 1950], [(157, 190), 0.5, 1951], [(146, 190), 0.5, 1952], [(147, 194), 1.5, 1953], [(149, 187), 1.5, 1954], [(159, 184), 1.5, 1955], [(152, 188), 1.5, 1956], [(141, 195), 1.5, 1957], [(144, 195), 1.5, 1958], [(147, 182), 1.5, 1959], [(154, 184), 1.5, 1960]]
    [[(171, 192), 0.5, 1961], [(179, 193), 0.5, 1962], [(170, 198), 0.5, 1963], [(178, 197), 0.5, 1964], [(174, 192), 0.5, 1965], [(175, 196), 0.5, 1966], [(175, 198), 0.5, 1967], [(171, 198), 0.5, 1968], [(175, 188), 0.5, 1969], [(169, 199), 0.5, 1970], [(176, 192), 0.5, 1971], [(171, 182), 0.5, 1972], [(176, 182), 1.5, 1973], [(161, 199), 1.5, 1974], [(163, 185), 1.5, 1975], [(179, 188), 1.5, 1976], [(176, 184), 1.5, 1977], [(169, 192), 1.5, 1978], [(177, 194), 1.5, 1979], [(164, 187), 1.5, 1980]]
    [[(193, 194), 0.5, 1981], [(196, 187), 0.5, 1982], [(193, 181), 0.5, 1983], [(190, 189), 0.5, 1984], [(195, 192), 0.5, 1985], [(182, 198), 0.5, 1986], [(182, 196), 0.5, 1987], [(197, 195), 0.5, 1988], [(180, 185), 0.5, 1989], [(196, 185), 0.5, 1990], [(189, 192), 0.5, 1991], [(192, 188), 0.5, 1992], [(191, 198), 1.5, 1993], [(183, 187), 1.5, 1994], [(198, 199), 1.5, 1995], [(182, 183), 1.5, 1996], [(198, 187), 1.5, 1997], [(195, 180), 1.5, 1998], [(198, 184), 1.5, 1999], [(193, 197), 1.5, 2000]]

### now we got the points perfectly,so what remains is ploting

```python
import numpy as np
x = [[] for i in range(len(Et))]
y = [[] for i in range(len(Et))]
for i in zonespoints:
    for j in i:
        for k in range(len(Et)):
            if Et[k] == j[1]:
                x[k].append(j[0][0])
                y[k].append(j[0][1])

#print(x,y)
fig = plt.figure(figsize=(50, 50))#defining size
ax1 = fig.add_subplot(2,2,1)#adding a plot to figure

spacing = D # This can be your user specified spacing.
minorLocator = MultipleLocator(spacing)
# jet = plt.get_cmap('jet')
# colors = iter(jet(np.linspace(0,1,10)))
colors = ['b','r','g','c','m','y','k','w']
for i in range(0,len(x),1):
    ax1.plot(x[i],y[i], 'o',color = colors[i])
# Set minor tick locations.
ax1.yaxis.set_minor_locator(minorLocator)
ax1.xaxis.set_minor_locator(minorLocator)

plt.axis([0, L, 0, L])#defining axix x and y
# Set grid to use minor tick locations.

ax1.grid(which = 'minor')#only major works fine

plt.show()
```

```python
#for each corner place a EH node
EH = []
for i in range(0,L+1,20):
    for j in range(0,L+1,20):
        EH.append((i,j))
print(EH)

EHx = []
EHy = []
for j in EH:
    EHx.append(j[0])
    EHy.append(j[1])

print(EHx,EHy)
```

    [(0, 0), (0, 20), (0, 40), (0, 60), (0, 80), (0, 100), (0, 120), (0, 140), (0, 160), (0, 180), (0, 200), (20, 0), (20, 20), (20, 40), (20, 60), (20, 80), (20, 100), (20, 120), (20, 140), (20, 160), (20, 180), (20, 200), (40, 0), (40, 20), (40, 40), (40, 60), (40, 80), (40, 100), (40, 120), (40, 140), (40, 160), (40, 180), (40, 200), (60, 0), (60, 20), (60, 40), (60, 60), (60, 80), (60, 100), (60, 120), (60, 140), (60, 160), (60, 180), (60, 200), (80, 0), (80, 20), (80, 40), (80, 60), (80, 80), (80, 100), (80, 120), (80, 140), (80, 160), (80, 180), (80, 200), (100, 0), (100, 20), (100, 40), (100, 60), (100, 80), (100, 100), (100, 120), (100, 140), (100, 160), (100, 180), (100, 200), (120, 0), (120, 20), (120, 40), (120, 60), (120, 80), (120, 100), (120, 120), (120, 140), (120, 160), (120, 180), (120, 200), (140, 0), (140, 20), (140, 40), (140, 60), (140, 80), (140, 100), (140, 120), (140, 140), (140, 160), (140, 180), (140, 200), (160, 0), (160, 20), (160, 40), (160, 60), (160, 80), (160, 100), (160, 120), (160, 140), (160, 160), (160, 180), (160, 200), (180, 0), (180, 20), (180, 40), (180, 60), (180, 80), (180, 100), (180, 120), (180, 140), (180, 160), (180, 180), (180, 200), (200, 0), (200, 20), (200, 40), (200, 60), (200, 80), (200, 100), (200, 120), (200, 140), (200, 160), (200, 180), (200, 200)]
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200] [0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200]

```python
import numpy as np
x = [[] for i in range(len(Et))]
y = [[] for i in range(len(Et))]
for i in zonespoints:
    for j in i:
        for k in range(len(Et)):
            if Et[k] == j[1]:
                x[k].append(j[0][0])
                y[k].append(j[0][1])

#for each corner place a EH node
EH = []
for i in range(0,L+1,20):
    for j in range(0,L+1,20):
        EH.append((i,j))
#print(EH)

EHx = []
EHy = []
for j in EH:
    EHx.append(j[0])
    EHy.append(j[1])

#print(EHx,EHy)
#print(x,y)
fig = plt.figure(figsize=(50, 50))#defining size
ax1 = fig.add_subplot(2,2,1)#adding a plot to figure

spacing = D # This can be your user specified spacing.
minorLocator = MultipleLocator(spacing)
# jet = plt.get_cmap('jet')
# colors = iter(jet(np.linspace(0,1,10)))
colors = ['g','r','c','m','y','k','b']
for i in range(0,len(x),1):
    ax1.plot(x[i],y[i], 'o',color = colors[i])

ax1.plot(EHx,EHy, 'D',color = colors[len(colors)-1],markersize=12)
# Set minor tick locations.
ax1.yaxis.set_minor_locator(minorLocator)
ax1.xaxis.set_minor_locator(minorLocator)

plt.axis([0, L, 0, L])#defining axix x and y
# Set grid to use minor tick locations.

ax1.grid(which = 'minor')#only major works fine

plt.show()
```

### At last placing of LBS

for each bs in LBS

    place them in predefined location

# multi stage weighted election heuristic method

### Intro(may help me in understanding)
SEES introduces a new election heuristic for choosing a set of
nodes called ZAG (Zone Aggregation Group) in every zone.
The task of ZAG is to collect data from other member nodes,
perform the data aggregation and forward to the EH relay
nodes. We call this heuristic as MSWE

1) MSWE is a general solution that supports up to
m different parameters ( p = p1, p2, p3,…, pm ) arranged in m
different levels of importance ( g = g1, g2, g3,…, gm ).

2) However,
it selects ZAG in m consecutive stages (stage-1, stage-2,
stage-3, ..., stage-m) based on a set of given weights of importance
( w = w1, w2, w3,…, wm ). In each stage, one of the given
parameters is taken as the dominant parameter (most important
parameter) and is given the highest weight (in a stage-i,
the dominant parameter is pi and is given w1 ).

3) MSWE runs in
two main procedures: (1) electing the ZAG member nodes, and
(2) assigning some of ZAG member nodes as zone aggregators
( ZAs ) for the current transmission round.

SEES provides a general model to generate the set of
weights w used in MSWE. The weight wi assigned to the
parameter in the importance level gi is given according to
the following formula:

                            wi = 𝜇 × wi−1, for i = 2, 3,…,m and 0 < 𝜇 ≤ 1

                            where w1 + w2 + w3 +...+ wm = 1

𝜇 is the weighting factor defined in advance by the
administrator based on some considerations (e.g., application
nature and election parameters used).

```python
#from simulation parameters we get 𝜇 value
𝜇 = float(input("Enter the 𝜇 value"))
m = int(input("Enter m value"))# number of stages
print(𝜇,m)
```

    Enter the 𝜇 value0.8
    Enter m value4
    0.8 4

                                        w2 = 𝜇 × w1 = pow(𝜇,1) × w1
                                        w3 = 𝜇 × w2 = 𝜇 × 𝜇 × w1 = pow(𝜇,2) × w1
                                        w4 = 𝜇 × w3 = 𝜇 × 𝜇 × 𝜇 × w1 = pow(𝜇,3) × w1

                                        wi = pow(𝜇,i−1) × w1

                                        w1 + w2 + w3 +⋯+ wm = 1

                                        w1 + 𝜇 × w1 + pow(𝜇,2) × w1 +⋯+ pow(𝜇,m−1) × w1 = 1

                                        w1 =  1/(1+𝜇+pow(𝜇,2)+....+pow(𝜇,m))

```python
#finding initial weight
sum = 0
for i in range(0,m):
    sum =sum + math.pow(𝜇,i)

w1 = 1/sum

print(sum,w1)

weights = [w1]

#for remaining weight

for i in range(1,m):
    weights.append(𝜇*weights[i-1])

print(weights)#these weigths are used in every stage of ZAG election without any change in their value

weights[:] = [round(weights[i],2) for i in range(len(weights))]
print(weights)
#testing condition ,mah.fsum is used for computing sum of float values
if (math.fsum(weights) == 1):
    print("No Error in weights")
else:
    print("Error in weights")
```

    2.9520000000000004 0.3387533875338753
    [0.3387533875338753, 0.27100271002710025, 0.2168021680216802, 0.17344173441734417]
    [0.34, 0.27, 0.22, 0.17]
    No Error in weights

there are actually 3 parameters that are to be considered

    residual energy
    centrality
    distance to the nearest relay node

hybrid-placement algo step by step implementation.ipynb


# Inference example for trained 2D U-Net model on BraTS.
Takes a trained model and performs inference on a few validation examples.

```python
import sys
import platform
print("Python version:\n", sys.version)
print ("Path to the python executable:\n", sys.executable)
```

```python
%matplotlib inline
import os
import psutil
import numpy as np
import keras as K
import h5py
import time
import tensorflow as tf
import sys; sys.argv=['']; del sys

from argparser import args
from model import unet

if args.keras_api:
    import keras as K
else:
    from tensorflow import keras as K

import matplotlib.pyplot as plt

onnx=False
plot_result = True
#TODO - Enable nGraph Bridge - Switch to (decathlon) venv!
# import ngraph_bridge

if onnx:
    #TODO - Include ngraph onnx backend
    import onnx
    from ngraph_onnx.onnx_importer.importer import import_onnx_model
    import ngraph as ng

print ("We are using Tensorflow version", tf.__version__,\
       "with Intel(R) MKL", "enabled" if tf.pywrap_tensorflow.IsMklEnabled() else "disabled",)
```

```python
# Create output directory for images
png_directory = "inference_examples"
if not os.path.exists(png_directory):
    os.makedirs(png_directory)

data_filename = os.path.join(args.data_path, args.data_filename)
model_filename = os.path.join(args.output_path, args.inference_filename)
```

#### Define the DICE coefficient and loss function

The Sørensen–Dice coefficient is a statistic used for comparing the similarity of two samples. Given two sets, X and Y, it is defined as

\begin{equation}
dice = \frac{2|X\cap Y|}{|X|+|Y|}
\end{equation}

```python
def calc_dice(target, prediction, smooth=0.01):
    """
    Sorensen Dice coefficient
    """
    prediction = np.round(prediction)

    numerator = 2.0 * np.sum(target * prediction) + smooth
    denominator = np.sum(target) + np.sum(prediction) + smooth
    coef = numerator / denominator

    return coef

def calc_soft_dice(target, prediction, smooth=0.01):
    """
    Sorensen (Soft) Dice coefficient - Don't round preictions
    """
    numerator = 2.0 * np.sum(target * prediction) + smooth
    denominator = np.sum(target) + np.sum(prediction) + smooth
    coef = numerator / denominator

    return coef
```

## Inference Time!

Inferencing in this example can be done in 3 simple steps:
1. Load the data
1. Load the Keras model
1. Perform a `model.predict` on an input image (or set of images)

#### Step 1 : Load data

```python
df = h5py.File(data_filename, "r")
imgs_testing = df["imgs_testing"]
msks_testing = df["msks_testing"]
files_testing = df["testing_input_files"]
```

#### Step 2 : Load the model

```python
unet_model = unet()
model = unet_model. ... # TODO: Check load_model definition, i.e explore model.py
```

#### Step 3 (final step): Perform prediction with `model.predict`

We first define a convenience function that performs a prediction on one image. This function takes an image ID and a flag `plot_result` which we can use to toggle displaying the results graphically.

After we have performed a prediction, we calculate the dice score to analyze how good out prediction was compared to the ground truth.

```python
def plot_results(model, imgs_validation, msks_validation, img_no, png_directory):

    img = imgs_validation[[img_no], ]
    msk = msks_validation[[img_no], ]

    #TODO load onnx model in ngraph
    if onnx:
        onnx_protobuf = onnx.load('./output/unet_model_for_decathlon_100_iter.onnx')
        ng_models = import_onnx_model(onnx_protobuf)
        ng_model = ng_models[0]
        runtime = ng.runtime(backend_name='CPU')
        unet = runtime.computation(ng_model['output'], *ng_model['inputs'])

        start_time = time.time()
        pred_mask= unet(img)[0]
        print ("Time for prediction ngraph: ", '%.0f'%((time.time()-start_time)*1000),"ms")

    else:
        start_time = time.time()
        pred_mask = ... # TODO: How do I use Keras to perform predicitons/inferencing? Params: (img, verbose=0, steps=None)
        print ("Time for prediction TF: ", '%.0f'%((time.time()-start_time)*1000),"ms")

    if args.plot:
        plt.figure(figsize=(10, 10))
        plt.subplot(1, 3, 1)
        plt.imshow(img[0, :, :, 0], cmap="bone", origin="lower")
        plt.title("MRI")
        plt.axis("off")
        plt.subplot(1, 3, 2)
        plt.imshow(msk[0, :, :, 0], origin="lower")
        plt.title("Ground Truth")
        plt.axis("off")
        plt.subplot(1, 3, 3)
        plt.imshow(pred_mask[0, :, :, 0], origin="lower")
        plt.title("Prediction\n(Dice = {:.4f})".format(calc_dice(msk, pred_mask)))
        plt.axis("off")

        png_filename = os.path.join(png_directory, "pred_{}.png".format(img_no))
        plt.savefig(png_filename, bbox_inches="tight", pad_inches=0)
        print("Dice {:.4f}, Soft Dice {:.4f}, Saved png file to: {}".format(
            calc_dice(msk, pred_mask), calc_soft_dice(msk, pred_mask), png_filename))
```

#### Step 3 (continued) : Perform prediction on some images.
Use `plot_result=True/False` to toggle plotting the results. If `plot_result=True`, the prediction results will be saved in the output directory for images, which is defined by the `png_directory` variable.

```python
indicies_validation = [40, 63, 43, 55, 99, 101, 19, 46, ] #[40]

for idx in indicies_validation:
    plot_results(model, imgs_testing, msks_testing,
                 idx, args.output_pngs)
```

# Can we perform inference even faster? Hmm..

Let's find out. Move on the the next tutorial section.

`Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. SPDX-License-Identifier: EPL-2.0`

`Copyright (c) 2019 Intel Corporation`


```python
%load_ext autoreload
```

```python
%autoreload 2
```

```python
%matplotlib inline
```

```python
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sn

import pycollocation
```

Textbook example: Ramsey-Cass-Koopmans model

 Household behavior

Suppose that there exist a representative household with the following lifetime utility...

$$U \equiv \int_{t=0}^{\infty} e^{-\rho t}u(c(t))N(t)dt$$

...where the flow utility function $u(C(t))$ is assumed to be a concave function of per capita consumption, $c(t)$. Note that $N(t)$, the size of the household, is assumed to grow at a constant and exogenous rate $n$:

$$ N(t) = N(0)e^{nt}.$$

At each instant in time, the representative household faces the following budget constraint...

$$\dot{K}(t) = r(t)K(t) + W(t)lN(t) - P(t)c(t)N(t)$$

...where $r(t)$ is the real interest rate, $K(t)$ is the total amount of household capital; $W(t)$ is the real wage paid for labor, $l$ is the household's labor endowment; $P(t)$ is the price level of the consumption good (which we are free to normalize to 1 for convenience).

 Solution to the household problem

Form the Hamiltonian...

$$ H(t, K, c, \lambda) \equiv e^{-\rho t}u(c(t))N(t) + \lambda(t)\bigg[r(t)K(t) + W(t)lN(t) - c(t)N(t)\bigg] $$

...differentiate with respect to control variables $c$ and the state variable $K$...

\begin{align}
    \frac{\partial H}{\partial c} \equiv& e^{-\rho t}\frac{\partial u}{\partial c}N(t) - \lambda(t)N(t) \\
    \frac{\partial H}{\partial K} \equiv& r(t)\lambda(t)
\end{align}

...the state and co-state equations are...

\begin{align}
    \dot{K}(t) = \frac{\partial H}{\partial \lambda} =& r(t)K(t) + W(t)lN(t) - c(t)N(t) \\
    \dot{\lambda} = -\frac{\partial H}{\partial K} =& -r(t)\lambda(t)\\
\end{align}

 Derivation of the Euler equation

From first-order condition for $c$ we have that...

$$ e^{-\rho t}\frac{\partial u}{\partial c}=\lambda(t) $$

...differentiate with respect to time...

$$ -\rho e^{-\rho t}\frac{\partial u}{\partial c} + e^{-\rho t}\frac{\partial^2 u}{\partial c^2}\dot{c}(t)=\dot{\lambda}(t)$$

...using the co-state equation we can write...

$$ -\rho e^{-\rho t}\frac{\partial u}{\partial c} + e^{-\rho t}\frac{\partial^2 u}{\partial c^2}\dot{c}(t)=-r(t)\lambda(t)$$

...using the first-order condition again we can write...

$$ -\rho e^{-\rho t}\frac{\partial u}{\partial c} + e^{-\rho t}\frac{\partial^2 u}{\partial c^2}\dot{c}(t)=-r(t)e^{-\rho t}\frac{\partial u}{\partial c}$$

...finally, after a bit of algebra we find that the consumption behavior of the representative household is described by the following Euler equation...

$$ \frac{\dot{c}(t)}{c(t)} = \frac{1}{RRA(c(t))}\bigg[r(t) - \rho\bigg] $$

...where...

$$ RRA(c(t)) = -\frac{c\frac{\partial^2 u}{\partial c^2}}{\frac{\partial u}{\partial c}}$$

...is the Pratt-Arrow measure of relative risk aversion. Consumption Euler equation says that consumption growth is proportional to the gap between the real interest rate $r(t)$ and the discount rate $\rho$; and inversely proportional to risk preferences.

Firm behavior

Inputs to production are capital, $K$, labor, $L$, and technology, $A$. Representative firm has a production function, $F$, that is homogenous of degree 1...

\begin{equation}
    Y(t) = F\bigg(A(t), K(t), L(t)\bigg)
\end{equation}

...note that technology, $A$, is assumed to grow at a constant, exogenous rate $g$

$$ A(t) = A(0)e^{gt}. $$

Firms choose demands for $K$ and $L$ in order to maximise profits...

\begin{align}
    \Pi(t) =& P(t)Y(t) - (r(t) + \delta)K(t) - W(t)L(t) \\
    =& F\bigg(A(t), K(t), L(t)\bigg) - (r(t) + \delta)K(t) - W(t)L(t)
\end{align}

Standard assumptions of perfect competition in factor markets as well as the production of output goods implies that inputs to production are paid their marginal products.  Thus the real interest rate $r(t)$ and the wage, $W(t)$ are...

\begin{align}
    r(t) =& \frac{\partial F}{\partial K} - \delta \\
    W(t) =& \frac{\partial F}{\partial L}.
\end{align}

Note that our homogeneity assumption on $F$ combined with Euler's other theorem are enough to insure that the representative firm earns zero profit...

$$ \Pi(t) = F\bigg(A(t), K(t), L(t)\bigg) - \bigg[K\frac{\partial F}{\partial K} + L\frac{\partial F}{\partial L}\bigg] = 0. $$

 Market clearing equilibrium

Impose market clearing equilibrium assumption for capital and labor markets (market for consumption goods clears by Walras Law). In particular for the labor market...

$$ \text{labor demand} \equiv L(t) = lN(t) \equiv \text{labor supply}. $$

Note that the explicit assumption of market clearing equilibrium really imposes two implicit assumptions:

 Dynamic adjustment processes necessary to actually clear markets occur at time scales that are very small relevant to the time scale of the model.

 ??

Assumption that factor markets clear allows us to combine household and firm behavior to get a system of ordinary differential equations...

\begin{align}
    \dot{c}(t) =& \frac{1}{ARA(c(t))}\bigg[\frac{\partial F}{\partial K} - \delta - \rho\bigg] \\
    \dot{K}(t) =& F\bigg(A(t), K(t), lN(t)\bigg) - \delta K(t) - c(t)N(t) \\
\end{align}

...where...

$$ ARA(c(t)) = -\frac{\frac{\partial^2 u}{\partial c^2}}{\frac{\partial u}{\partial c}}$$

...is the Pratt-Arrow measure of absolute risk aversion.

 De-trending the model

Recall that technology and household size (i.e., population!) are growing at exogenous rates.  Want to de-trend the model so that we can analyze fixed point equilibrium of the dynamical system.

Homogeneity assumption on $F$ tells us that...

$$\frac{1}{A(t)N(t)}F\bigg(A(t), K(t), lN(t)\bigg) = F\bigg(1, \frac{K(t)}{A(t)N(t)}, l\bigg) = f(k(t)) $$

...and...

$$ \frac{\partial F}{\partial K} = \frac{\partial F}{\partial K}\bigg(1, \frac{K(t)}{A(t)N(t)}, l\bigg) = \frac{\partial f}{\partial k} = f'(k(t)) $$

...where...

$$ \tilde{k}(t) = \frac{K(t)}{A(t)N(t)} $$

...is now defined to be capital per unit effective labor supply. Similarly we can de-trend per capita consumption $c(t)$ using the following change of variables...

\begin{align}
    c(t) =& A(t)\tilde{c}(t) \\
    \dot{c} =& \dot{A}(t)\tilde{c}(t) + A(t)\dot{\tilde{c}}(t)
\end{align}

...where...

$$ \tilde{c}(t) \equiv \frac{c(t)}{A(t)}$$

is consumption per unit of effective labor supply.

Using these results, we can re-write the above system of differential equations as follows...

\begin{align}
    \dot{\tilde{k}}(t) =& f(\tilde{k}(t)) - (g + n + \delta)\tilde{k}(t) - \tilde{c}(t)\\
    \dot{\tilde{c}}(t) =& \frac{1}{A(0)e^{gt}ARA\bigg(A(0)e^{gt}\tilde{c}(t)\bigg)}\bigg[f'(k(t)) - \delta - \rho\bigg] - g\tilde{c}(t)
\end{align}

...where $k$ and $c$ are now measured per unit of effective labor supply. Note that the equation of motion for consumption per unit effective labor supply is no longer time invariant. However, if marginal utility of consumption for the representative household is homogenous of degree $k$, then the equation of motion for $\tilde{c}$ becomes time-invariant...

\begin{align}
    \dot{\tilde{c}}(t) =& \frac{1}{ARA\bigg(\tilde{c}(t)\bigg)}\bigg[f'(k(t)) - \delta - \rho\bigg] - g\tilde{c}(t)
\end{align}

 Boundary conditions

To complete the model we need to specifcy some boundary conditions. The initial conditions for technology, $A(0)$, and household size (i.e., population), $N(0)$, and capital, $K(0)$, are assumed given. Therefore...

$$ \tilde{k}(0) = \frac{K(0)}{A(0)N(0)}. $$

We will impose the following terminal condition on consumption per unit effective labor supply...

$$ \lim_{t \rightarrow \infty} \tilde{c}(t) = \tilde{c}^*. $$

 Full model

The full model is completely specified by the following system of ordinary conditions and boundary conditions...

\begin{align}
    \dot{\tilde{k}}(t) =& f(\tilde{k}(t)) - (g + n + \delta)\tilde{k}(t) - \tilde{c}(t),\ \tilde{k}(0) = \tilde{k}_0 \\
        \dot{\tilde{c}}(t) =& \frac{1}{A(0)e^{gt}ARA\bigg(A(0)e^{gt}\tilde{c}(t)\bigg)}\bigg[f'(\tilde{k}(t)) - \delta - \rho\bigg] - g\tilde{c}(t),\ \lim_{t \rightarrow \infty} \tilde{c}(t) = c^*
\end{align}

 Example: HARA risk aversion and Cobb-Douglas production

Suppose representative household preferences are consistent with Hyperbolic Relative Risk Aversion (HARA)...

$$ ARA(c) = \frac{1}{ac + b} $$

...in this case the equation of motion for consumption per unit effective labor reduces to...

$$\dot{\tilde{c}}(t) = \bigg[a\tilde{c}(t) + \frac{b}{A(0)e^{gt}}\bigg]\bigg[f'(\tilde{k}(t)) - \delta - \rho\bigg] - g\tilde{c}(t) $$

...note that when $b \ne 0$ this is a non-autonomous differential equation and the representative household has time-varying risk preferences. On the other hand, if $b = 0$ then the representative household has standard CRRA risk preferences (which do not depend directly on time).

```python
def hara(t, c, a, b, **params):
    """
    Hyperbolic Absolute Risk Aversion (HARA).

    Notes
    -----
    For Constant Absolute Risk Aversion (CARA), set a=0; for
    Constant Relative Risk Aversion (CRRA), set b=0.

    """
    return 1 / (a * c + b)

def cobb_douglas_output(k_tilde, alpha, l, **params):
    return k_tilde**alpha * l**(1 - alpha)

def cobb_douglas_mpk(k_tilde, alpha, l, **params):
    return alpha * k_tilde**(alpha - 1) * l**(1 - alpha)

def c_tilde_dot(t, k_tilde, c_tilde, A0, delta, g, rho, **params):
    A = A0 * np.exp(g * t)
    r = cobb_douglas_mpk(k_tilde, **params) - delta
    return ((r - rho) / (A * hara(t, A * c_tilde, **params))) - g * c_tilde

def k_tilde_dot(t, k_tilde, c_tilde, delta, g, n, **params):
    return cobb_douglas_output(k_tilde, **params) - c_tilde - (g + n + delta) * k_tilde

def standard_ramsey_model(t, k_tilde, c_tilde, A0, delta, g, n, rho, **params):
    out = [k_tilde_dot(t, k_tilde, c_tilde, delta, g, n, **params),
           c_tilde_dot(t, k_tilde, c_tilde, A0, delta, g, rho, **params)]
    return out

def initial_condition(t, k_tilde, c_tilde, A0, K0, N0, **params):
    return [k_tilde - (K0 / (A0 * N0))]

def terminal_condition(t, k_tilde, c_tilde, **params):
    return [c_tilde - equilibrium_consumption(**params)]

def equilibrium_capital(a, alpha, b, delta, g, l, n, rho, **params):
    return ((a * alpha * l**(1 - alpha)) / (a * (delta + rho) + g))**(1 / (1 - alpha))

def equilibrium_consumption(a, alpha, b, delta, g, l, n, rho, **params):
    kss = equilibrium_capital(a, alpha, b, delta, g, l, n, rho)
    return cobb_douglas_output(kss, alpha, l) - (g + n + delta) * kss

```

To complete the model we need to define some parameter values.

```python
# set b=0 for CRRA...
params = {'a': 1.0, 'b': 0.0, 'g': 0.02, 'n': 0.02, 'alpha': 0.15,
          'delta': 0.04, 'l': 1.0, 'K0': 1.0, 'A0': 1.0, 'N0': 1.0,
          'rho': 0.02}
```

Solving the model with pyCollocation

Defining a `pycollocation.TwoPointBVP` instance

```python
pycollocation.problems.TwoPointBVP?
```

```python
standard_ramsey_bvp = pycollocation.problems.TwoPointBVP(bcs_lower=initial_condition,
                                                         bcs_upper=terminal_condition,
                                                         number_bcs_lower=1,
                                                         number_odes=2,
                                                         params=params,
                                                         rhs=standard_ramsey_model,
                                                         )
```

### Finding a good initial guess for $\tilde{k}(t)$

Theory tells us that, starting from some initial condition $\tilde{k}_0$, the solution to the Solow model converges monotonically toward its long run equilibrium value $\tilde{k}^*$. Our initial guess for the solution should preserve this property...

```python
def initial_mesh(t, T, num, problem):
    # compute equilibrium values
    cstar = equilibrium_consumption(**problem.params)
    kstar = equilibrium_capital(**problem.params)
    ystar = cobb_douglas_output(kstar, **problem.params)

    # create the mesh for capital
    ts = np.linspace(t, T, num)
    k0 = problem.params['K0'] / (problem.params['A0'] * problem.params['N0'])
    ks = kstar - (kstar - k0) * np.exp(-ts)

    # create the mesh for consumption
    s = 1 - (cstar / ystar)
    y0 = cobb_douglas_output(k0, **problem.params)
    c0 = (1 - s) * y0
    cs = cstar - (cstar - c0) * np.exp(-ts)

    return ts, ks, cs

```

### Solving the model

```python
pycollocation.solvers.Solver?
```

 Polynomial basis functions

```python
polynomial_basis = pycollocation.basis_functions.PolynomialBasis()
solver = pycollocation.solvers.Solver(polynomial_basis)

boundary_points = (0, 200)
ts, ks, cs = initial_mesh(*boundary_points, num=1000, problem=standard_ramsey_bvp)

basis_kwargs = {'kind': 'Chebyshev', 'domain': boundary_points, 'degree': 25}
k_poly = polynomial_basis.fit(ts, ks, **basis_kwargs)
c_poly = polynomial_basis.fit(ts, cs, **basis_kwargs)
initial_coefs = np.hstack([k_poly.coef, c_poly.coef])
nodes = polynomial_basis.roots(**basis_kwargs)

solution = solver.solve(basis_kwargs, boundary_points, initial_coefs,
                        nodes, standard_ramsey_bvp)

```

```python
ts, _, _ = initial_mesh(*boundary_points, 1000, standard_ramsey_bvp)
k_soln, c_soln = solution.evaluate_solution(ts)
plt.plot(ts, k_soln)
plt.plot(ts, c_soln)
plt.show()
```

```python
k_resids, c_resids = solution.evaluate_residual(ts)
plt.plot(ts, k_resids)
plt.plot(ts, c_resids)

plt.show()
```

```python
k_normalized_resids, c_normalized_resids = solution.normalize_residuals(ts)
plt.plot(ts, np.abs(k_normalized_resids))
plt.plot(ts, np.abs(c_normalized_resids))
plt.yscale('log')
plt.show()
```

 B-spline basis functions

```python
bspline_basis = pycollocation.basis_functions.BSplineBasis()
solver = pycollocation.solvers.Solver(bspline_basis)

boundary_points = (0, 200)
ts, ks, cs = initial_mesh(*boundary_points, num=250, problem=standard_ramsey_bvp)

tck, u = bspline_basis.fit([ks, cs], u=ts, k=5, s=0)
knots, coefs, k = tck
initial_coefs = np.hstack(coefs)

basis_kwargs = {'knots': knots, 'degree': k, 'ext': 2}
nodes = np.linspace(*boundary_points, num=249)

solution = solver.solve(basis_kwargs, boundary_points, initial_coefs,
                        nodes, standard_ramsey_bvp)

```

```python
ts, _, _ = initial_mesh(*boundary_points, num=1000, problem=standard_ramsey_bvp)
k_soln, c_soln = solution.evaluate_solution(ts)
plt.plot(ts, k_soln)
plt.plot(ts, c_soln)
plt.show()
```

```python
k_resids, c_resids = solution.evaluate_residual(ts)
plt.plot(ts, k_resids)
plt.plot(ts, c_resids)

plt.show()
```

```python
k_normalized_resids, c_normalized_resids = solution.normalize_residuals(ts)
plt.plot(ts, np.abs(k_normalized_resids))
plt.plot(ts, np.abs(c_normalized_resids))
plt.yscale('log')
plt.show()
```

 Generic Ramsey-Cass-Koopmans model

Can we refactor the above code so that we can solve a Ramsey-Cass-Koopmans model for arbitrary intensive production functions and risk preferences? Yes!

```python
from pycollocation.tests import models
```

Example usage...

```python
def ces_output(k_tilde, alpha, l, sigma, **params):
    gamma = (sigma - 1) / sigma
    if gamma == 0:
        y = k_tilde**alpha * l**(1 - alpha)
    else:
        y = (alpha * k_tilde**gamma + (1 - alpha) * l**gamma)**(1 / gamma)
    return y

def ces_mpk(k_tilde, alpha, l, sigma, **params):
    y = ces_output(k_tilde, alpha, l, sigma)
    gamma = (sigma - 1) / sigma
    if gamma == 0:
        mpk = alpha * (y / k_tilde)
    else:
        mpk = alpha * k_tilde**(gamma - 1) * (y / (alpha * k_tilde**gamma + (1 - alpha) * l**gamma))
    return mpk

def ces_equilibrium_capital(a, alpha, b, delta, g, l, n, rho, sigma, **params):
    """Steady state value for capital stock (per unit effective labor)."""
    gamma = (sigma - 1) / sigma
    if gamma == 1:
        kss = ((a * alpha * l**(1 - alpha)) / (a * (delta + rho) + g))**(1 / (1 - alpha))
    else:
        kss = l * ((1 / (1 - alpha)) * (((a * (delta + rho) + g) / (a * alpha))**(gamma / (1 - gamma)) - alpha))**(-1 / gamma)
    return kss

```

```python
ces_params = {'a': 0.5, 'b': 1.0, 'g': 0.02, 'n': 0.02, 'alpha': 0.15,
              'delta': 0.04, 'l': 5.0, 'K0': 2.0, 'A0': 1.0, 'N0': 1.0,
              'rho': 0.02, 'sigma': 2.0}
```

```python
generic_ramsey_bvp = models.RamseyCassKoopmansModel(hara,
                                                    ces_output,
                                                    ces_equilibrium_capital,
                                                    ces_mpk,
                                                    ces_params)
```

```python
polynomial_basis = pycollocation.basis_functions.PolynomialBasis()
solver = pycollocation.solvers.Solver(polynomial_basis)

boundary_points = (0, 500)
ts, ks, cs = initial_mesh(*boundary_points, num=1000, problem=generic_ramsey_bvp)

basis_kwargs = {'kind': 'Chebyshev', 'domain': boundary_points, 'degree': 30}
k_poly = polynomial_basis.fit(ts, ks, **basis_kwargs)
c_poly = polynomial_basis.fit(ts, cs, **basis_kwargs)
initial_coefs = np.hstack([k_poly.coef, c_poly.coef])
nodes = polynomial_basis.roots(**basis_kwargs)

solution = solver.solve(basis_kwargs, boundary_points, initial_coefs,
                        nodes, generic_ramsey_bvp)

```

```python
solution.result.success
```

    True

```python
k_soln, c_soln = solution.evaluate_solution(ts)
plt.plot(ts, k_soln)
plt.plot(ts, c_soln)
plt.show()
```

```python
k_normalized_resids, c_normalized_resids = solution.normalize_residuals(ts)
plt.plot(ts, np.abs(k_normalized_resids))
plt.plot(ts, np.abs(c_normalized_resids))
plt.yscale('log')
plt.show()
```

 Phase space plots

 2D phase space

```python
css = generic_ramsey_bvp.equilibrium_consumption(**generic_ramsey_bvp.params)
kss = ces_equilibrium_capital(**generic_ramsey_bvp.params)

plt.plot(k_soln / kss, c_soln / css)
plt.xlabel(r'$\frac{\tilde{k}}{\tilde{k}^*}$', fontsize=20)
plt.ylabel(r'$\frac{\tilde{c}}{\tilde{c}^*}$', fontsize=20, rotation='horizontal')
plt.title("Phase space for the Ramsey-Cass-Koopmans model")
```

 3D phase space

```python
from mpl_toolkits.mplot3d import Axes3D
```

```python
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot(k_soln / kss, c_soln / css, ts, label='Ramsey model trajectory')
plt.xlabel(r'$\frac{\tilde{k}}{\tilde{k}^*}$', fontsize=20)
plt.ylabel(r'$\frac{\tilde{c}}{\tilde{c}^*}$', fontsize=20)
ax.set_zlabel('$t$')
ax.legend()

plt.show()

```

```python

```