Object-oriented framework for modeling of mobile agents.
Project description
A Python framework for modeling mobile agents.
Read the full documentation.
Installation
Install library using pip:
$ pip install road-agent
Install dependency: BRouter
Agents use BRouter for routing. Here’s how to install a local server.
BRouters needs data files for its routing algorithm. Download data files (rd5) into segments4 dir. You may copy-paste these steps to download them all, but beware: it’s about 5.2 gigabytes:
mkdir -p ~/opt/brouter/segments4 cd ~/opt/brouter/segments4 wget https://gitlab.com/rgarcia-herrera/road-agent/raw/master/get_segments.sh wget https://gitlab.com/rgarcia-herrera/road-agent/raw/master/segments.txt chmod +x get_segments.sh ./get_segments.sh
Download and unzip BRouter (replace ~/opt/ with your preferred install dir and 1_4_11 with latest version):
cd ~/opt/brouter wget http://brouter.de/brouter_bin/brouter_1_4_11.zip unzip brouter_1_4_11.zip chmod +x ./standalone/server.sh
Run server.sh to start BRouter server.
Create a simulation
To create a simulation one must extend the Agent class:
from LatLon import LatLon, Latitude, Longitude from road_agent import Agent # extend Agent class to code behaviours specific to your mobile agent class Bike(Agent): pass point = LatLon(Latitude(19.40141579973), Longitude(-99.1043955014)) dest = LatLon(Latitude(19.44658420026), Longitude(-99.15200449858)) # create bike instance b = Bike(point=point, dest=dest) # download from route server b.update_route() # traverse agent's route, step by step for t in range(len(b.route)): b.step()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
road_agent-0.0.3.tar.gz
(5.0 kB
view hashes)
Built Distribution
road_agent-0.0.3-py2-none-any.whl
(17.7 kB
view hashes)
Close
Hashes for road_agent-0.0.3-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f25634b89d38a213083a56659301e5e349c1cacd1b9247ca3a4c4238857692d6 |
|
MD5 | a3dfc72a9647dadfdf899ecfeb91c09b |
|
BLAKE2b-256 | 7df69f7408fb968e2a11ccf36af475a7fee6e44bb48512f2a54f88911fac4d17 |