Documentation
¶
Index ¶
- Constants
- Variables
- type Constraint
- type Edit
- type Expr
- type Op
- type Priority
- type Solver
- func (s *Solver) AddConstraint(cell Constraint) (Symbol, error)
- func (s *Solver) AddConstraintWithPriority(priority Priority, cell Constraint) (Symbol, error)
- func (s *Solver) Edit(id Symbol, priority Priority) error
- func (s *Solver) RemoveConstraint(marker Symbol) error
- func (s *Solver) Suggest(id Symbol, val float64) error
- func (s *Solver) Val(id Symbol) float64
- type Symbol
- func (sym Symbol) Dummy() bool
- func (sym Symbol) EQ(val float64) Constraint
- func (sym Symbol) Error() bool
- func (sym Symbol) External() bool
- func (sym Symbol) GTE(val float64) Constraint
- func (sym Symbol) Kind() SymbolKind
- func (sym Symbol) LTE(val float64) Constraint
- func (sym Symbol) Restricted() bool
- func (sym Symbol) Slack() bool
- func (sym Symbol) T(coeff float64) Term
- func (sym Symbol) Zero() bool
- type SymbolKind
- type Tag
- type Term
Constants ¶
View Source
const ( Weak Priority = 1 Medium = 1e3 * Weak Strong = 1e3 * Medium Required = 1e3 * Strong )
Variables ¶
View Source
var ( ErrBadPriority = errors.New("priority must be non-negative and not required for edit variable") ErrBadEditVariable = errors.New("symbol is not yet registered as an edit variable") ErrBadDummyVariable = errors.New("constraint is unsatisfiable: non-zero dummy variable") ErrBadConstraintMarker = errors.New("symbol is not registered to refer to a constraint") ErrBadTermInConstraint = errors.New("one of the terms in the constraint references a nil symbol") )
View Source
var OpTable = [...]string{ EQ: "=", GTE: ">=", LTE: "<=", }
Functions ¶
This section is empty.
Types ¶
type Constraint ¶
type Constraint struct {
// contains filtered or unexported fields
}
func NewConstraint ¶
func NewConstraint(op Op, constant float64, terms ...Term) Constraint
type Solver ¶
type Solver struct {
// contains filtered or unexported fields
}
func (*Solver) AddConstraint ¶
func (s *Solver) AddConstraint(cell Constraint) (Symbol, error)
func (*Solver) AddConstraintWithPriority ¶
func (s *Solver) AddConstraintWithPriority(priority Priority, cell Constraint) (Symbol, error)
func (*Solver) RemoveConstraint ¶
type Symbol ¶
type Symbol uint64
func (Symbol) EQ ¶
func (sym Symbol) EQ(val float64) Constraint
func (Symbol) GTE ¶
func (sym Symbol) GTE(val float64) Constraint
func (Symbol) Kind ¶
func (sym Symbol) Kind() SymbolKind
func (Symbol) LTE ¶
func (sym Symbol) LTE(val float64) Constraint
func (Symbol) Restricted ¶
type SymbolKind ¶
type SymbolKind uint8
const ( External SymbolKind = iota Slack Error Dummy )
func (SymbolKind) Restricted ¶
func (s SymbolKind) Restricted() bool
func (SymbolKind) String ¶
func (s SymbolKind) String() string
Click to show internal directories.
Click to hide internal directories.