alns

package
v0.23.5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package alns defines interfaces for Adaptive Large Neighborhood Search.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProgressionEntry

type ProgressionEntry struct {
	ElapsedSeconds float64 `json:"elapsed_seconds"`
	Value          float64 `json:"value"`
}

ProgressionEntry is a single entry in the progression of the solver.

type Progressioner

type Progressioner interface {
	// Progression returns the progression of the solver.
	Progression() []ProgressionEntry
}

Progressioner is an interface that can be implemented by a solver to indicate that is can return the progression of the solver.

type Solution

type Solution[T any] interface {
	// Copy returns a copy of the solution which must be of type T the
	// `derived` type. This copy must be a deep copy.
	Copy() T

	// Score returns the score of the solution.
	Score() float64

	// Random returns the random number generator used by the solution.
	Random() *rand.Rand
}

Solution is a solution to a problem. It defines the minimum interface that a solution must implement to be used in Adaptive Local Neighborhood Search.

type Solutions

type Solutions[T any] <-chan T

Solutions is a channel of solutions.

func (Solutions[T]) Last

func (solutions Solutions[T]) Last() T

Last returns the last solution in the channel.

type Solver

type Solver[T Solution[T], Options any] interface {
	// Solve starts the solving process using the given options. It returns the
	// solutions as a channel.
	Solve(context.Context, Options, ...T) (Solutions[T], error)
}

Solver is an interface that can be implemented by a struct to indicate that it can solve a problem.

Jump to

Keyboard shortcuts

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