资源简介
SUMO Simulation of Urban MObility is an open source highly portable microscopic and continuous road traffic simulation package designed to handle large road networks It is mainly developed by employees of the Institute of Transportation Systems at the German Aerospace Center SUMO is open source licensed under the GPL ">SUMO Simulation of Urban MObility is an open source highly portable microscopic and continuous road traffic simulation package designed to handle large road networks It is mainly developed by employees of the Institute of Transportation Systems at the German Aerospace Center SUMO is open sourc [更多]
代码片段和文件信息
#!/usr/bin/env python
“““
@file agentManager.py
@author Michael Behrisch
@author Daniel Krajzewicz
@date 2008-10-09
@version $Id: agentManager.py 14678 2013-09-11 08:53:06Z behrisch $
Control the CityMobil parking lot with a multi agent system.
SUMO Simulation of Urban MObility; see http://sumo.sourceforge.net/
Copyright (C) 2008-2012 DLR (http://www.dlr.de/) and contributors
This file is part of SUMO.
SUMO is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License or
(at your option) any later version.
“““
import vehicleControl statistics
from constants import *
class PersonAgent:
def __init__(self id):
self.id = id
def startRequest(self source target cybers):
minCost = INFINITY
minCar = None
for car in cybers:
cost = car.request(self source target)
if (cost < minCost):
if minCar:
minCar.reject(self)
minCar = car
minCost = cost
else:
car.reject(self)
minCar.accept(self)
class Task:
def __init__(self person source target estCost):
self.person = person
self.source = source
self.target = target
self.estCost = estCost
self.startStep = None
def __repr__(self):
return “<%s %s %s %s>“ % (self.person.id self.source self.target self.startStep)
class CyberAgent:
def __init__(self id):
self.id = id
self.load = 0
self.pending = {}
self.tasks = []
self.running = []
self.costMatrix = {}
self.totalEstimatedCost = 0
self.position = None
self.broken = False
def request(self person source target):
if self.broken:
estCost = INFINITY
elif (source target) in self.costMatrix:
estCost = self.costMatrix[(source target)]
else:
estCost = 2 * DOUBLE_ROWS * ROW_DIST / CYBER_SPEED
self.pending[person] = Task(person source target estCost)
return self.totalEstimatedCost + estCost
def accept(self person):
task = self.pending[person]
self.tasks.append(task)
self.totalEstimatedCost += task.estCost
del self.pending[person]
def reject(self person):
del self.pending[person]
def _findNextTarget(self wait):
minTarget = “z“
minDownstreamTarget = “z“
minSource = “z“
minDownstreamSource = “z“
edge = vehicleControl.getPosition(self.id)
if edge == “cyberin“:
edge = “cyber“
for task in self.running:
if task.target < minTarget:
minTarget = task.target
if task.target < minDownstreamTarget and task.target > edge:
minDownstreamTar
相关资源
- 城市交通仿真平台SUMO(V1.3).pdf
- Manifold learning theory and applications2011清
- ns2中文手册
- wintwins23
- sumo用户手册
- 这是我做的一个基于NS2的ADHOC网络路由
- AODV路由协议NS2仿真
- NS2 资料全集 中文版
- ns50ns25.5.4.0r28.0
- NS2网络模拟教学应用
- ns2中AOMDV_Scheduling源代码以及评测
- 基于NS2的Ad Hoc网络AODV路由协议仿真
- SUMO-交通仿真.rar
- 基于NS2的DDoS攻防模拟系统研究与实现
- vanet-highway
- ns2安装与学习,包括安装文件及安装
- sumo仿真教程
- ns2的trace文件分析
- zigbee协议在ns2下的仿真源代码
- 城市交通仿真平台SUMO(V1.3)
- NS3中的VANET仿真
- Wavelet Theory:An elementary Approach With A
- OMNeT++相关文档2,包含了sumo
- OceanStor_SNS2120&5120_光纤交换机_产品文
- jenkins2.19经典插件合集
- jenkins-2.121.2-1.1.noarch.rpm
- 交通仿真软件sumo-win64
- ns-allinone-2.35.tar.gz Linux安装包
- ns2仿真实验
- NuhertzFilterSolutions2019.V.16.0.0.zip
评论
共有 条评论