busrouter

package module
Version: v0.0.0-...-022849c Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

routed Copyright (C) 2020 Rotten Network

This program 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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

routed Copyright (C) 2020 Rotten Network

This program 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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

routed Copyright (C) 2020 Rotten Network

This program 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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

routed Copyright (C) 2020 Rotten Network

This program 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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

routed Copyright (C) 2020 Rotten Network

This program 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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

routed Copyright (C) 2020 Rotten Network

This program 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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

routed Copyright (C) 2020 Rotten Network

This program 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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

routed Copyright (C) 2020 Rotten Network

This program 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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

routed Copyright (C) 2020 Rotten Network

This program 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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

routed Copyright (C) 2020 Rotten Network This program 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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcDistRaw

func CalcDistRaw(pA *Point, pB *Point) float64

func NewBusRouter

func NewBusRouter(dClient DistanceClient, Params Params) *busRouter

func NewPath

func NewPath(constr func(c clusterer.Cluster)) clusterer.Cluster

func NewPathClusterer

func NewPathClusterer(pathCriteria clusterer.Criteria, pathConstructor func(cluster clusterer.Cluster)) *pathClusterer

func NewStop

func NewStop(func(clusterer.Cluster)) clusterer.Cluster

func NewStopClusterer

func NewStopClusterer(stopCriteria clusterer.Criteria, stopConstructor func(clusterer.Cluster)) *stopClusterer

func PassengersToClusterables

func PassengersToClusterables(p []*Passenger) []clusterer.Clusterable

STRUCTS TO INTERFACES

func RemoveFromSlice

func RemoveFromSlice(position int, slice *[]clusterer.Clusterable)

func SearchSlice

func SearchSlice(elem interface{}, slice []clusterer.Clusterable) int

func StopsToClusterables

func StopsToClusterables(s []*Stop) []clusterer.Clusterable

func StopsToClusters

func StopsToClusters(s []*Stop) []clusterer.Cluster

Types

type DistanceClient

type DistanceClient interface {
	CalcDist(context.Context, *Point, *Point, string) (float32, float32, string, error)
	Optimize(context.Context, []*Stop, string) (float32, float32, string, Point, Point, error)
}

type Params

type Params struct {
	StopRadius   float32
	PathRadius   float64
	MaxDistance  float32
	StopCapacity int
	MaxCapacity  int
	MaxDuration  float32
}

type Passenger

type Passenger struct {
	ID       string `json:"id"`
	Location *Point `json:"location"`

	DistanceFromStop float32 `json:"distance_from_stop"`
	DurationToStop   float32 `json:"duration_to_stop"`
	RouteToStop      string  `json:"route_to_stop"`
	Destination      *Point  `json:"Destination"`
	DClient          DistanceClient
	// contains filtered or unexported fields
}

func NewPassenger

func NewPassenger(dClient DistanceClient, id string, location *Point, destination *Point) *Passenger

func (*Passenger) GetDestination

func (p *Passenger) GetDestination() *Point

func (*Passenger) GetLocation

func (p *Passenger) GetLocation() interface{}

func (*Passenger) GetParent

func (p *Passenger) GetParent() clusterer.Cluster

func (*Passenger) GetPoint

func (p *Passenger) GetPoint() *Point

func (*Passenger) RenderPath

func (p *Passenger) RenderPath()

func (*Passenger) SetParent

func (p *Passenger) SetParent(stop clusterer.Cluster)

type Path

type Path struct {
	ID            string                  `json:"id"`
	Center        *Point                  `json:"center"`
	Stops         []clusterer.Clusterable `json:"stops"`
	Capacity      int                     `json:"capacity"`
	Routes        string                  `json:"routes"`
	TotalDistance float32                 `json:"total_distance"`
	TotalDuration float32                 `json:"total_duration"`
	Destination   *Point                  `json:"destination"`
	Origin        *Point                  `json:"origins"`
	DClient       DistanceClient
}

func ClusterToPath

func ClusterToPath(c clusterer.Cluster) *Path

func ClustersToPaths

func ClustersToPaths(c []clusterer.Cluster) []*Path

func (*Path) AddPoint

func (p *Path) AddPoint(point clusterer.Clusterable)

func (*Path) CalculateCenter

func (p *Path) CalculateCenter()

func (*Path) CalculateCost

func (p *Path) CalculateCost() float64

func (*Path) GetCenter

func (p *Path) GetCenter() interface{}

func (*Path) GetID

func (p *Path) GetID() string

func (*Path) GetPoints

func (p *Path) GetPoints() []clusterer.Clusterable

func (*Path) GetStops

func (p *Path) GetStops() []*Stop

func (*Path) LoadD2DStops

func (p *Path) LoadD2DStops(stops []*Stop)

func (*Path) RemovePoint

func (p *Path) RemovePoint(point clusterer.Clusterable)

func (*Path) RenderPath

func (p *Path) RenderPath()

func (*Path) SetCenter

func (p *Path) SetCenter(point interface{})

type Point

type Point struct {
	ID      string  `json:"id"`
	Address string  `json:"Address"`
	Lat     float64 `json:"lat"`
	Lng     float64 `json:"lng"`
}

func NewPoint

func NewPoint(ID string, Address string, lat float64, lng float64) *Point

func (*Point) GetLat

func (p *Point) GetLat() float64

func (*Point) GetLng

func (p *Point) GetLng() float64

func (*Point) ToString

func (p *Point) ToString() string

type Stop

type Stop struct {
	ID         string                  `json:"id"`
	Center     *Point                  `json:"center"`
	Passengers []clusterer.Clusterable `json:"passengers"`
	D2D        bool                    `json:"d2d"`
	Order      int                     `json:"order"`
	// contains filtered or unexported fields
}

func ClusterToStop

func ClusterToStop(c clusterer.Cluster) *Stop

INTERFACES TO STRUCTS

func ClusterablesToStops

func ClusterablesToStops(clusterables []clusterer.Clusterable) []*Stop

func ClustersToStops

func ClustersToStops(c []clusterer.Cluster) []*Stop

func (*Stop) AddPoint

func (s *Stop) AddPoint(p clusterer.Clusterable)

func (*Stop) CalculateCenter

func (s *Stop) CalculateCenter()

func (*Stop) GetCenter

func (s *Stop) GetCenter() interface{}

func (*Stop) GetID

func (s *Stop) GetID() string

func (*Stop) GetLocation

func (s *Stop) GetLocation() interface{}

func (*Stop) GetParent

func (s *Stop) GetParent() clusterer.Cluster

func (*Stop) GetPassengers

func (s *Stop) GetPassengers() []*Passenger

func (*Stop) GetPoints

func (s *Stop) GetPoints() []clusterer.Clusterable

func (*Stop) RemovePoint

func (s *Stop) RemovePoint(p clusterer.Clusterable)

func (*Stop) RenderPassengerPaths

func (s *Stop) RenderPassengerPaths()

func (*Stop) SetCenter

func (s *Stop) SetCenter(point interface{})

func (*Stop) SetParent

func (s *Stop) SetParent(path clusterer.Cluster)

Jump to

Keyboard shortcuts

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