Ejemplo n.º 1
0
        /// <summary>
        /// Gets the indexes of the readout units belonging to a specified "One Takes All" group.
        /// </summary>
        /// <param name="groupName">The name of the "One Takes All" group.</param>
        public List <int> GetOneTakesAllGroupMemberRUnitIndexes(string groupName)
        {
            List <int> indexes = new List <int>();

            for (int i = 0; i < ReadoutUnitsCfg.ReadoutUnitCfgCollection.Count; i++)
            {
                if (ReadoutUnitsCfg.ReadoutUnitCfgCollection[i].TaskCfg.Type == ReadoutUnit.TaskType.Classification)
                {
                    ClassificationTaskSettings taskCfg = (ClassificationTaskSettings)ReadoutUnitsCfg.ReadoutUnitCfgCollection[i].TaskCfg;
                    if (taskCfg.OneTakesAllGroupName == groupName)
                    {
                        indexes.Add(i);
                    }
                }
            }
            return(indexes);
        }
Ejemplo n.º 2
0
        //Methods
        /// <summary>
        /// Checks consistency
        /// </summary>
        protected override void Check()
        {
            if (ReadoutUnitCfgCollection.Count == 0)
            {
                throw new ArgumentException($"Collection of readout units settings can not be empty.", "ReadoutUnitCfgCollection");
            }
            //Uniqueness of readout units names
            string[] names = new string[ReadoutUnitCfgCollection.Count];
            names[0] = ReadoutUnitCfgCollection[0].Name;
            for (int i = 1; i < ReadoutUnitCfgCollection.Count; i++)
            {
                if (names.Contains(ReadoutUnitCfgCollection[i].Name))
                {
                    throw new ArgumentException($"Readout unit name {ReadoutUnitCfgCollection[i].Name} is not unique.", "ReadoutUnitCfgCollection");
                }
                names[i] = ReadoutUnitCfgCollection[i].Name;
            }
            //One winner groups
            OneWinnerGroupCollection = new Dictionary <string, OneWinnerGroup>();
            List <string> owgs = new List <string>();

            for (int index = 0; index < ReadoutUnitCfgCollection.Count; index++)
            {
                if (ReadoutUnitCfgCollection[index].TaskCfg.Type == ReadoutUnit.TaskType.Classification)
                {
                    ClassificationTaskSettings cts = (ClassificationTaskSettings)ReadoutUnitCfgCollection[index].TaskCfg;
                    if (cts.OneWinnerGroupName != ClassificationTaskSettings.DefaultOneWinnerGroupName)
                    {
                        if (owgs.IndexOf(cts.OneWinnerGroupName) == -1)
                        {
                            owgs.Add(cts.OneWinnerGroupName);
                        }
                    }
                }
            }
            foreach (string oneWinnerGroupName in owgs)
            {
                OneWinnerGroupCollection.Add(oneWinnerGroupName,
                                             new OneWinnerGroup(oneWinnerGroupName,
                                                                (from rus in ReadoutUnitCfgCollection where rus.TaskCfg.Type == ReadoutUnit.TaskType.Classification && ((ClassificationTaskSettings)rus.TaskCfg).OneWinnerGroupName == oneWinnerGroupName select rus).ToList()
                                                                )
                                             );
            }

            return;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// The deep copy constructor.
 /// </summary>
 /// <param name="source">The source instance.</param>
 public ClassificationTaskSettings(ClassificationTaskSettings source)
     : this(source.OneTakesAllGroupName, source.ClusterChainCfg)
 {
     return;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// The deep copy constructor
 /// </summary>
 /// <param name="source">Source instance</param>
 public ClassificationTaskSettings(ClassificationTaskSettings source)
     : this(source.OneWinnerGroupName, source.NetworksCfg)
 {
     return;
 }