public XCellDP_II(string id, Layer layer) : base(id, layer) { //if (!layer.ListOfInputChannels.Any(channel => channel.XCellOrigin?.Id == id)) //{ // var newInputChannel = new Channel(); // newInputChannel.XCellDestiny = this; // ListOfInputChannels.Add(newInputChannel); var newOutputChannel = new Channel(); newOutputChannel.XCellOrigin = this; ListOfOutputChannels.Add(newOutputChannel); //} }
public override void SendOutputData() //Systole { //var lowerLimit = IN - RegionsManager.r; //var upperLimit = IN + RegionsManager.r; //if (RegionsManager.TryToAddANewRegion(lowerLimit, upperLimit))//RegionsManager.CheckIfRegionIsAvailable(lowerLimit, upperLimit)) //{ // var xCellFuzzyNew = new XCellFuzzy($"{lowerLimit}<{Id}<{upperLimit}", Layer, RegionsManager.R); // xCellFuzzyNew.ListOfInputChannels.Add(ListOfInputChannels[0]); // //RegionsManager.TryToAddANewRegion(lowerLimit, upperLimit); // ListOfXCellFuzzy.Add(xCellFuzzyNew); // //xCellFuzzyNew.GetInputData(); // //Recalculate_r(); //} //foreach (var xCellFuzzy in ListOfXCellFuzzy) //{ // xCellFuzzy.GetInputData(); // xCellFuzzy.SendOutputData(); //} XCellFuzzy xCellFuzzyWithGreaterOutput = null; double greaterOutput = 0; foreach (var xCellFuzzy in ListOfXCellFuzzy.Where(xCellFuzz => xCellFuzz.ListOfOutputChannels[0].IsActive && xCellFuzz.ListOfOutputChannels[0].Aij > 0)) { if (!ORExplodeLayer.ListOfXCellsOrExplode.Any(xCellORExplode => xCellORExplode.Id == xCellFuzzy.Id)) { var xCellOrExplode = new XCellORExplode(xCellFuzzy.Id, this.Layer); ORExplodeLayer.ListOfXCellsOrExplode.Add(xCellOrExplode); ORExplodeLayer.ListOfInputChannels.Add(xCellFuzzy.ListOfOutputChannels[0]); } if (xCellFuzzy.ListOfOutputChannels[0].Aij > greaterOutput) { greaterOutput = xCellFuzzy.ListOfOutputChannels[0].Aij; xCellFuzzyWithGreaterOutput = xCellFuzzy; } } if (xCellFuzzyWithGreaterOutput != null) { var outputChannelFound = ListOfOutputChannels.FirstOrDefault(outputChannel => outputChannel.XCellOrigin.Id == xCellFuzzyWithGreaterOutput.Id); if (outputChannelFound == null) { ListOfOutputChannels.Add(xCellFuzzyWithGreaterOutput.ListOfOutputChannels[0]); } } }
public XCellORExplode(string id, Layer layer) : base(id, layer) { var newInputChannel = new Channel(); newInputChannel.XCellDestiny = this; var channelForInputFoundInLayerAsInputChannel = layer.ListOfInputChannels.FirstOrDefault(channel => channel.XCellOrigin.Id == id); if (channelForInputFoundInLayerAsInputChannel != null) { newInputChannel.XCellOrigin = channelForInputFoundInLayerAsInputChannel.XCellOrigin; } ListOfInputChannels.Add(newInputChannel); var newOutputChannel = new Channel(); newOutputChannel.XCellOrigin = this; ListOfOutputChannels.Add(newOutputChannel); }
/// <summary> /// Initializes a new instance of the <see cref="XCellInput"/> class. /// </summary> /// <param name="id">id=id1</param> /// <param name="layer">The layer.</param> public XCellInput(string id, Layer layer) : base(id, layer) { var minMaxRValues = ((INPUTLayer)Layer).MinAndMaxValuesForInputHeaderID[id]; MaxInputValue = minMaxRValues.maxValue; MinInputValue = minMaxRValues.minValue; R = minMaxRValues.R; CounterOfValues = new uint[R]; if (!layer.ListOfInputChannels.Any(channel => channel.XCellOrigin?.Id == id)) { var newInputChannel = new Channel(); newInputChannel.XCellDestiny = this; ListOfInputChannels.Add(newInputChannel); var newOutputChannel = new Channel(); newOutputChannel.XCellOrigin = this; ListOfOutputChannels.Add(newOutputChannel); } }
//public double OutputFuzzyValue { get; set; } public XCellFuzzy(string id, Layer layer, uint R) : base(id, layer) { //_counterOfValues = new uint[R]; _R = Convert.ToDouble(R); _maxInput = _R; // double.MinValue; _minInput = 0; // double.MaxValue; var newOutputChannel = new Channel(); newOutputChannel.XCellOrigin = this; ListOfOutputChannels.Add(newOutputChannel); layer.ListOfOutputChannels.Add(newOutputChannel); layer.LayerUp.ListOfInputChannels.Add(newOutputChannel); var lowCenterUp = id.Split('<');//lowerLimit<id<uppderLimit BuildFuzzyRelation(Convert.ToDouble(lowCenterUp[0]), Convert.ToDouble(lowCenterUp[2])); }
/// <summary> /// Initializes a new instance of the <see cref="XCellOR"/> class. /// </summary> /// <param name="idSequence">id=id1|id2|...|idn</param> /// <param name="layer">The layer.</param> public XCellOR(string idSequence, Layer layer) : base(idSequence, layer) { var ids = idSequence.Split('|'); foreach (var id in ids) { var newInputChannel = new Channel(); newInputChannel.XCellDestiny = this; var channelForInputFoundInLayerAsInputChannel = layer.ListOfInputChannels.FirstOrDefault(channel => channel.XCellOrigin.Id == id); if (channelForInputFoundInLayerAsInputChannel != null) { newInputChannel.XCellOrigin = channelForInputFoundInLayerAsInputChannel.XCellOrigin; } ListOfInputChannels.Add(newInputChannel); } var newOutputChannel = new Channel(); newOutputChannel.XCellOrigin = this; ListOfOutputChannels.Add(newOutputChannel); }