mirror of
https://github.com/gonum/gonum.git
synced 2025-10-18 21:15:23 +08:00
Updated cost functions
This commit is contained in:
9
graph.go
9
graph.go
@@ -97,7 +97,7 @@ type CrunchGraph interface {
|
|||||||
// If no edge exists between node1 and node2, the cost should be taken to be +inf (can be gotten
|
// If no edge exists between node1 and node2, the cost should be taken to be +inf (can be gotten
|
||||||
// by math.Inf(1).)
|
// by math.Inf(1).)
|
||||||
type Coster interface {
|
type Coster interface {
|
||||||
Cost(node1, node2 Node) float64
|
Cost(edge Edge) float64
|
||||||
}
|
}
|
||||||
|
|
||||||
// Guarantees that something implementing Coster is also a Graph.
|
// Guarantees that something implementing Coster is also a Graph.
|
||||||
@@ -177,5 +177,8 @@ type DStarGraph interface {
|
|||||||
ChangedEdges() (newCostFunc func(Node, Node) float64, changedEdges []Edge)
|
ChangedEdges() (newCostFunc func(Node, Node) float64, changedEdges []Edge)
|
||||||
}
|
}
|
||||||
|
|
||||||
// A function that returns the cost from one node to another.
|
// A function that returns the cost of following an edge
|
||||||
type CostFunc func(Node, Node) float64
|
type CostFunc func(Edge) float64
|
||||||
|
|
||||||
|
// Estimates the cost of travelling between two nodes
|
||||||
|
type HeuristicCostFunc func(Node, Node) float64
|
||||||
|
Reference in New Issue
Block a user