Reduce(IntervalEnvironment < Rational, Expression> left, WeakUpperBounds <Expression,  Rational> right)
    {
        ALog.BeginReduce("IntervalsWithSymbolicUpperBounds");

        foreach (Expression x in left.Keys)
        {
            foreach (Expression y in left.Keys)
            {
                if (x.Equals(y))
                {
                    continue;
                }

                FlatAbstractDomain <bool> b = left.CheckIfLessThan(x, y);

                if (b.IsTop || b.IsBottom)
                {
                    continue;
                }

                if (b.BoxedElement == true)
                {
                    ALog.Message("Adding " + ExpressionPrinter <Expression> .ToString(x, this.decoder) + " < " + ExpressionPrinter <Expression> .ToString(y, this.decoder)
                                 + " as " + left.BoundsFor(x) + " < " + left.BoundsFor(y));

                    right.TestTrueLessThan(x, y); // Add the constraint x < y
                }
            }
        }

        ALog.EndReduce();

        return(this.Factory(left, right));
    }
Пример #2
0
        public void AssignInParallel(IDictionary <Expression, Microsoft.Research.DataStructures.FList <Expression> > sourcesToTargets)
        {
            intv.AssignInParallel(sourcesToTargets);

            // Do the renamings
            foreach (Expression source in sourcesToTargets.Keys)
            {
                {
                    if (sourcesToTargets[source].Length() == 1)
                    { // we want to just follow the renamings, all the rest is not interesting and we discard it
                        Expression target = sourcesToTargets[source].Head;
                        // source -> target ,  i.e. the new name for "source" is "target"

                        ALog.Message(StringClosure.For("Renaming {0} to {1}", ExpressionPrinter.ToStringClosure(source, decoder), ExpressionPrinter.ToStringClosure(target, decoder)));

                        embedded = UnderlyingPolyhedra.Rename(embedded, Converter.BoxAsVariable(source, decoder), Converter.BoxAsVariable(target, decoder));
                    }
                }
            }
#if true || MOREPRECISE
            // else we want to keep track of constants

            foreach (Expression x in intv.Variables)
            {
                Interval value = intv.BoundsFor(x);
                {
                    this.AssignIntervalJustInPolyhedra(x, value);
                }
            }
#endif
        }