bucketorientedfit

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AscendingItemSize

func AscendingItemSize(itemSize1, itemSize2 int) bool

func DescendingItemSize

func DescendingItemSize(itemSize1, itemSize2 int) bool

Types

type BucketOrientedFit

type BucketOrientedFit struct {
	helper.ReorderBucketsByItemsFunc
	ItemOrderComparatorFunc
}

BucketOrientedFit is an optimizer that implements the heuristic algorithm applying items to buckets in specific order defined by bucket order function and item order function. helper.ReorderBucketsByItemsFunc defines the order in which buckets will be filled. ItemOrderComparatorFunc defines the order in which items will be placed into the current bucket. The heuristic name comprises "bucket oriented" since it first reorders buckets, then fills them in defined order using items. The implementation works in O(v*n + v*n*lgv) time.

func (BucketOrientedFit) Optimize

func (b BucketOrientedFit) Optimize(ctx context.Context, data *data.Data) (*optimizer.Result, error)

type Container

type Container struct {
	// contains filtered or unexported fields
}

func NewContainer

func NewContainer(initialItems [][]int, comparatorFunc ItemOrderComparatorFunc) Container

func (Container) GetItems

func (c Container) GetItems(bucketIndex int) []Item

func (Container) MarkAsUsed

func (c Container) MarkAsUsed(item Item)

type Item

type Item struct {
	// contains filtered or unexported fields
}

type ItemOrderComparatorFunc

type ItemOrderComparatorFunc func(itemSize1, itemSize2 int) bool

Jump to

Keyboard shortcuts

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