Optimization

package
v0.0.0-...-040724e Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2019 License: BSD-3-Clause, GPL-2.0, BSD-3-Clause, + 1 more Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cost

func Cost(k PointSet1D, problem AssemblyProblem) int

func Distinct

func Distinct(sa []string) []string

func OptimizeAssembly

func OptimizeAssembly(query string, seqs wtype.ReallySimpleAlignment, constraints Constraints) ([][]string, []string)

func ScaledFitnessTest

func ScaledFitnessTest(f int, fs []int) bool

func Transition

func Transition(a, b string) bool

Types

type Assembly

type Assembly struct {
	Method    AssemblyMethod
	Raw       []string
	Assembled []string
}

type AssemblyMethod

type AssemblyMethod interface {
	Name() string                                             // what is this method called
	Type() string                                             // method classification
	CanAssemble([]string) bool                                // can these parts work?
	Validate([]string, string) (bool, error)                  // do these parts make this output?
	Assemble([]string) ([]string, error)                      // what do these parts make?
	Disassemble(string, AssemblyParameters) ([]string, error) // split this sequence into parts
	RawToParts([]string) ([]string, error)                    // convert each part
	PartsToRaw([]string) ([]string, error)                    // return each part to its raw state
}

type AssemblyOptimizer

type AssemblyOptimizer interface {
	OptimizeAssembly(sequences []string, environment AssemblyOptimizerEnvironment, parameters AssemblyOptimizerParameters) AssemblyStrategy
}

type AssemblyOptimizerEnvironment

type AssemblyOptimizerEnvironment struct {
	AssemblyMethods   []AssemblyMethod
	SequenceProviders []SequenceProvider
}

type AssemblyOptimizerParameters

type AssemblyOptimizerParameters interface {
	MethodName() string
	MaxIterations() int
	Set(string, interface{})
	GetInt(string) (int, bool)
	GetFloat(string) (float64, bool)
	GetString(string) (string, bool)
	GetBool(string) (bool, bool)
}

func DefaultParameters

func DefaultParameters() AssemblyOptimizerParameters

type AssemblyParameters

type AssemblyParameters interface {
	SplitPoints() []int
}

type AssemblyProblem

type AssemblyProblem struct {
	Mutations PointSet2D // set of mutations
	Seq       string     // actual sequence
}

type AssemblyStep

type AssemblyStep struct {
	Assemblies []Assembly
}

type AssemblyStrategy

type AssemblyStrategy struct {
	Cost   int            // in pence
	Steps  []AssemblyStep // ordered
	Orders map[string]SequenceProvider
}

type Constraints

type Constraints struct {
	MaxSplits     int
	MinLen        int
	MaxLen        int
	MinDistToMut  int
	Query         string
	EndsToAvoid   []string
	EndLen        int
	NoTransitions bool
}

func DefaultConstraints

func DefaultConstraints() Constraints

type FitnessValues

type FitnessValues struct {
	Fit        []int
	BestScore  int
	BestMember PointSet1D
}

type GAParameters

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

func NewGAParameters

func NewGAParameters() GAParameters

func (GAParameters) GetBool

func (gmp GAParameters) GetBool(s string) (bool, bool)

func (GAParameters) GetFloat

func (gmp GAParameters) GetFloat(s string) (float64, bool)

func (GAParameters) GetInt

func (gmp GAParameters) GetInt(s string) (int, bool)

func (GAParameters) GetString

func (gmp GAParameters) GetString(s string) (string, bool)

func (GAParameters) MaxIterations

func (gap GAParameters) MaxIterations() int

func (GAParameters) MethodName

func (gap GAParameters) MethodName() string

func (GAParameters) Set

func (gmp GAParameters) Set(s string, v interface{})

type Point2D

type Point2D struct {
	X int
	Y int
}

type Point3D

type Point3D struct {
	X int
	Y int
	Z int
}

type PointSet1D

type PointSet1D []int

func NewMember

func NewMember(problem AssemblyProblem, constraints Constraints, parameters AssemblyOptimizerParameters) PointSet1D

func (PointSet1D) Dup

func (ps1D PointSet1D) Dup() PointSet1D

type PointSet2D

type PointSet2D []Point2D

func (PointSet2D) Len

func (ps2d PointSet2D) Len() int

func (PointSet2D) Less

func (ps2d PointSet2D) Less(i, j int) bool

func (PointSet2D) MinDistTo

func (ps2d PointSet2D) MinDistTo(i int) int

func (PointSet2D) Swap

func (ps2d PointSet2D) Swap(i, j int)

type PointSet3D

type PointSet3D []Point3D

func (PointSet3D) Len

func (ps3d PointSet3D) Len() int

func (PointSet3D) Less

func (ps3d PointSet3D) Less(i, j int) bool

func (PointSet3D) Swap

func (ps3d PointSet3D) Swap(i, j int)

type Population

type Population struct {
	Members     []PointSet1D
	Problem     AssemblyProblem
	FitnessTest func(f int, fs []int) bool
}

func NewPop

func NewPop(problem AssemblyProblem, constraints Constraints, parameters AssemblyOptimizerParameters) *Population

func (*Population) Assess

func (pop *Population) Assess() FitnessValues

func (*Population) Mutate

func (*Population) Pick

func (*Population) Recombine

func (p *Population) Recombine(m1, m2 PointSet1D, prm AssemblyOptimizerParameters, cnstr Constraints) PointSet1D

func (*Population) Regenerate

func (p *Population) Regenerate(scores FitnessValues, prm AssemblyOptimizerParameters, cnstr Constraints) *Population

type SeqSet

type SeqSet []string

func (SeqSet) SplitAt

func (ss SeqSet) SplitAt(p int) (Before, After SeqSet, e error)

p in [0,len(ss[...])-1]

func (SeqSet) Valid

func (ss SeqSet) Valid() bool

type SequenceProvider

type SequenceProvider interface {
	Name() string
	MethodsImplemented() []string
	GetMethod(string) AssemblyMethod
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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