Esempio n. 1
0
        /// <summary>
        /// Find the equivalence classes of variables in this model
        /// </summary>
        /// <param name="s">Boolean model against which to compute equivalence classes</param>
        private void FindEquivalenceClasses(Solution s)
        {
            // Alias vars that are equated in this model
            foreach (var p in Propositions)
            {
                if (p is VariableEquation e && s[e] && e.Lhs.IsDefinedInInternal(s) && e.Rhs.IsDefinedInInternal(s))
                {
                    FloatVariable.Equate(e.Lhs, e.Rhs);
                }
            }

            // We can now focus on just the representatives of each equivalence class of variables
            // and ignore the rest.
            representatives.Clear();
            representatives.AddRange(Variables.Where(v => v.IsDefinedInInternal(s) && (object)v == (object)v.Representative));
        }