router

package
v1.8.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 换乘的惩罚时间(单位:秒)拍脑袋定的
	STATION_TRANSFER_PENALTY      = 1500
	SUBWAY_STATION_TRANSFER_RATIO = 1.0
	BUS_STATION_TRANSFER_RATIO    = 1.3
	// 途径车站的停车时间
	STATION_PASSBY_TIME = 15
	// 去另一个车站换乘的额外用时(单位:秒)拍脑袋定的
	WALK_LANE_TRANSFER_PENALTY = 300
	// 公交速度
	BUS_SPEED = 40 / 3.6
	// 地铁速度
	SUBWAY_SPEED = 100 / 3.6
	// 车站内换乘边的id
	TRANSFER_SUBLINE_ID = int32(math.MaxInt32)
	// 在同一个TAZ之内选取的公交站起点数量
	SAME_TAZ_STATION_NODES = 10
	// 行人乘坐公交车可忍受的最大步行时长(s)
	MAX_WALKING_TOLERATE_TIME = 60 * 35
	// 行人乘坐公共交通可忍受的最大时长(s)
	MAX_BUS_TOLERATE_TIME = 3600 * 6
	// 行人换乘最大距离(m)
	MAX_TRANSFER_WALKING_DISTANCE = 200
)
View Source
const (
	// 路口带来的额外用时(单位:秒)除了左转其他数字都是拍脑袋定的
	TURN_STRAIGHT_TIME_PENALTY = 15
	TURN_LEFT_TIME_PENALTY     = 60 // Stamatiadis, Nikiforos, Kenneth R. Agent, and Apostolos Bizakis. "Guidelines for left-turn phasing treatment." Transportation Research Record 1605.1 (1997): 1-7. 有保护左转相对来说会带来60-70秒的延迟
	TURN_RIGHT_TIME_PENALTY    = 5
	TURN_AROUND_TIME_PENALTY   = 1.5 * TURN_LEFT_TIME_PENALTY

	// road id与junction id的切分点
	ROAD_JUNCTION_SPLIT = 3_0000_0000

	// 车辆速度
	VEHICLE_SPEED = 60 / 3.6
)
View Source
const (
	PERSON_SPEED = 1.1
)

Variables

View Source
var (
	SAME_TAZ_DISTANCES = [7]float64{
		600, 840, 1080, 1320, 1560, 1800,
	}
)

Functions

This section is empty.

Types

type Aoi

type Aoi struct {
	*mapv2.Aoi

	CenterPoint                       geometry.Point
	DriveOutNodeId, DriveInNodeId     int
	WalkOutNodeId, WalkInNodeId       int
	StationOutNodeId, StationInNodeId int
	StationTazCosts                   map[algo.TazPair][]algo.TazCost // 乘指定线路到达指定TAZ的cost
	SublineTazCosts                   map[int32][]algo.TazCost        // 经过此车站的所有线路到达指定TAZ的cost
	StationTaz                        algo.TazPair                    // 车站所在TAZ
	IsStation                         bool                            // 是否是车站
}

type BusHeuristics added in v1.8.0

type BusHeuristics struct {
}

func (BusHeuristics) HeuristicBus added in v1.8.0

func (h BusHeuristics) HeuristicBus(attrNode algo.BusNodeAttr, fromEdgeAttrs []*algo.BusEdgeAttr, pEnd geometry.Point, time float64) float64

func (BusHeuristics) HeuristicEuclidean added in v1.8.0

func (h BusHeuristics) HeuristicEuclidean(p1 geometry.Point, p2 geometry.Point) float64

type BusRouteResult added in v1.8.0

type BusRouteResult struct {
	StartWalkSegments []*routingv2.WalkingRouteSegment
	StartWalkCost     float64
	TransferSegment   []*routingv2.TransferSegment
	TransferCost      float64
	EndWalkSegments   []*routingv2.WalkingRouteSegment
	EndWalkCost       float64
	Err               error
}

