routing

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: Unlicense Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STOPPED = iota + 1
	RUNNING
	PAUSED
	PREPARING

	STARTED
	FINISHED
	HOMEWARD
	OUTWARD
	RESTING
)
View Source
const DIRECTED_GRAPH = false

directed graph uses oneway, causes problems

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionType

type ActionType int

type Feature

type Feature struct {
	Type string  `json:"type" bson:"type"`
	Geom GeoJSON `json:"geometry" bson:"geom" db:"-"`
	POI  *POI    `json:"properties" bson:"properties"`
}

type FeatureCollection

type FeatureCollection struct {
	Type    string     `json:"type" bson:"type"`
	Feature *[]Feature `json:"features" bson:"features"`
	Name    string     `json:"name" bson:"name"`
}

func ReadAllPOIs

func ReadAllPOIs() (*FeatureCollection, error)

type Fleet

type Fleet struct {
	Trucks map[string]*Truck
	Orders map[string]*Order
}

func GetINSTANCE added in v0.0.2

func GetINSTANCE() *Fleet

func (Fleet) StartOrder

func (fleet Fleet) StartOrder(orderName string, truckName string, startNodeId int) error

type GeoJSON added in v0.0.2

type GeoJSON struct {
	Type        string    `json:"type" bson:"type"`
	Coordinates []float64 `json:"coordinates" bson:"coordinates"`
}

{"type":"Point","coordinates":[12.4045328,51.7979734]}

type Node

type Node struct {
	ID  int64   `json:"id" bson:"_id" db:"id"`
	Lon float64 `json:"lon" bson:"lon" db:"lon"`
	Lat float64 `json:"lat" bson:"lat" db:"lat"`
}

func FindNearestNodeForPOI

func FindNearestNodeForPOI(id int) (*Node, error)

type Order

type Order struct {
	Name  string `json:"name" bson:"name"`
	Truck string `json:"truck" bson:"truck"`
	Tsp   Tsp
}

type POI

type POI struct {
	ID       int64  `json:"id" bson:"_id" db:"fid"`
	Osm_ID   string `json:"osm_id" bson:"osm_id" db:"osm_id"`
	Name     string `json:"name" bson:"name"`
	GeomJSON string `db:"geom" json:"-"`
}

type Position

type Position struct {
	Lon float64 `json:"lon" bson:"lon"`
	Lat float64 `json:"lat" bson:"lat"`
}

type PostionEvent added in v0.0.2

type PostionEvent struct {
	ID       int64     `json:"id" bson:"_id"`
	Name     string    `json:"name" bson:"name"`
	Position Position  `json:"pos" bson:"pos"`
	Time     time.Time `json:"time" bson:"time"`
}

type Route

type Route struct {
	ID          int64       `json:"id" bson:"_id"`
	Name        string      `json:"name" bson:"name"`
	Source      int         `json:"source" bson:"source"`
	Target      int         `json:"target" bson:"target"`
	Type        string      `json:"type" bson:"type"`
	Coordinates [][]float64 `json:"coordinates" bson:"coordinates"`
}

type RouteEvent

type RouteEvent struct {
	ID    int64  `json:"id" bson:"_id"`
	Name  string `json:"name" bson:"name"`
	Route Route  `json:"route" bson:"route"`
}

type Truck

type Truck struct {
	ID         int64      `json:"id" bson:"_id"`
	Name       string     `json:"name" bson:"name"`
	Position   *Position  `json:"pos" bson:"pos"`
	Route      *Route     `json:"route" bson:"route"`
	Base       int64      `json:"base" bson:"base"`
	ActionType ActionType `json:"action" bson:"action"`
}

func NewTruck

func NewTruck(name string) *Truck

func (*Truck) SetActionType

func (truck *Truck) SetActionType(ActionType ActionType)

func (*Truck) StartOrder

func (truck *Truck) StartOrder(order *Order)

type TruckActionEvent

type TruckActionEvent struct {
	ID         int64      `json:"id" bson:"_id"`
	Name       string     `json:"name" bson:"name"`
	ActionType ActionType `json:"action" bson:"action"`
}

type Tsp

type Tsp struct {
	Start int       `json:"start" bson:"start"`
	Steps []TspStep `json:"steps" bson:"steps"`
}

func CalculateTSP

func CalculateTSP(start int) (*Tsp, error)

type TspStep

type TspStep struct {
	Seq     int     `json:"seq" bson:"seq"`
	Node    int64   `json:"node" bson:"node"`
	Cost    float64 `json:"cost" bson:"cost"`
	AggCost float64 `json:"agg_cost" bson:"agg_cost"`
}

Jump to

Keyboard shortcuts

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