Comments (1)
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)
- Comments on Yannick's code HOT 1
- Beautiful documentation :-)
- A collection of minor comments ... HOT 1
- `ClassMethod` HOT 1
- Change `./code/` to `./src/` HOT 8
- Full replication/code run by external? e.g. Keiran? HOT 9
- Change branch name: `master` -> `main` HOT 2
- Submission HOT 2
- Use random seed for reproducibility HOT 4
- Add brief description to "About" section HOT 3
- Building the environment failed HOT 5
- Great readme! HOT 1
- File paths only work on Yannick's laptop HOT 12
- Can't find `number_of_particles_experiment_MSE.py` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from covpol.