Documentation
¶
Index ¶
- Variables
- type Constraint
- type ConstraintData
- type Expression
- func (e Expression) DivConstant(other float64) Expression
- func (e Expression) MulConstant(other float64) Expression
- func (e Expression) Negate() Expression
- func (e Expression) Sub(other Expression) Expression
- func (e Expression) SubConstant(other float64) Expression
- func (e Expression) SubVariable(other Variable) Expression
- type InternalSolverError
- type PartialConstraint
- type PublicChange
- type RelationOperator
- type Solver
- type Strength
- type SymbolType
- type Term
- type Variable
- type WeightedRelation
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplicateConstraint = errors.New("duplicate constraint") ErrUnsatisfiableConstraint = errors.New("unsatisfiable constraint") ErrUnknownConstraint = errors.New("unknown constraint") ErrDuplicateEditVariable = errors.New("duplicate edit variable") ErrBadRequiredStrength = errors.New("bad required strength") ErrUnknownEditVariable = errors.New("unknown edit variable") )
Functions ¶
This section is empty.
Types ¶
type Constraint ¶
type Constraint *ConstraintData
func NewConstraint ¶
func NewConstraint(e Expression, op RelationOperator, strength Strength) Constraint
type ConstraintData ¶
type ConstraintData struct {
// contains filtered or unexported fields
}
func (ConstraintData) Expression ¶
func (cd ConstraintData) Expression() Expression
func (ConstraintData) Op ¶
func (cd ConstraintData) Op() RelationOperator
func (ConstraintData) Strength ¶
func (cd ConstraintData) Strength() Strength
type Expression ¶
func NewExpression ¶
func NewExpression(constant float64, terms ...Term) Expression
func NewExpressionFromConstant ¶
func NewExpressionFromConstant(v float64) Expression
func NewExpressionFromTerm ¶
func NewExpressionFromTerm(term Term) Expression
func (Expression) DivConstant ¶
func (e Expression) DivConstant(other float64) Expression
func (Expression) MulConstant ¶
func (e Expression) MulConstant(other float64) Expression
func (Expression) Negate ¶
func (e Expression) Negate() Expression
func (Expression) Sub ¶
func (e Expression) Sub(other Expression) Expression
func (Expression) SubConstant ¶
func (e Expression) SubConstant(other float64) Expression
func (Expression) SubVariable ¶
func (e Expression) SubVariable(other Variable) Expression
type InternalSolverError ¶
type InternalSolverError string
func (InternalSolverError) Error ¶
func (e InternalSolverError) Error() string
type PartialConstraint ¶
type PartialConstraint struct { Expression Expression Relation WeightedRelation }
func (PartialConstraint) ConstantRHS ¶
func (p PartialConstraint) ConstantRHS(v float64) Constraint
func (PartialConstraint) ExpressionRHS ¶
func (p PartialConstraint) ExpressionRHS(e Expression) Constraint
func (PartialConstraint) VariableRHS ¶
func (p PartialConstraint) VariableRHS(v Variable) Constraint
type PublicChange ¶
type RelationOperator ¶
type RelationOperator int
const ( RelationOperatorLessThanEqual RelationOperator = iota + 1 RelationOperatorEqual RelationOperatorGreaterThanEqual )
type Solver ¶
type Solver struct {
// contains filtered or unexported fields
}
func (*Solver) AddConstraint ¶
func (s *Solver) AddConstraint(constraint Constraint) error
func (*Solver) AddConstraints ¶
func (s *Solver) AddConstraints(constraints ...Constraint) error
func (*Solver) FetchChanges ¶
func (s *Solver) FetchChanges() []PublicChange
FetchChanges fetches all changes to the values of variables since the last call to this function.
The list of changes returned is not in a specific order. Each change comprises the variable changed and the new value of that variable.
type SymbolType ¶
type SymbolType int
const ( SymbolTypeInvalid SymbolType = iota + 1 SymbolTypeExternal SymbolTypeSlack SymbolTypeError SymbolTypeDummy )
type Variable ¶
type Variable uint64
func NewVariable ¶
func NewVariable() Variable
func (Variable) Sub ¶
func (v Variable) Sub(other Variable) Expression
type WeightedRelation ¶
type WeightedRelation struct { Operator RelationOperator Strength Strength }
func Equal ¶
func Equal(strength Strength) WeightedRelation
func GreaterThanEqual ¶
func GreaterThanEqual(strength Strength) WeightedRelation
func LessThanEqual ¶
func LessThanEqual(strength Strength) WeightedRelation
func (WeightedRelation) ExpressionLHS ¶
func (w WeightedRelation) ExpressionLHS(expression Expression) PartialConstraint
func (WeightedRelation) VariableLHS ¶
func (w WeightedRelation) VariableLHS(variable Variable) PartialConstraint
Click to show internal directories.
Click to hide internal directories.