public override void AddFactor(Factor f) { var z = f as SimpleFactor; if (null == z) { throw new ArgumentException("expected VariableFactor."); } if (IsConstant) { return; } else if (f.IsConstant) { //SetConstant(f.Constant); throw new NotImplementedException(); } var sb = new StringBuilder(); sb.AppendFormat("factor addition {0} + {1}", this, f); // combine inverters for (int j = 0; j < Variable.Cardinality; ++j) { // contained in left set? var f1 = !_invert[j]; // contained in right set? var f2 = !z._invert[j]; if (f1 && f2) { _invert[j] = false; } else { _invert[j] = true; } } CheckZero(); sb.AppendFormat(" ==> {0}", this); Trace("{0}", sb); }
public void AddFactor(Factor f1) { if(_zero) { // ignore return; } Factor f0; if (!_map.TryGetValue(f1.Group, out f0)) { _map[f1.Group] = f1; } else { // factor for the same group already exists in the product f0.AddFactor(f1); } }
public override void AddFactor(Factor f) { AddInput(f.Inputs.First()); }
public abstract void AddFactor(Factor f);
public Product(Factor f) { AddFactor(f); }