helper

package
v0.0.0-...-80c8c53 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AscendingBucketSizeReorder

func AscendingBucketSizeReorder(bucketSizes []int) []int

AscendingBucketSizeReorder sorts buckets by their size ascending.

func AscendingRelativeSizeReorder

func AscendingRelativeSizeReorder(bucketSizes []int, items [][]int) []int

AscendingRelativeSizeReorder sorts buckets by the total sum of possible items' sizes divided by bucket size in ascending order. Such an approach results in relative ordering: the lower the sum of possible items' sizes in the bucket and the bigger the bucket size, the better.

func AscendingTotalSizeOfItemsInBucketReorder

func AscendingTotalSizeOfItemsInBucketReorder(bucketSizes []int, items [][]int) []int

AscendingTotalSizeOfItemsInBucketReorder sorts buckets by the total sum of possible items' sizes in the bucket in ascending order.

func DescendingBucketSizeReorder

func DescendingBucketSizeReorder(bucketSizes []int) []int

DescendingBucketSizeReorder sorts buckets by their size descending.

func DescendingRelativeSizeReorder

func DescendingRelativeSizeReorder(bucketSizes []int, items [][]int) []int

DescendingRelativeSizeReorder sorts buckets by the total sum of possible items' sizes divided by bucket size in descending order. Such an approach results in relative ordering: the higher the sum of possible items' sizes in the bucket and the smaller the bucket size, the better.

func DescendingTotalSizeOfItemsInBucketReorder

func DescendingTotalSizeOfItemsInBucketReorder(bucketSizes []int, items [][]int) []int

DescendingTotalSizeOfItemsInBucketReorder sorts buckets by the total sum of possible items' sizes in the bucket in descending order.

func NoOpReorder

func NoOpReorder(bucketSizes []int) []int

NoOpReorder doesn't change anything in buckets' order. It returns the initial order of buckets.

func NoOpReorderByItems

func NoOpReorderByItems(bucketSizes []int, _ [][]int) []int

NoOpReorderByItems doesn't change anything in buckets' order. It returns the initial order of buckets.

func RandomReorder

func RandomReorder(bucketSizes []int) []int

RandomReorder permutes buckets in a random fashion.

func ToResult

func ToResult(vehicleAssignment []int, n int) *optimizer.Result

Types

type Bucket

type Bucket struct {
	ID        int
	LeftSpace int
	HeapIndex int
}

type PriorityBucketQueue

type PriorityBucketQueue []*Bucket

func NewPriorityBucketQueue

func NewPriorityBucketQueue(bucketSizes []int) PriorityBucketQueue

func (PriorityBucketQueue) At

func (pq PriorityBucketQueue) At(index int) *Bucket

func (*PriorityBucketQueue) Decrease

func (pq *PriorityBucketQueue) Decrease(b *Bucket, decreaseAmount int)

func (PriorityBucketQueue) Len

func (pq PriorityBucketQueue) Len() int

func (PriorityBucketQueue) Less

func (pq PriorityBucketQueue) Less(i, j int) bool

func (*PriorityBucketQueue) Pop

func (pq *PriorityBucketQueue) Pop() interface{}

func (*PriorityBucketQueue) PopEmptiestBucket

func (pq *PriorityBucketQueue) PopEmptiestBucket() *Bucket

func (*PriorityBucketQueue) Push

func (pq *PriorityBucketQueue) Push(x interface{})

func (*PriorityBucketQueue) PushBucket

func (pq *PriorityBucketQueue) PushBucket(bucket *Bucket)

func (PriorityBucketQueue) Swap

func (pq PriorityBucketQueue) Swap(i, j int)

type ReorderBucketsByItemsFunc

type ReorderBucketsByItemsFunc func(bucketSizes []int, items [][]int) (orderOfBuckets []int)

ReorderBucketsByItemsFunc is a function that defines the order in which buckets will be used during optimization. It is similar to ReorderBucketsFunc but also takes into account items inside the buckets.

type ReorderBucketsFunc

type ReorderBucketsFunc func(bucketSizes []int) (orderOfBuckets []int)

ReorderBucketsFunc is a function that defines the order in which buckets will be used during optimization. It defines the order based on the size of buckets available.

Jump to

Keyboard shortcuts

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