func (*BusRouteResult) BusRouteResultCost added in v1.8.0

func (r *BusRouteResult) BusRouteResultCost() float64

type DriveHeuristics added in v1.8.0

type DriveHeuristics struct {
}

func (DriveHeuristics) HeuristicBus added in v1.8.0

func (h DriveHeuristics) HeuristicBus(nodeAttr algo.DriveNodeAttr, fromEdgeAttrs []algo.DriveEdgeAttr, pEnd geometry.Point, time float64) float64

func (DriveHeuristics) HeuristicEuclidean added in v1.8.0

func (h DriveHeuristics) HeuristicEuclidean(p1 geometry.Point, p2 geometry.Point) float64

type Lane

type Lane struct {
	*mapv2.Lane

	Speeds []float64

	// o----o----o------o :Nodes
	//      |    |
	//     AOI  AOI
	WalkNodeIds map[int]int         // Head, Tail
	Nodes       []algo.WalkLaneNode // 所有,包含Head和Tail和中间的AOI
	// contains filtered or unexported fields
}

func (*Lane) GetPositionByS

func (l *Lane) GetPositionByS(s float64) (pos geometry.Point)

将当前车道s坐标转换为xy坐标

type MongoPath

type MongoPath struct {
	DB  string
	Col string
}

type PublicSubline added in v1.8.0

type PublicSubline struct {
	*mapv2.PublicTransportSubline
	StationPairs map[StationIdPairs]bool
	InStationIds map[int32]int
	SameLineID   int32
}

type Road

type Road struct {
	*mapv2.Road

	DriveHeadNodeId, DriveTailNodeId int
	// road内的driving lanes
	DrivingLanes []*Lane
}

type Router

type Router struct {
	// contains filtered or unexported fields
}

func New

func New(
	mapData *mapv2.Map,

	roadStatus *routingv2.RoadStatuses,
) *Router

func (*Router) Close

func (r *Router) Close()

close

func (*Router) GetRoadCost

func (r *Router) GetRoadCost(roadId int32, time *float64) (float64, error)

func (*Router) HasAoiID

func (r *Router) HasAoiID(id int32) bool

func (*Router) HasLaneID

func (r *Router) HasLaneID(id int32) bool

func (*Router) HasRoadLaneID

func (r *Router) HasRoadLaneID(id int32) bool

func (*Router) Roads

func (r *Router) Roads() map[int32]*Road

func (*Router) SearchBus added in v1.8.0

func (*Router) SearchDriving

func (r *Router) SearchDriving(
	start, end *geov2.Position, time float64,
) (roadIDs []int32, cost float64, err error)

func (*Router) SearchWalking

func (r *Router) SearchWalking(
	start, end *geov2.Position, time float64,
) (segments []*routingv2.WalkingRouteSegment, cost float64, err error)

func (*Router) SetRoadCost

func (r *Router) SetRoadCost(roadId int32, cost float64, time *float64) error

type SearchLane

type SearchLane struct {
	Head int
	Tail int
	S    float64
}

type StationIdPairs added in v1.8.0

type StationIdPairs struct {
	FromID int32
	ToID   int32
}

type TransportationAnalysisZone added in v1.8.0

type TransportationAnalysisZone struct {
	StationIds []int32
}

type TransportationAnalysisZoneInfo added in v1.8.0

type TransportationAnalysisZoneInfo struct {
	// contains filtered or unexported fields
}

type WalkHeuristics added in v1.8.0

type WalkHeuristics struct {
}

func (WalkHeuristics) HeuristicBus added in v1.8.0

func (h WalkHeuristics) HeuristicBus(attr algo.WalkNodeAttr, fromEdgeAttrs []*routingv2.WalkingRouteSegment, pEnd geometry.Point, time float64) float64

func (WalkHeuristics) HeuristicEuclidean added in v1.8.0

func (h WalkHeuristics) HeuristicEuclidean(p1 geometry.Point, p2 geometry.Point) float64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL