Giter Club home page Giter Club logo

Comments (1)

yannickoswald avatar yannickoswald commented on June 4, 2024

this was a pretty odd design choice, true, but i am pretty sure that i deleted some of the unnecessary things in the agent class already. because as far as i can tell none of the loaded data up there in the agent class was actually necessary for that module. And I remember deleting those things. I think somethin went wrong with the version control here at some point.

however, i now did change things again and made the following necessary function a method

   
    ### this a function from here
    ### https://www.geeksforgeeks.org/program-distance-two-points-earth/
    ### for calculating the distance between points on earth
    
    def geo_distance(self, lat1, lat2, lon1, lon2):
            # The math module contains a function named
            # radians which converts from degrees to radians.
            lon1 = radians(lon1)
            lon2 = radians(lon2)
            lat1 = radians(lat1)
            lat2 = radians(lat2)
            # Haversine formula
            dlon = lon2 - lon1
            dlat = lat2 - lat1
            a = sin(dlat / 2)**2 + cos(lat1) * cos(lat2) * sin(dlon / 2)**2
            c = 2 * asin(sqrt(a))
            # Radius of earth in kilometers. Use 3956 for miles
            r = 6371
            # calculate the result
            return c * r

And also defined the necessary constants just as agent properties

       #### of variables across agent and important 
       #### for the computation of the distance metric
       self.range_income = 117075.04
       self.range_politicalregime = 8.739999999999998
        ## max distance between two points on earth =
        ## earth circumference divided by two
       self.max_distance_on_earth = 40075.017/2 ```

from covpol.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.