//------------------------------------------------------------------------------------------------

        /// <summary>
        /// Checks if the current model will produce valid mass functions.
        /// </summary>
        /// <returns>Returns true if the model will produce valid mass functions, false otherwise.</returns>
        public bool IsValid()
        {
            //Build the list of points:
            List <DiscreteSensorFocalPoint> list = new List <DiscreteSensorFocalPoint>();

            foreach (DiscreteSensorFocalBelief fb in _focalBeliefs)
            {
                foreach (DiscreteSensorFocalPoint bp in fb.Belief)
                {
                    if (!list.Contains(bp))
                    {
                        list.Add(bp);
                    }
                }
            }
            list.Sort();
            //Build a mass function for each point and check it is valid:
            foreach (DiscreteSensorFocalPoint bp in list)
            {
                DiscreteMassFunction evidence = new DiscreteMassFunction();
                foreach (DiscreteSensorFocalBelief fb in FocalBeliefs)
                {
                    evidence.AddMass(fb.Element, fb.GetEvidence(bp.SensorMeasure));
                }
                if (!evidence.HasAValidSum() || !evidence.HasValidValues())
                {
                    return(false);
                }
            }
            return(true);
        }