Documentation
¶
Index ¶
- Constants
- func AsGraphPath(solution *discrete.Solution, cfg *data.GraphPath) []int
- func AsPartition(solution *discrete.Solution, values []discrete.Value) [][]discrete.Variable
- func AsPathOrder(solution *discrete.Solution) []discrete.Variable
- func AsSequence(solution *discrete.Solution) []discrete.Variable
- func AsSubset(solution *discrete.Solution) []discrete.Variable
- func ConnectedComponents(graph *ds.Graph, activeEdges ds.EdgeSet) [][]ds.Vertex
- func ConstraintAllUnique(solution *discrete.Solution) bool
- func ConstraintAllVerticesCovered(graph *ds.Graph, vertices []ds.Vertex) discrete.ConstraintFn
- func ConstraintIncreasingSubsequence(cfg *data.Numbers) discrete.ConstraintFn
- func ConstraintNoMachineOverlap(cfg *data.ShopSchedule, tasks []data.Task) discrete.ConstraintFn
- func ConstraintProperVertexColoring(graph *ds.Graph) discrete.ConstraintFn
- func ConstraintRainbowColoring(colors []string) discrete.ConstraintFn
- func ConstraintSimplePath(cfg *data.GraphPath) discrete.ConstraintFn
- func ConstraintSpanningTree(graph *ds.Graph, vertices []ds.Vertex) discrete.ConstraintFn
- func CoreLookupValueOrder(problem *discrete.Problem) discrete.SolutionCoreFn
- func CoreMirroredSequence[T any](items []T) discrete.SolutionCoreFn
- func CoreMirroredValues[T any](p *discrete.Problem, items []T) discrete.SolutionCoreFn
- func CoreSortedCycle[T any](items []T) discrete.SolutionCoreFn
- func CoreSortedPartition[T any](values []discrete.Value, items []T) discrete.SolutionCoreFn
- func CountColorChanges[T comparable](colorSequence []T) int
- func IsClique(graph *ds.Graph, vertices []ds.Vertex) bool
- func IsEulerianPath(graph *ds.Graph, edges []ds.Edge) (bool, [2]ds.Vertex)
- func IsHamiltonianPath(graph *ds.Graph, vertices []ds.Vertex) bool
- func MaxConsecutive(slots []int, limit int) bool
- func MirroredList(sequence []string, separator string) string
- func MirroredSequence(sequence []string) string
- func NoOverlap(tasks []data.Task, keys []string, keyFn func(data.Task) string) discrete.ConstraintFn
- func PartitionStrings[T any](solution *discrete.Solution, values []discrete.Value, items []T) [][]string
- func PartitionSums[T number.Number](solution *discrete.Solution, values []discrete.Value, items []T) []T
- func PathDistances(solution *discrete.Solution, cfg *data.GraphPath) []float64
- func ScoreCountUniqueValues(solution *discrete.Solution) discrete.Score
- func ScorePathCost(cfg *data.GraphPath) discrete.ObjectiveFn
- func ScoreScheduleMakespan(tasks []data.Task) discrete.ObjectiveFn
- func ScoreSubsetSize(solution *discrete.Solution) discrete.Score
- func ScoreSumWeightedSubset(keys []string, weight map[string]float64) discrete.ObjectiveFn
- func ScoreSumWeightedValues(variables []discrete.Variable, weight []float64) discrete.ObjectiveFn
- func SortedCycle(sequence []string, removeTail bool) string
- func SpannedVertices(solution *discrete.Solution, graph *ds.Graph) *ds.Set[ds.Vertex]
- func StringAssignment(p *discrete.Problem, cfg *data.AssignmentCfg) func(*discrete.Solution) string
- func StringEulerianPath(graph *ds.Graph) discrete.SolutionStringFn
- func StringGraphPath(cfg *data.GraphPath) discrete.SolutionStringFn
- func StringMap[T any, V any](p *discrete.Problem, variables []T, values []V) discrete.SolutionStringFn
- func StringPartition[T any](values []discrete.Value, items []T) discrete.SolutionStringFn
- func StringSequence[T any](items []T) discrete.SolutionStringFn
- func StringShopSchedule(tasks []data.Task, machines []string) discrete.SolutionStringFn
- func StringSubset[T cmp.Ordered](items []T) discrete.SolutionStringFn
- func StringValues[T any](p *discrete.Problem, items []T) discrete.SolutionStringFn
Constants ¶
const InvalidSolution string = "Invalid solution"
Variables ¶
This section is empty.
Functions ¶
func AsGraphPath ¶
AsGraphPath returns path formed by solution values (with start, end)
func AsPartition ¶
AsPartition returns the partition from the solution
func AsPathOrder ¶
AsPathOrder returns path index order formed by solution values
func AsSequence ¶
AsSequence returns list of variables sequenced by solution values
func AsSubset ¶
AsSubset assumes BooleanDomain {0,1} and returns list of variables with value=1 in solution
func ConnectedComponents ¶
ConnectedComponents performs BFS traversal multiple times to discover the connected components of the graph, considering the active edge set, and returns the list of components
func ConstraintAllUnique ¶
ConstraintAllUnique makes sure all solution values are unique
func ConstraintAllVerticesCovered ¶
ConstraintAllVerticesCovered makes sure all vertices are covered at least once
func ConstraintIncreasingSubsequence ¶
func ConstraintIncreasingSubsequence(cfg *data.Numbers) discrete.ConstraintFn
ConstraintIncreasingSubsequence makes sure that the subsequence is increasing
func ConstraintNoMachineOverlap ¶
func ConstraintNoMachineOverlap(cfg *data.ShopSchedule, tasks []data.Task) discrete.ConstraintFn
ConstraintNoMachineOverlap checks that the schedule has no machine overlap
func ConstraintProperVertexColoring ¶
func ConstraintProperVertexColoring(graph *ds.Graph) discrete.ConstraintFn
ConstraintProperVertexColoring makes sure all adjacent vertices in the graph have a different color
func ConstraintRainbowColoring ¶
func ConstraintRainbowColoring(colors []string) discrete.ConstraintFn
ConstraintRainbowColoring makes sure all chosen items have different colors
func ConstraintSimplePath ¶
func ConstraintSimplePath(cfg *data.GraphPath) discrete.ConstraintFn
ConstraintSimplePath makes sure solution forms a valid simple path (no repeated vertices)
func ConstraintSpanningTree ¶
ConstraintSpanningTree checks if the solution forms a tree, and all vertices are reachable from tree traversal
func CoreLookupValueOrder ¶
func CoreLookupValueOrder(problem *discrete.Problem) discrete.SolutionCoreFn
CoreLookupValueOrder groups solutions based on the relative order of the solution values
func CoreMirroredSequence ¶
func CoreMirroredSequence[T any](items []T) discrete.SolutionCoreFn
CoreMirroredSequence groups the normal and the reversed sequence as one
func CoreMirroredValues ¶
func CoreMirroredValues[T any](p *discrete.Problem, items []T) discrete.SolutionCoreFn
CoreMirroredValues groups the normal and reversed list of values as one
func CoreSortedCycle ¶
func CoreSortedCycle[T any](items []T) discrete.SolutionCoreFn
CoreSortedCycle groups the normal and sorted cycles as one
func CoreSortedPartition ¶
func CoreSortedPartition[T any](values []discrete.Value, items []T) discrete.SolutionCoreFn
CoreSortedPartition groups similar partitions by using their sorted versions
func CountColorChanges ¶
func CountColorChanges[T comparable](colorSequence []T) int
CountColorChanges counts the number of color changes in the sequence
func IsEulerianPath ¶
IsEulerianPath checks if edge sequence is a valid Eulerian path (visit each edge exactly once) Also returns the head/tail of the sequence
func IsHamiltonianPath ¶
IsHamiltonianPath checks if vertex path is a valid Hamiltonian path (visit each vertex exactly once)
func MaxConsecutive ¶
MaxConsecutive checks that consecutive slot lengths do not exceed the given limit
func MirroredList ¶
MirroredList checks the first and last items if in order; if not, mirrors the list
func MirroredSequence ¶
MirroredSequence checks the first and last items if in order; if not, mirrors the sequence
func NoOverlap ¶
func NoOverlap(tasks []data.Task, keys []string, keyFn func(data.Task) string) discrete.ConstraintFn
NoOverlap checks that the schedule has no overlaps
func PartitionStrings ¶
func PartitionStrings[T any](solution *discrete.Solution, values []discrete.Value, items []T) [][]string
PartitionStrings returns the partition as a list of strings
func PartitionSums ¶
func PartitionSums[T number.Number](solution *discrete.Solution, values []discrete.Value, items []T) []T
PartitionSums returns the sums of each partition group
func PathDistances ¶
PathDistances returns the distance values of the edges in the path
func ScoreCountUniqueValues ¶
ScoreCountUniqueValues counts the number of unique values
func ScorePathCost ¶
func ScorePathCost(cfg *data.GraphPath) discrete.ObjectiveFn
ScorePathCost sums up the path cost
func ScoreScheduleMakespan ¶
func ScoreScheduleMakespan(tasks []data.Task) discrete.ObjectiveFn
ScoreScheduleMakespan computes the makespan (total length) of the schedule
func ScoreSubsetSize ¶
ScoreSubsetSize counts the size of solution as subset
func ScoreSumWeightedSubset ¶
func ScoreSumWeightedSubset(keys []string, weight map[string]float64) discrete.ObjectiveFn
ScoreSumWeightedSubset sums up the weight of the solution subset
func ScoreSumWeightedValues ¶
func ScoreSumWeightedValues(variables []discrete.Variable, weight []float64) discrete.ObjectiveFn
ScoreSumWeightedValues sums up the weighted count of each variable
func SortedCycle ¶
SortedCycle finds the first element in sorted order, Rearrange the sequence so it becomes the first element
func SpannedVertices ¶
SpannedVertices returns the vertices spanned by the tree formed by the given edges
func StringAssignment ¶
StringAssignment displays assignment of {worker = task} Note: didn't explicitly return as SolutionStringFn so it can be reused as SolutionCoreFn
func StringEulerianPath ¶
func StringEulerianPath(graph *ds.Graph) discrete.SolutionStringFn
StringEulerianPath displays the Eulerian path sequence of vertices
func StringGraphPath ¶
func StringGraphPath(cfg *data.GraphPath) discrete.SolutionStringFn
StringGraphPath displays the path sequence of vertices
func StringMap ¶
func StringMap[T any, V any](p *discrete.Problem, variables []T, values []V) discrete.SolutionStringFn
StringMap displays solution as {variable = value}
func StringPartition ¶
func StringPartition[T any](values []discrete.Value, items []T) discrete.SolutionStringFn
StringPartition displays the solution as a partition
func StringSequence ¶
func StringSequence[T any](items []T) discrete.SolutionStringFn
StringSequence displays the solution as sequence of variables
func StringShopSchedule ¶
func StringShopSchedule(tasks []data.Task, machines []string) discrete.SolutionStringFn
StringShopSchedule displays solution as shop schedule (task and machine schedules)
func StringSubset ¶
func StringSubset[T cmp.Ordered](items []T) discrete.SolutionStringFn
StringSubset displays the solution as subset
func StringValues ¶
func StringValues[T any](p *discrete.Problem, items []T) discrete.SolutionStringFn
StringValues displays the solution mapped to given values
Types ¶
This section is empty.