Ejemplo n.º 1
0
        public void AddUnitaryFactor(int factorId, Factorable.UnitaryFactor factorFunction, Layer layer, bool dynamic = true, bool enabled = true)
        {
            switch (layer)
            {
            case Layer.NodeLayer:
                AddUnitaryFactorToLayer(factorId, factorFunction, this.NodeLayer, dynamic, enabled);
                break;

            case Layer.EdgeLayer:
                AddUnitaryFactorToLayer(factorId, factorFunction, this.EdgeLayer, dynamic, enabled);
                break;

            case Layer.GroupLayer:
                AddUnitaryFactorToLayer(factorId, factorFunction, this.GroupLayer, dynamic, enabled);
                break;

            case Layer.AllLayer:
                AddUnitaryFactorToLayer(factorId, factorFunction, this.NodeLayer, dynamic, enabled);
                AddUnitaryFactorToLayer(factorId, factorFunction, this.EdgeLayer, dynamic, enabled);
                AddUnitaryFactorToLayer(factorId, factorFunction, this.GroupLayer, dynamic, enabled);
                break;

            default:
                break;
            }
            if (!Lambda.ContainsKey(factorId))
            {
                Lambda.Add(factorId, new Dictionary <byte, double>());
            }
        }
Ejemplo n.º 2
0
 void AddUnitaryFactorToLayer <T>(int factorId, Factorable.UnitaryFactor factorFunction, List <T> layer, bool dynamic = true, bool enabled = true)
     where T : Factorable, ILayerNode
 {
     layer.ForEach(delegate(T f)
     {
         f.AddUnitaryFactor(factorId, factorFunction, dynamic, enabled);
     });
 }