<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Zeyi Jiang on Medium]]></title>
        <description><![CDATA[Stories by Zeyi Jiang on Medium]]></description>
        <link>https://medium.com/@zeyi.jiang?source=rss-b95d19aa33e0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*B-SxobCEUzpdQslB</url>
            <title>Stories by Zeyi Jiang on Medium</title>
            <link>https://medium.com/@zeyi.jiang?source=rss-b95d19aa33e0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 00:33:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zeyi.jiang/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Simulation & Visualization of Birds Migration]]></title>
            <link>https://medium.com/data-mining-the-city/simulation-visualization-of-birds-migration-632e80773141?source=rss-b95d19aa33e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/632e80773141</guid>
            <category><![CDATA[data-mining]]></category>
            <category><![CDATA[environment]]></category>
            <category><![CDATA[research]]></category>
            <dc:creator><![CDATA[Zeyi Jiang]]></dc:creator>
            <pubDate>Mon, 10 Dec 2018 12:45:52 GMT</pubDate>
            <atom:updated>2018-12-10T19:56:20.699Z</atom:updated>
            <content:encoded><![CDATA[<p>Simulation &amp; Visualization of Birds Migration</p><p>— — An algorithm providing guidelines for habitats protection</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*hYPp5qsy2exeS5IAPVvN0w.gif" /><figcaption>simulation of birds migration 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*uwMkkvXJ0qcE4ee4AGDlzQ.gif" /><figcaption>simulation of birds migration 2</figcaption></figure><ul><li>· <strong>Team: Jianqi Li(jl5212), Junyu Cao(jc5040),Zeyi Jiang(zj2243)</strong></li><li>· <strong>Conference:</strong> SIMULTECH 2019</li><li>· <strong>Paper Submission Requirement: </strong><a href="http://www.simultech.org/Guidelines.aspx">http://www.simultech.org/Guidelines.aspx</a></li><li>It is recommended that Regular Papers are submitted for review with around 8 to 10 pages, with the appropriate font size and page format, including references, tables, graphs, images and appendices. Submissions with less than 4 pages or more than 13 pages will be automatically rejected. Each paper should clearly indicate the nature of its technical/scientific contribution, and the problems, domains or environments to which it is applicable.</li></ul><h3>Simulation &amp; Visualization of Birds Migration</h3><h4>— — An algorithm providing guidelines for habitats protection</h4><h3>1. Background Introduction</h3><p>The sustainability of ecosystem and biodiversity is essential to both human’s life and our planet. Birds’ migration is one of important part of our ecosystem. However, because of recent urban sprawl, the birds’ migration are threatened a lot by habitat fragmentation, human activities, decline of food resources. In-between habitats should be protected and proposed for migrating birds to rest on and find food. Basically, we want to utilize the simulation model to simulate the migratory pathways and living environment of birds and find the reference for urban design and natural environmental protection.</p><h3>2. Thesis</h3><p>We chose the Arctic Tern as our research object. By simulating the migration path of Arctic terns, we can test the importance of several factors affecting bird migration, including habitat size and access, food resources and the maximum distance they can fly at once. Based on that we can find the best path for birds and create a guideline of how to protect existing habitats and which should be protected urgently at first.</p><h3>3. Research of migration birds</h3><h4>— key aspects that influence their behaviors</h4><p>Arctic tern is species which is strongly migratory, seeing two summers each year as it migrates along a convoluted route from its northern breeding grounds to the Antarctic coast for the southern summer and back again about six months later, which is the longest migration route among known animals.</p><p>The food of Arctic terns varies by region and time, but they are usually carnivorous. Fish play a very important role in their food. On their migration path, they need water to find food to replenish energy. Basically, the scale of habitats influence their migration route because larger habitat can provide more water and food resources to replenish their energy.</p><p>In addition to food, wind power is also an important factor affecting their migration. In order to conserve the wind and save energy, the Arctic terns of generations will choose a very tortuous migration route, which makes them fly twice a year more than the straight distance between north and south poles.</p><h3>4. Programming model</h3><p>We assume that each bird consume energy when flying, there are several parameters that can influence the energy consumption, such as the airflow, food resource and vegetation types. We take size of in-between habitats, flying distance into consideration this time.</p><p>We also assume that the birds will make clever choice based on their total energy consumption from start point to end point, so the outcome of visualization will show the most probable area of bird migration, which can be a reference for natural environmental protection and boundaries of urban development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*MKwioAorj25yZ3VLMFp5zw.png" /><figcaption>parameters of programming model</figcaption></figure><h4>A. Individuals:</h4><p>migration birds, habitats</p><h4>B. Parameters：</h4><p>Location of habitats; size of habitat (related to amount of food resources and water , which can supplement bird’s energy); flying distance between two habitats of migrating bird; flying direction (related to the location of habitats)</p><h4>C. High dimensional parameters:</h4><p>Establish a negative correlation function between energy consumption and possibility of each flying route. So the visualization of migration can show the most popular route and habitats.</p><h4>D. Input:</h4><p>The starting and ending point of migration bird. The location and the size of habitats.</p><h4>E. Output:</h4><p>the birds’ migration simulation</p><h3>5. Logic of algorithm</h3><p>Basically, our model chooses better migration paths by calculating and comparing the energy loss of migratory birds during different migration paths. When birds are migrating, they will lose energy based on the distance of their flight. And when they arrived at a habitat, they will supplement energy based on the scale of that habitat. So, when calculating their consumption and supplement of energy during each migration path, we can find out which path has the least energy consumption, which will be the best path for birds.</p><h4>A. Establish habitats and connect different habitats</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*hx8kTOlA2lzzD2FNSlD29A.png" /></figure><h4>B. Filter out the paths connecting habitats which are too long and select all the others feasible paths.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*r4ZfBNcK6H6sAtscY-nmGg.png" /></figure><h4>C. Energy consumption rules</h4><p>The energy consumed per unit of flight distance is constant. At the same time, birds can replenish energy while they reach their habitat. So the equation of energy consumption is:</p><blockquote><strong>Energy = int (distance*j-habitat _energy)</strong></blockquote><p>The energy comsumption of each path = Energy loss based on the distance of flight between habitats + Energy supplement based on the scale of habitats which birds arrive at.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*UDg_7-YB-96Rmp2ab1-OzA.png" /></figure><h4>D. Calculate the energy consumption</h4><p>Calculate the energy consumption of all possible paths from the start point to the end point by algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*kMDnPMf6VtMZgj0Mb8--1A.png" /></figure><h4>E. Get birds density of each routes</h4><p>Get the number of birds flying on each route through an inverse ratio equation:</p><blockquote><strong>birdsamount= int(birdsamountfactor/energy)</strong></blockquote><p>The birds amount of each route= a predetermined parameter/ energy consumption of each route.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*GBTI7a0pGPRxMPpmLG2fow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*En_Mimo8c91-RpJbJq1wTg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*ecdeiob5dpP4mMjPvzmKAQ.png" /></figure><p>For example, in the case of sample 1, we calculate all the energy consumption through all the routes birds migrate to get a total consumption, which is -38. Then we calculate all the energy supplement from the habitats they pass by, which will be +10. Then the total energy loss is -28. Based on the same reason, we can calculate the other three samples.</p><p>Weight the number of birds appearing on different paths according to the inverse ratio of the energy consumption value, and get the probability of birds flying on each path. Assume that birdsamountfactor=3000, so:</p><blockquote><strong>Birdsamount1= int(3000/28)=107</strong></blockquote><blockquote><strong>Birdsamount2= int(3000/22)=136</strong></blockquote><blockquote><strong>Birdsamount3= int(3000/20)=150</strong></blockquote><blockquote><strong>Birdsamount4= int(3000/31)=97</strong></blockquote><h3>6. Interaction and visualization</h3><p>In our simulation model, we also want to have the interaction with users. Users can add some spots of habitats of different scale based on different site contexts. Through our simulation model, users can find the best migration route of birds according to the habitats they put in and find the best intervention spot which has the biggest impact to the whole migration network.</p><p>Interactive process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*L88wwjNkgQAokKhbkEGGYg.gif" /></figure><p>1． Import map and set the starting point and destination.</p><p>2． Place habitats which you can define as large habitat, medium habitat and small habitat according to its range. (Different levels of habitat represent for different level of energy supplement)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*W8MaB6Vm67n_1-7XTUTMHA.png" /></figure><p>3． Birds begin to migrate, each bird’s energy will reduce during its flight, different amount of birds will show up in each route based on its energy loss. The route with less energy loss will show up more birds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*taNIIHZe9AgsbpueROAQaA.png" /></figure><p>4． Based on the consumption and supplement of the energy, birds finally reach the destination. When birds reach to destination, they will restart from the start point again. So there would be countless birds flying on route, which could illustrate clearly that which route and habitats is more popular and need to be protected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*GlNliR0snbnBVsV3btlZaA.png" /></figure><h3>7. Contribution of our model</h3><p>Our simulation model can help people find out the guidelines for protecting birds’ migration habitat, which we think have meanings from three aspects: urban design practice, educational significance for society and ecosystem.</p><p>For urban design practice, we can apply our projects to an exact rural-urban area. Through learning from the most beneficial routes for birds migration, we can define the boundary of ecological safety area and urban develop boundary for reserving essential habitats for birds migrating. And we can also acknowledge the weight of key elements that impact the birds migration. Most importantly, we can find the most probable route for birds’ migration to avoid the influence of urban development to natural environment as well as guide our urban design.</p><p>For society, through the process of interaction, people will realize the significance of protecting bird habitats for the harmonious development of human and nature. This also have an educational function for children’s awareness of bird’s habitats’ importance.</p><p>For ecosystem, by finding the most likely place for birds to survive. we can establish protected area to provide habitats for birds. Birds are also important pollinators of nature, by protecting birds, more species including trees and plants will be saved to increase the biodiversity of our ecosystem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vVtiya5o5aMQzf9J8L5b3w.jpeg" /></figure><h3>8. Conclusion</h3><p>Through the coding and visualization of bird migration, we find out several surprising outcome and summarized some unexpected experience.</p><p>The first thing is that we can use some easy equation to replace some complex relationship when we translate our logic of project to code. For example, when we want to express the negative relationship between possibility and energy consumption of each routes, we first try to use the equation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*9qfbKjQpOS2IbPZj1unkew.png" /></figure><p>The Ex means the expectation(possibility) of one bird flying in one route.</p><p>When we want to use code to solute this equation, we find it is difficult because it is a multiple equations, which need a tool not existed in processing. So we try to use another easy equation to figure out this relationship:</p><blockquote><strong>birdsamountroute= birdsamountfactor/ |△Eroute|</strong></blockquote><p>so we keep the negative relationship between possibility of each routes and energy consumption, and we get rid of the problem of solving a multiple equation.</p><p>The second thing is that we find out that most of time there are not only one best route but several similar good solutions. More obvious is that some habitats are passed through by huge amount of birds. So maybe we can acknowledge more information about which habitat are more important on the process of bird migration. Based on this we can strategically choose the most valuable habitats to protect for resilience of urban development.</p><h3>9. References</h3><p>[1] Kurt D. Reed. Birds, Migration and Emerging Zoonoses: West Nile Virus, Lyme Disease, Influenza A and Enteropathogens. Clin Med Res, January 1, no. 1(2003): 5–12</p><p>[2] Carsten Egevang, Iain J. Stenhouse, Richard A. Phillips, Aevar Petersen, James W. Fox, and Janet R. D. Silk. Tracking of Arctic terns Sterna paradisaea reveals longest animal migration. PNAS, February 2, no. 107(2010): 2078–2081</p><p>[3] Thomas Alerstam, Anders Hedenström, Susanne Åkesson. Long‐distance migration: evolution and determinants. OIKOS, October 17, no. 103(2003): 247–260</p><p>Code:</p><p>final_birds_simulation</p><pre>from habitat import Habitat<br>from startend import Startend<br>from calculation import Calculation<br>from visualizationlink import Visualizationlink<br>from mover import Mover</pre><pre>def setup():<br>    global a,hcolour,simulate,smallhabitat,mediumhabitat,largehabitat,startpoint,endpoint,clearhabitat,endpoint,\<br>           init_smallbx,init_smallby,init_mediumbx,init_mediumby,\<br>           init_largebx,init_largeby,init_stbx,init_stby,init_endbx,init_endby,clearbx,clearby,\<br>           ssize,msize,lsize, st_size,startcolour,starttext,endtext,largehabitatpoint,lenergy,senergy,menergy,\<br>           simulatebx,simulateby,maxdist,swich,bg<br>           <br>    bg = loadImage(&quot;map.png&quot;)<br>    <br>    rectMode(RADIUS)<br>    size(1600, 900)<br>    swich = False<br>    maxdist=600<br>    <br>    hcolour=255<br>    #small habitat button setup<br>    ssize=7<br>    init_smallbx = width / 20<br>    init_smallby = height / 10<br>    smallhabitat=[Habitat(init_smallbx, init_smallby,ssize,hcolour)]<br>    senergy=50<br>    <br>    #medium habitat button setup<br>    msize=12<br>    init_mediumbx = width / 20<br>    init_mediumby = height / 6<br>    mediumhabitat=[Habitat(init_mediumbx, init_mediumby,msize,hcolour)]<br>    menergy=200<br>    <br>    #large habitat button setup<br>    lsize=16<br>    init_largebx = width / 20<br>    init_largeby = height / 4<br>    largehabitat=[Habitat(init_largebx, init_largeby,lsize,hcolour)]<br>    largehabitatpoint=[]<br>    lenergy=100<br>    <br>    #startpoint button setup<br>    startcolour = 255<br>    st_size=12<br>    init_stbx = width / 20<br>    init_stby = height/3<br>    starttext = &quot;S&quot;<br>    startpoint = [Startend(init_stbx,init_stby,st_size,startcolour,starttext)]<br>    <br>    #endpoint button setup<br>    <br>    init_endbx = width / 20<br>    init_endby = height/2.5<br>    endtext = &quot;E&quot;<br>    endpoint = [Startend(init_endbx,init_endby,st_size,startcolour,endtext)]<br>    <br>    <br>    #clear habitat button setup<br>    clearcolour= 0<br>    clearsize=16<br>    clearbx = width / 20<br>    clearby = height / 1.8<br>    clearhabitat=Habitat(clearbx, clearby,clearsize,clearcolour)<br>    <br>    <br>    <br>    #simulate button<br>    simulatecolour= 0<br>    simulatesize=25<br>    simulatebx = width / 20<br>    simulateby = height / 1.5<br>    simulate=Habitat(simulatebx, simulateby,simulatesize,simulatecolour)</pre><pre>def mousePressed():<br>    global a,hcolour,simulate,smallhabitat,mediumhabitat,largehabitat,startpoint,endpoint,clearhabitat,endpoint,\<br>           init_smallbx,init_smallby,init_mediumbx,init_mediumby,\<br>           init_largebx,init_largeby,init_stbx,init_stby,init_endbx,init_endby,clearbx,clearby,\<br>           ssize,msize,lsize, st_size,startcolour,starttext,endtext,largehabitatpoint,lenergy,senergy,menergy,\<br>           simulatebx,simulateby,maxdist,link,swich,tmpbird<br>    <br>    #smallhabitat button click<br>    for i in smallhabitat:<br>          i.mousePressed()<br>    if init_smallbx - i.boxSize &lt; mouseX &lt; init_smallbx + i.boxSize and \<br>       init_smallby - i.boxSize &lt; mouseY &lt; init_smallby + i.boxSize:<br>       tmp = []<br>       tmp.append(Habitat(i.bx, i.by,ssize,hcolour))              <br>       smallhabitat += tmp</pre><pre>#mediumhabitat button click<br>    for i in mediumhabitat:<br>          i.mousePressed()<br>    if init_mediumbx - i.boxSize &lt; mouseX &lt; init_mediumbx + i.boxSize and \<br>       init_mediumby - i.boxSize &lt; mouseY &lt; init_mediumby + i.boxSize:<br>       tmp = []<br>       tmp.append(Habitat(i.bx, i.by,msize,hcolour))              <br>       mediumhabitat += tmp</pre><pre>#largehabitat button click<br>    for i in largehabitat:<br>          i.mousePressed()<br>    if init_largebx - i.boxSize &lt; mouseX &lt; init_largebx + i.boxSize and \<br>        init_largeby - i.boxSize &lt; mouseY &lt; init_largeby + i.boxSize:<br>        tmp = []<br>        tmp.append(Habitat(i.bx, i.by,lsize,hcolour))              <br>        largehabitat += tmp</pre><pre>#startpoint button click<br>    for i in startpoint:<br>          i.mousePressed()<br>    if len(startpoint)&lt;&gt;2:<br>     if init_stbx - i.boxSize &lt; mouseX &lt; init_stbx + i.boxSize and \<br>        init_stby - i.boxSize &lt; mouseY &lt; init_stby + i.boxSize:<br>        tmp = []<br>        tmp.append(Startend(i.bx, i.by,st_size,startcolour,starttext))              <br>        startpoint += tmp</pre><pre>#endpoint button click <br>    for i in endpoint:<br>          i.mousePressed()<br>    if len(endpoint)&lt;&gt;2:<br>     if init_endbx - i.boxSize &lt; mouseX &lt; init_endbx + i.boxSize and \<br>        init_endby - i.boxSize &lt; mouseY &lt; init_endby + i.boxSize:<br>        tmp = []<br>        tmp.append(Startend(i.bx, i.by,st_size,startcolour,endtext))              <br>        endpoint += tmp</pre><pre>#clear button click<br>    if clearbx - clearhabitat.boxSize &lt; mouseX &lt; clearbx + clearhabitat.boxSize and \<br>       clearby - clearhabitat.boxSize &lt; mouseY &lt; clearby + clearhabitat.boxSize:<br>            smallhabitat=[Habitat(init_smallbx, init_smallby,ssize,hcolour)]<br>            mediumhabitat=[Habitat(init_mediumbx, init_mediumby,msize,hcolour)]<br>            largehabitat=[Habitat(init_largebx, init_largeby,lsize,hcolour)]<br>            startpoint = [Startend(init_stbx,init_stby,st_size,startcolour,starttext)]<br>            endpoint = [Startend(init_endbx,init_endby,st_size,startcolour,endtext)]<br>            swich= False<br>            <br>            <br>    #simlate button click<br>    if simulatebx - simulate.boxSize &lt; mouseX &lt; simulatebx + simulate.boxSize and \<br>       simulateby - simulate.boxSize &lt; mouseY &lt; simulateby + simulate.boxSize:<br>        swich = True <br>        <br>        habitatpoint=set()<br>        energydict={}<br>        energydict.clear()<br>    <br>        #generate the haitatpoint:((LoactionX1,LocationY1),(LoactionX2,LocationY2)....))<br>         #        and energydic:{(LoactionX1,LocationY1):energy,.....},energy is the energy each haitatpoint that can supply to the bird<br>        for n in range(len(largehabitat)):<br>                habitatpoint.add((largehabitat[n].bx,largehabitat[n].by))<br>                energydict[(largehabitat[n].bx,largehabitat[n].by)]= lenergy<br>            <br>                if (init_largebx,init_largeby) in habitatpoint:<br>                    habitatpoint.remove((init_largebx,init_largeby))<br>                    <br>        for n in range(len(mediumhabitat)):<br>                habitatpoint.add((mediumhabitat[n].bx,mediumhabitat[n].by))<br>                energydict[(mediumhabitat[n].bx,mediumhabitat[n].by)]= menergy<br>            <br>                if (init_mediumbx,init_mediumby) in habitatpoint:<br>                    habitatpoint.remove((init_mediumbx,init_mediumby))<br>                    <br>        for n in range(len(smallhabitat)):<br>                habitatpoint.add((smallhabitat[n].bx,smallhabitat[n].by))<br>                energydict[(smallhabitat[n].bx,smallhabitat[n].by)]= senergy<br>            <br>                if (init_smallbx,init_smallby) in habitatpoint:<br>                    habitatpoint.remove((init_smallbx,init_smallby))<br>        <br>        if len(startpoint)==2:<br>            habitatpoint.add((startpoint[0].bx,startpoint[0].by))<br>            energydict[(startpoint[0].bx,startpoint[0].by)]= 0<br>            <br>        if len(endpoint)==2:<br>            habitatpoint.add((endpoint[0].bx,endpoint[0].by))<br>            energydict[(endpoint[0].bx,endpoint[0].by)]= 0<br>        <br>            #imput habitatpoint and energydict to calculation<br>            tempcal=Calculation((startpoint[0].bx,startpoint[0].by),(endpoint[0].bx,endpoint[0].by),habitatpoint,energydict,maxdist)<br>            <br>            #possible routes visualization<br>            link = Visualizationlink(maxdist,habitatpoint)<br>            <br>            #bird visualization<br>            birdsamountfactor=3000<br>            tmpbird=[]<br>            for energy in tempcal.route_energy_use:<br>                birdsamount= int(birdsamountfactor/energy)<br>                for i in range(birdsamount):<br>                    tmpbird.append(Mover(tempcal.route_energydict_use[energy],2+0.1*i,0.4))<br>                <br>            <br>            <br>        <br>            <br>    <br>def draw():<br>    global a,hcolour,simulate,smallhabitat,mediumhabitat,largehabitat,startpoint,endpoint,clearhabitat,endpoint,\<br>           init_smallbx,init_smallby,init_mediumbx,init_mediumby,\<br>           init_largebx,init_largeby,init_stbx,init_stby,init_endbx,init_endby,clearbx,clearby,\<br>           ssize,msize,lsize, st_size,startcolour,starttext,endtext,largehabitatpoint,lenergy,senergy,menergy,\<br>           simulatebx,simulateby,link,swich,tmpbird,bg</pre><pre>background(bg)<br>    <br>    if swich == True:<br>      background(bg)<br>      <br>      for bird in tmpbird:<br>        bird.update()<br>        bird.display()<br>      link.display()<br>      <br>    <br>    for i in smallhabitat:<br>      i.display()<br>    <br>    for i in mediumhabitat:<br>      i.display()<br>      <br>    for i in largehabitat:<br>      i.display()<br>    <br>    for i in startpoint:<br>      i.display()<br>    <br>    for i in endpoint:<br>      i.display()<br>    <br>    <br>    <br>    <br>    clearhabitat.display()<br>    fill(255)<br>    textSize(30)<br>    text(&quot;c&quot;,clearbx-8,clearby+8)<br>    <br>    simulate.display()<br>    fill(255)<br>    textSize(10)<br>    text(&quot;SIMULATE&quot;,simulatebx-23,simulateby+4)</pre><pre>def mouseDragged():<br>    global a,hcolour,smallhabitat,mediumhabitat,largehabitat,startpoint,endpoint,clearhabitat,endpoint,\<br>           init_smallbx,init_smallby,init_mediumbx,init_mediumby,\<br>           init_largebx,init_largeby,init_stbx,init_stby,init_endbx,init_endby,clearbx,clearby,\<br>           ssize,msize,lsize, st_size,startcolour,starttext,endtext</pre><pre>for i in smallhabitat:<br>          i.mouseDragged() <br>    for i in mediumhabitat:<br>          i.mouseDragged() <br>    for i in largehabitat:<br>          i.mouseDragged()<br>    if len(startpoint)==2:<br>     startpoint[0].mouseDragged()<br>    if len(endpoint)==2:<br>     endpoint[0].mouseDragged()</pre><p>caculation:</p><pre>#Routes energy consumption calculation<br>import itertools<br>import math<br>class Calculation(object):<br>    def __init__(self, startpoint, endpoint, habitatpoint,energydict,maxdist):<br>        j= 0.8<br>        listpoint=[]<br>        listdistance=[]<br>        t2=0<br>        t3=0<br>        seen=set()<br>        tempseen=set()<br>        seen.add(startpoint)<br>        queue=[]<br>        queue.append(startpoint)<br>        possibleroute=[]<br>        queue2=[]<br>        queue2.append([startpoint])<br>        possibleroutedistance=[]<br>        route_energy=[]<br>        route_energydict={}<br>        <br>        #calculate the distance between two different points<br>        def euclid(pair): <br>            return int(math.sqrt((pair[0][0] - pair[1][0]) ** 2 + (pair[0][1] - pair[1][1]) ** 2))<br>        <br>        #select the possible route, generate the graphy<br>        def gen_dist_dict(habitatpoint, maxdist): <br>            dist_dict = dict()<br>            for pair in itertools.permutations(habitatpoint, 2):<br>                d = euclid(pair)<br>                if d &gt; maxdist:<br>                    continue<br>                if pair[0] not in dist_dict:<br>                    dist_dict[pair[0]] = dict()<br>            <br>                dist_dict[pair[0]][pair[1]] = euclid(pair)<br>                <br>            return dist_dict<br>        <br>        habitatpoint_dict = gen_dist_dict(habitatpoint, maxdist)</pre><pre>#Import the graphy get above, Find all the possible routes and collect them into the list possibleroute<br>        while (len(queue)&gt;0):<br>            vertex= queue.pop(0)<br>            t= queue2.pop(0)<br>            t2=t3<br>            t3=len(t)<br>            if t3&gt;t2:<br>                seen=seen|tempseen <br>            nodes=habitatpoint_dict[vertex]<br>            tempseen.add(vertex)<br>            if endpoint in t:<br>                possibleroute.append(t)<br>            <br>            for w in nodes:<br>                if w not in seen:<br>                    if endpoint not in t:<br>                        queue.append(w)<br>                        f = list(t)<br>                        f.append(w)<br>                        queue2.append(f)<br>        <br>        <br>        #calculate the energy consumption of each routes(considering distance and the size of the habitat)<br>        for route in possibleroute:<br>            <br>            distance=0<br>            for n in range(len(route)-1):<br>                distance = distance + habitatpoint_dict[route[n]][route[n+1]]<br>            habitat_energy = 0<br>            for h in route:<br>                habitat_energy = habitat_energy + energydict[h]<br>            <br>            energy= int(distance*j-habitat_energy)<br>            route_energydict[energy] = route<br>            route_energy.append(energy)<br>            <br>        <br>        #output<br>        route_energy.sort()<br>        self.possibleroute_use= possibleroute<br>        self.route_energy_use = route_energy<br>        self.network = habitatpoint_dict<br>        self.route_energydict_use=route_energydict</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=632e80773141" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mining-the-city/simulation-visualization-of-birds-migration-632e80773141">Simulation &amp; Visualization of Birds Migration</a> was originally published in <a href="https://medium.com/data-mining-the-city">Data Mining the City</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Session B Homework 1]]></title>
            <link>https://medium.com/data-mining-the-city/session-b-homework-1-68fb435ef57d?source=rss-b95d19aa33e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/68fb435ef57d</guid>
            <category><![CDATA[research]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[data-mining]]></category>
            <category><![CDATA[environment]]></category>
            <dc:creator><![CDATA[Zeyi Jiang]]></dc:creator>
            <pubDate>Wed, 31 Oct 2018 02:54:18 GMT</pubDate>
            <atom:updated>2018-10-31T04:25:11.727Z</atom:updated>
            <content:encoded><![CDATA[<ul><li><strong>Team: Jianqi Li(jl5212), Junyu Cao(jc5040),Zeyi Jiang(zj2243)</strong></li><li><strong>Conference:</strong> SIMULTECH 2019</li><li><strong>Paper Submission Requirement:</strong><a href="http://www.simultech.org/Guidelines.aspx">http://www.simultech.org/Guidelines.aspx</a></li><li><strong>Regular papers Submission: </strong>It is recommended that Regular Papers are submitted for review with around 8 to 10 pages, with the appropriate font size and page format, including references, tables, graphs, images and appendices. Submissions with less than 4 pages or more than 13 pages will be automatically rejected.</li><li>Each paper should clearly indicate the nature of its technical/scientific contribution, and the problems, domains or environments to which it is applicable.</li><li><strong>Brief Outline of Your Paper:</strong></li></ul><h3>1. Background Introduction:</h3><p>Problems: The sustainability of ecosystem and biodiversity is essential to both human’s life and our planet. Birds’ migration is one of important part of our ecosystem. However, because of recent urban sprawl, the birds’ migration are threatened a lot by habitat fragmentation, human activities, decline of food resources. In-between habitats should be protected and proposed for migrating birds to rest on and find food. Basically, we want to utilize the simulation model to simulate the migratory pathways and living environment of birds and find the reference for urban design and natural environmental protection.</p><h3>2. Methodology: Simulation and visualization of birds’ migration route</h3><p>We assume that each birds have limitation of energy, there are several parameters that can influence the energy consumption, such as the airflow, food resource and vegetation types. The birds will die after running out of the energy, so the outcome of visualization will show the most probable area of birds migration, which can be a reference for natural environmental protection and boundaries of urban development.</p><p>What’s more, we want to improve the interaction of our model. We can add some spots of habitats to see the change of birds’ route and find the best intervention spot which has the biggest impact to the whole migration network.</p><h3>3. Research of migration birds:</h3><p>Find a kind of bird and figure out the aspects that influence its migration. Such as: What kind of food resource this kind of bird needs? What kind of light intensity and airflow direction will affect the migration? etc.</p><h3>4. Programming model</h3><p>Individuals: migration birds</p><p>Parameters：</p><p>For routes: light intensity, airflow</p><p>For habitats: types of food resources, types of vegetation (forest, crop, wetland), water resource</p><p>High dimensional parameters: Establish a positive correlation function between food resources and vegetation conditions. Because the solution might be improving the habitat’s environment by vegetation restoration.</p><p>Input：The starting and ending point of migration bird. The location of habitats with its characteristic information, including vegetation types, food resource types and amount, water resources, etc. The location of windflow area, the direction and the strength of the wind. The energy of each birds.</p><p>Output: the birds migration birds</p><h3>5. Apply to reality:</h3><p>Applying our projects to an exact rural-urban area.</p><p>Defining the boundary of ecological safety area and urban develop boundary.</p><p>Find the Influence weight of key elements that impact the birds migration.</p><h3>6. Contribution:</h3><p>find the most probable route for birds’ migration to avoid the influence of urban development to natural environment and guide the urban design.</p><p>Social meaning: in the process of interaction, people will realize the significance of protecting bird habitat for the harmonious development of human and nature.</p><p>Ecological meaning:</p><p>Find the most likely place for birds to survive. Establish a protected area.</p><p>How to protect the protected area. We should enter more indicators (habitat &amp; route) and find out how to protect the habitat.</p><p>7. conclusion:</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68fb435ef57d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mining-the-city/session-b-homework-1-68fb435ef57d">Session B Homework 1</a> was originally published in <a href="https://medium.com/data-mining-the-city">Data Mining the City</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beckham on the footcourt]]></title>
            <link>https://medium.com/data-mining-the-city/beckham-on-the-footcourt-b169fe61e533?source=rss-b95d19aa33e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b169fe61e533</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[research]]></category>
            <dc:creator><![CDATA[Zeyi Jiang]]></dc:creator>
            <pubDate>Thu, 27 Sep 2018 04:26:39 GMT</pubDate>
            <atom:updated>2018-09-27T20:52:26.215Z</atom:updated>
            <content:encoded><![CDATA[<p>Homework 3</p><p>Semester Project</p><p>For the project, I want to simulate the distribution system from local farms in Hudson Valley to new york city food market. Based on the existing urban-rural transportation system and location of local farms. I want to figure out which routes are most time and cost efficient for transportation of farm products. And i want to figure out how to arrange the number of trucks to correlate with the scale of farm.</p><p>Simulation</p><p>Rules:</p><ol><li>Blue Beckham are fast and yellow Beckham are slow.</li><li>Blue ones have 8 directions while yellow ones only have 4 directions.</li><li>Blue ones have acceleration while yellow ones have the constant velocity.</li><li>when Beckhams touch the boundaries ,they will go to the opposite side.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*q5wa7gzh0YnlesZCt6tNXA.gif" /></figure><pre>import random<br>#define the fast people<br>class Fast(object):<br>    #initial position and speed<br>    def __init__(self):<br>        self.location = PVector(random.randint(0,width),random.randint(0,height))<br>        self.velocity = PVector(0,0)<br>    #load people image and give it a blue color<br>    def display(self):<br>        fill(0,120,200)<br>        img = loadImage(&quot;people.png&quot;)<br>        image(img,self.location.x,self.location.y,30,30)<br>        tint(0,200,225)<br>    #use acceleration and velocity to control the movement of fast people<br>    def update(self):<br>        self.acceleration = PVector.random2D()<br>        self.acceleration.mult(random.randint(5,10))<br>        self.velocity.add(self.acceleration)<br>        self.location.add(self.velocity)<br>    #check the special sitution when people get across the boundary<br>    def check(self):<br>        if self.location.x &gt; width:<br>            self.location.x = 0<br>        elif self.location.x &lt; 0:<br>            self.location.x = width<br>        if self.location.y &gt; height:<br>            self.location.y = 0<br>        elif self.location.y &lt; 0:<br>            self.location.y = height<br>#define the slow people<br>class Slow(object):<br>    #initial position and speed<br>    def __init__(self):<br>        self.location = PVector(random.randint(0,width),random.randint(0,height))<br>        self.velocity = PVector(0,0)<br>    #load people image and give it a yellow color<br>    def display(self):<br>        fill(0,120,200)<br>        img = loadImage(&quot;people.png&quot;)<br>        image(img,self.location.x,self.location.y,30,30)<br>        tint(225,200,0)<br>    #use random choice to control the direction of slow people<br>    def update(self):<br>        global t,c<br>        t = 0<br>        for i in range(1):<br>            step = random.choice([&#39;N&#39;, &#39;S&#39;, &#39;E&#39;, &#39;W&#39;])<br>            if step ==&#39;N&#39;:<br>                t = t + 0.1<br>                c = map(t,0,3,0,20)<br>                self.location.y=self.location.y+c<br>            elif step == &#39;S&#39;:<br>                t = t + 0.1<br>                c = map(t,0,3,0,20)<br>                self.location.y=self.location.y-c<br>            elif step == &#39;E&#39;:<br>                t = t + 0.1<br>                c = map(t,0,3,0,20)<br>                self.location.x=self.location.x+c<br>            else:<br>                t = t + 0.1<br>                c = map(t,0,3,0,20)<br>                self.location.x=self.location.x-c<br>    #check the special sitution when people get across the boundary            <br>    def check(self):<br>        if self.location.x &gt; width:<br>            self.location.x = 0<br>        elif self.location.x &lt; 0:<br>            self.location.x = width<br>        if self.location.y &gt; height:<br>            self.location.y = 0<br>        elif self.location.y &lt; 0:<br>            self.location.y = height<br>#use list to load different people:30 fast people and 120 slow people  <br>def setup():<br>    fill(0)<br>    size(1000,1000)<br>    global fast,slow<br>    fast= []<br>    slow= []<br>    for x in xrange(30):<br>        fast.append(Fast())<br>    for x in xrange(120):<br>        slow.append(Slow())<br>    noStroke()<br>#load basemap as football court and draw people      <br>def draw():<br>    img = loadImage(&quot;football court.jpg&quot;)<br>    image(img,0,0,1000,1000)<br>    for i in xrange(30):<br>        m = fast[i]<br>        m.update()<br>        m.check()<br>        m.display()<br>    for i in xrange(120):<br>        w = slow[i]<br>        w.update()<br>        w.check()<br>        w.display()</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b169fe61e533" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mining-the-city/beckham-on-the-footcourt-b169fe61e533">Beckham on the footcourt</a> was originally published in <a href="https://medium.com/data-mining-the-city">Data Mining the City</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Variable urban grid in color and scale]]></title>
            <link>https://medium.com/data-mining-the-city/variable-urban-grid-in-color-and-scale-d68d00d3e58b?source=rss-b95d19aa33e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d68d00d3e58b</guid>
            <category><![CDATA[research]]></category>
            <category><![CDATA[philippines]]></category>
            <dc:creator><![CDATA[Zeyi Jiang]]></dc:creator>
            <pubDate>Wed, 19 Sep 2018 18:50:51 GMT</pubDate>
            <atom:updated>2018-09-19T19:59:33.040Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*bS98C95UrUl3CJc3ZPQYCw.gif" /></figure><p>rules:</p><ol><li>set the grid of 5*5 squares</li><li>use sine function to let the scale of squares variable</li><li>I divided the grids into 4 sectors. According to the position of mouse, the grid will have different color gradient when mouse is in different sectors.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ehzyLEpA9nDgImXD-qwLg.jpeg" /></figure><pre>def setup():<br>    size(800,800)<br>    background(250,250,100)<br>    <br>     <br>    global road, blocksPerNeighborhood, blocksPerRow,blocksPerCol,blockLength,ANG<br>    ANG=0<br>    <br>    blocksPerNeighborhood = 25<br>    blocksPerRow = int(sqrt(blocksPerNeighborhood))<br>    blocksPerCol = int(sqrt(blocksPerNeighborhood))<br>    blockLength = int((width/blocksPerRow))<br>    rectMode(CENTER)<br>    frameRate(10)<br>    <br>def draw():<br>    global ANG<br>    background(255)<br>    #make blocks<br>        <br>    for r in range(blocksPerRow):<br>        for c in range(blocksPerCol):<br>            with pushMatrix():<br>                translate(0.5*blockLength+r*blockLength,<br>                          0.5*blockLength+c*blockLength)<br>                if (width-blockLength)*0.5&lt;mouseX and (height-blockLength)*0.5&lt;mouseY:<br>                 fill((ANG*(r)*(c))%255,(ANG*(r)*(c))%255,(ANG*(r)*(c))%255,128)<br>                 rect(0,0,100*sin(ANG/5),<br>                          100*sin(ANG/5))<br>                elif (width-blockLength)*0.5&lt;mouseX and (height-blockLength)*0.5&gt;mouseY:<br>                 fill((ANG*(r)*(c))%255,(ANG*(r)*(c))%255,128,(ANG*(r)*(c))%255)<br>                 rect(0,0,100*sin(ANG/5),<br>                          100*sin(ANG/5))  <br>                elif (width-blockLength)*0.5&gt;mouseX and (height-blockLength)*0.5&lt;mouseY:<br>                 fill((ANG*(r)*(c))%255,128,(ANG*(r)*(c))%255,(ANG*(r)*(c))%255)<br>                 rect(0,0,100*sin(ANG/5),<br>                          100*sin(ANG/5))<br>                else:<br>                 fill(128,(ANG*(r)*(c))%255,(ANG*(r)*(c))%255,(ANG*(r)*(c))%255)<br>                 rect(0,0,100*sin(ANG/5),<br>                          100*sin(ANG/5)) <br>                ANG +=0.02</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d68d00d3e58b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mining-the-city/variable-urban-grid-in-color-and-scale-d68d00d3e58b">Variable urban grid in color and scale</a> was originally published in <a href="https://medium.com/data-mining-the-city">Data Mining the City</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Central-greening neighbourhood]]></title>
            <link>https://medium.com/data-mining-the-city/central-greening-neighbourhood-609c3f6aa81c?source=rss-b95d19aa33e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/609c3f6aa81c</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[research]]></category>
            <dc:creator><![CDATA[Zeyi Jiang]]></dc:creator>
            <pubDate>Sun, 09 Sep 2018 05:05:19 GMT</pubDate>
            <atom:updated>2018-09-19T20:03:42.836Z</atom:updated>
            <content:encoded><![CDATA[<p>Original image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DEwGIEB2hmbcypFmDBHLcQ.jpeg" /></figure><p>Rules:</p><p>4*4 square blocks, each of which has buildings and greening.</p><p>The size of square building equals to 1/9 area of block.</p><p>The surrounding 12 blocks have building along each side and green space in the center.</p><p>The central 4 blocks have one building in the center with surrounding greenland</p><p>Processing canvas:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*JF7871p7XguAYSmNPFZdIw.png" /></figure><p>code:</p><pre>def setup():<br>    size(800,800)<br>    background(250,250,100)<br>    <br>    global road, blocksPerNeighborhood, blocksPerRow, blockLength, houseSetbacks, houseSize, houseQuantity<br>    <br>    road = 25 <br>    blocksPerNeighborhood = 16<br>    blocksPerRow = int(sqrt(blocksPerNeighborhood))<br>    blockLength = int((width/blocksPerRow)-road)<br>    houseSetbacks = 9<br>    houseQuantity = 9<br>    houseSize = int(blockLength/3) - houseSetbacks<br>    <br>def draw():<br>    background(255)<br>    #make blocks<br>    for b in range(blocksPerNeighborhood):<br>        fill(0, 150, 50)<br>        stroke(50, 50, 50)<br>        strokeWeight(2)<br>        col = b % blocksPerRow<br>        row = b / blocksPerRow<br>        xCol = col*(blockLength+road)<br>        yCol = row*(blockLength+road)<br>        rect(xCol,yCol,blockLength,blockLength)<br>        if b &lt;&gt; 5 and b &lt;&gt;6 and b &lt;&gt;9 and b &lt;&gt;10:<br>         #make houses in surrounding blocks<br>          fill(250,0,0)<br>          stroke(0,0,0)<br>          h = -1<br>        <br>          while h &lt; houseQuantity-1:<br>            h = h+1<br>            if h &lt;&gt; 4:<br>             colhouse = h % 3<br>             rowhouse = h / 3<br>             rect(xCol+colhouse*(houseSize+houseSetbacks),yCol+rowhouse*(houseSize+houseSetbacks),houseSize,houseSize)<br>             print(houseSize)<br>             <br>        for b in (5,6,9,10):<br>         #make houses in central blocks<br>          fill(250,0,0)<br>          stroke(0,0,0)<br>          h = 4<br>          colhouse = h % 3<br>          rowhouse = h / 3<br>          rect(xCol+colhouse*(houseSize+houseSetbacks),yCol+rowhouse*(houseSize+houseSetbacks),houseSize,houseSize)<br>          print(houseSize)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=609c3f6aa81c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-mining-the-city/central-greening-neighbourhood-609c3f6aa81c">Central-greening neighbourhood</a> was originally published in <a href="https://medium.com/data-mining-the-city">Data Mining the City</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>