d

package
v0.0.0-...-eed23ce Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetVerbose

func GetVerbose() bool

GetVerbose reports the current verbosity of this package.

Iff true some detailed processing information may be logged.

func GetVerboseM

func GetVerboseM() bool

GetVerboseM returns the verbosity of package m.

func GetVerboseX

func GetVerboseX() bool

GetVerboseX returns the verbosity of package x.

func LogGoal

func LogGoal(a *D)

LogGoal sends a titled "Solution:" to the current logger.

func SetVerbose

func SetVerbose(v bool)

SetVerbose controls the verbosity of this package.

Iff true some detailed processing information may be logged.

func SetVerboseM

func SetVerboseM(v bool)

SetVerboseM sets the verbosity of package m to v.

func SetVerboseX

func SetVerboseX(v bool)

SetVerboseX sets the verbosity of package x to v.

Types

type D

type D struct {
	x.Name     // the name of the alorithm in use
	m.M        // the problem Matrix
	*L         // the local backtracking data - for visitors
	*drum.Drum // the update Drum - incremented in DoHide
	*On        // the plug-in functions: what to do when
	// contains filtered or unexported fields
}

D consolidates the data of a dancer.

func AlgorithmC

func AlgorithmC(M func() m.M, setters ...do.Option) D

AlgorithmC returns (a pointer to) a fresh Searcher with silent default settings.

func AlgorithmX

func AlgorithmX(M func() m.M, setters ...do.Option) D

AlgorithmX returns (a pointer to) a fresh Searcher with silent default settings.

func RecursiveC

func RecursiveC(M func() m.M, setters ...do.Option) D

RecursiveC returns (a pointer to) a fresh Searcher with silent default settings.

func RecursiveX

func RecursiveX(M func() m.M, setters ...do.Option) D

RecursiveX returns (a pointer to) a fresh Searcher with silent default settings.

func (*D) Permille

func (a *D) Permille() int

Permille returns an estimate of the completion of a search based on the results of OptionCellIsKofN of each option cell found in the current backtrack buffer (as of formula (27)) as truncated integer permille (%o) value.

Note: As of now, OptionCellIsKofN is neither stored nor memoized and thus is a little costly - use with care (if at all) when performance is a priority.

func (*D) Search

func (a *D) Search(from ...x.Index)

Search is what a Searcher is busy doing after OnInit and before OnDone.

func (*D) SearchFrom

func (a *D) SearchFrom(from []x.Index)

SearchFrom is what a Searcher is busy doing after winding down to from and before rewinding back from from so he may try again from elsewhere.

func (*D) Settings

func (a *D) Settings(doit ...do.Option) do.Opt

Settings applies the Setters and returns its undo function which, when evaluated, fully restores the previous setup.

func (*D) ShowGoal

func (a *D) ShowGoal(title string) string

ShowGoal returns a human-readable generic presentation of a solution preceded by a title, iff some is given.

func (*D) ShowOption

func (a *D) ShowOption() string

ShowOption returns a generic human-readable presentation of all options found in the current backtrack buffer.

func (*D) WrapIt

func (a *D) WrapIt(fs ...func(*D)) do.It

WrapIt returns a do.It which wraps the given functions applied to a.

func (*D) WrapNok

func (a *D) WrapNok(fs ...func(*D) bool) do.Nok

WrapNok returns a do.Ok which wraps the given functions applied to a.

func (*D) WrapOk

func (a *D) WrapOk(fs ...func(*D) bool) do.Ok

WrapOk returns a do.Ok which wraps the given functions applied to a.

func (*D) WriteTitle

func (a *D) WriteTitle(b *strings.Builder, title string)

WriteTitle writes a title line (iff not empty) preceded by D.Name and M.Name into the provided strings.Builder.

func (*D) WriteTitleLine

func (a *D) WriteTitleLine(b *strings.Builder, title string)

WriteTitleLine writes a title line (iff not empty) preceded by D.Name and M.Name into the provided strings.Builder.

type L

type L struct {
	x.Cells // the buffer of cells visited per level - compose the solution
	// contains filtered or unexported fields
}

L consolidates local backtracking data and may be visited by On actions.

type On

type On struct {
	Init do.It // optional: Called on Open/Entry/Start/Begin
	Done do.It // optional: Called on Done/Exit/Finished/End

	Skip do.Nok // optional: Called per Enter-Level
	Goal do.It  // optional: Called per Solution
	Fail do.It  // optional: Called per Deadend
	Leaf do.It  // optional: Called per Update
	// contains filtered or unexported fields
}

On consolidates what controls behaviour.

func (On) GetDone

func (a On) GetDone() *do.It

GetDone returns (a pointer to) the function On.Done.

func (On) GetFail

func (a On) GetFail() *do.It

GetFail returns (a pointer to) the function On.Fail.

func (On) GetGoal

func (a On) GetGoal() *do.It

GetGoal returns (a pointer to) the function On.Goal.

func (On) GetInit

func (a On) GetInit() *do.It

GetInit returns (a pointer to) the function On.Init.

func (On) GetLeaf

func (a On) GetLeaf() *do.It

GetLeaf returns (a pointer to) the function On.Leaf.

func (On) GetSkip

func (a On) GetSkip() *do.Nok

GetSkip returns (a pointer to) the function On.Skip.

Jump to

Keyboard shortcuts

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