Class Solver
The constraint solver class.
public class Solver
- Inheritance
-
Solver
- Inherited Members
Constructors
Solver()
Construct a new Solver.
public Solver()
Properties
MaxIterations
The max number of solver iterations before an error
is thrown, in order to prevent infinite iteration. Default: 10,000.
public int MaxIterations { get; set; }
Property Value
Methods
AddConstraint(Constraint)
Add a constraint to the solver.
public void AddConstraint(Constraint constraint)
Parameters
constraintConstraintConstraint to add to the solver
AddConstraints(params Constraint[])
Add multiple constraints to the solver.
public void AddConstraints(params Constraint[] constraints)
Parameters
constraintsConstraint[]
AddEditVariable(Variable, double)
Add an edit variable to the solver.
public void AddEditVariable(Variable variable, double strength)
Parameters
variableVariableEdit variable to add to the solver
strengthdoubleStrength, should be less than Strength.Required
FetchChanges()
Updates the variables.
public void FetchChanges()
GetConstraints()
Get an array of the current constraints.
public IEnumerable<Constraint> GetConstraints()
Returns
- IEnumerable<Constraint>
Array of constraints
HasConstraint(Constraint)
Test whether the solver contains the constraint.
public bool HasConstraint(Constraint constraint)
Parameters
constraintConstraintConstraint to test for
Returns
- bool
True or false
HasEditVariable(Variable)
Test whether the solver contains the edit variable.
public bool HasEditVariable(Variable variable)
Parameters
variableVariableEdit variable to test for
Returns
- bool
True or false
RemoveConstraint(Constraint)
Remove a constraint from the solver.
public void RemoveConstraint(Constraint constraint)
Parameters
constraintConstraintConstraint to remove from the solver
RemoveEditVariable(Variable)
Remove an edit variable from the solver.
public void RemoveEditVariable(Variable variable)
Parameters
variableVariableEdit variable to remove from the solver
SuggestValue(Variable, double)
Suggest the value of an edit variable.
public void SuggestValue(Variable variable, double value)
Parameters
UpdateVariables()
Update the values of the variables.
public void UpdateVariables()