public IEnumerable <NumericVariable> Propagate(SimpleConstraintSolver solver) { if (IsDirty) { IEnumerable <NumericVariable> outputVariablesFromOldestToNewest = _outputVariables.OrderBy(v => v.LastChangedAt); IEnumerable <NumericVariable> changed = Update(outputVariablesFromOldestToNewest); _lastPropagatedAt = solver.Now; _isDirty = false; return(changed.Where(ch => ch != null)); } else { return(Enumerable.Empty <NumericVariable>()); } }
internal NumericVariable([NotNull] string shortName, [NotNull] string definition, [NotNull] SimpleConstraintSolver solver, double?lo, double?hi, float interpolate) { if (shortName.Length > 1000) { throw new ArgumentException("string too long", nameof(shortName)); } if (definition.Length > 1000) { throw new ArgumentException("string too long", nameof(definition)); } Definition = definition; Name = ShortName = shortName; _solver = solver; Interpolate = interpolate; Value = new Range(lo ?? double.NegativeInfinity, hi ?? double.PositiveInfinity, solver.Eps); }
public VariableVector(string name, SimpleConstraintSolver solver, double?x = null, double?y = null, float interpolate = 0.5f) : this(name, solver.CreateVariable(name + ".X", x, x, interpolate), solver.CreateVariable(name + ".Y", y, y, interpolate)) { }