Skip to main content

Object-oriented framework for modeling of mobile agents.

Project description

A Python framework for modeling mobile agents.

doc/frames.png

Read the full documentation.

https://readthedocs.org/projects/road-agent/badge/?version=latest

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.2.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

road_agent-0.0.2-py2-none-any.whl (17.6 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page