Help us shape the future of Go! Take the 2026 Go Developer Survey

solver

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeppySolver

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

DeppySolver is a simple solver implementation that takes an entity source group and a constraint aggregator to produce a Solution (or error if no solution can be found)

func NewDeppySolver

func NewDeppySolver(variableSource input.VariableSource) *DeppySolver

func (DeppySolver) Solve

func (d DeppySolver) Solve(ctx context.Context, options ...Option) (*Solution, error)

type Option

type Option func(solutionOptions *solutionOptions)

func AddAllVariablesToSolution

func AddAllVariablesToSolution() Option

AddAllVariablesToSolution is a Solve option that instructs the solver to include all the variables considered to the Solution it produces

type Solution

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

Solution is returned by the Solver when the internal solver executed successfully. A successful execution of the solver can still end in an error when no solution can be found.

func (*Solution) AllVariables

func (s *Solution) AllVariables() []deppy.Variable

AllVariables returns all the variables that were considered by the solver to obtain (or not) a solution. Note: This is only be present if the AddAllVariablesToSolution option is passed in to the Solve call that generated the solution.

func (*Solution) Error

func (s *Solution) Error() error

Error returns the resolution error in case the problem is unsat on successful resolution, it will return nil

func (*Solution) IsSelected

func (s *Solution) IsSelected(identifier deppy.Identifier) bool

IsSelected returns true if the variable identified by the identifier was selected in the solution by the resolver. It will return false otherwise.

func (*Solution) SelectedVariables

func (s *Solution) SelectedVariables() map[deppy.Identifier]deppy.Variable

SelectedVariables returns the variables that were selected by the solver as part of the solution

Jump to

Keyboard shortcuts

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