isso

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 5 Imported by: 0

README

isso - Iterative Sampling Schedule Optimization

Test status Coverage Status Go Report Card Go Reference GitHub MIT license

isso is a Go library and CLI app for optimizing sampling schedules under constrained capacity and with potential sample re-use.

CLI usage

Run the included examples like this...

The default test problem:

go run ./cmd/isso -i data/problem.json

A pareto optimization example:

go run ./cmd/isso -i data/pareto.json --pareto --format fitness

See folder data for problem definition examples.

License

This project is distributed under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Subject       string
	Matrix        string
	Reuse         string
	Time          int
	Samples       int
	TargetSamples int
}

Action definition.

type ActionDef

type ActionDef struct {
	Subject       subject
	Matrix        matrix
	Reuse         subject
	Time          int
	Samples       int
	TargetSamples int
}

ActionDef for internal use, using no strings. It needs to be public as it is used in fitness evaluators.

type Comparator

type Comparator[F any] interface {
	Compare(a, b F) int
	IsPareto() bool
}

Comparator interface or comparing fitness values.

type Evaluator

type Evaluator[F any] interface {
	Evaluate(s []ActionDef) F
}

Evaluator interface or deriving fitness from a solution.

type Matrix

type Matrix struct {
	Name     string
	CanReuse []string
}

Matrix definition.

type Problem

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

Problem definition.

func NewProblem

func NewProblem(problem ProblemDef) Problem

NewProblem creates a new problem definition.

type ProblemDef

type ProblemDef struct {
	Matrices     []Matrix
	Capacity     []int
	Requirements []Requirement
}

type Requirement

type Requirement struct {
	Subject string
	Matrix  string
	Times   []int
	Samples int
}

Requirement definition.

type Solution

type Solution[F any] struct {
	Fitness F
	Actions []Action
}

Solution, translated back to using strings for subject and matrix.

func (*Solution[F]) ToCSV added in v0.3.0

func (s *Solution[F]) ToCSV(index int, sep string) string

ToCSV formats the solution as a CSV table.

func (*Solution[F]) ToList added in v0.3.0

func (s *Solution[F]) ToList() string

ToList formats the solution as list for printing.

func (*Solution[F]) ToTable added in v0.3.0

func (s *Solution[F]) ToTable() string

ToTable formats the solution as a table for printing.

type Solver

type Solver[F comparable] struct {
	// contains filtered or unexported fields
}

Solver for optimization.

func NewSolver

func NewSolver[F comparable](evaluator Evaluator[F], comparator Comparator[F]) Solver[F]

NewSolver creates a new solver for a given fitness function.

func (*Solver[F]) Solve

func (s *Solver[F]) Solve(problem *Problem) ([]Solution[F], bool)

Solve the given problem.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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