Пример #1
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
        }
Пример #2
0
        private PolyhedraEnvironment(IExpressionDecoder <Variable, Expression> decoder, IExpressionEncoder <Variable, Expression> encoder, AI.PolyhedraLattice.Element value, IntervalEnvironment <Variable, Expression> intv)
        {
            this.decoder = decoder;
            this.encoder = encoder;
            embedded     = value;
            this.intv    = intv;

            testTrueVisitor = new PolyhedraEnvironment <Expression> .PolyhedraTestTrueVisitor(decoder);

            testFalseVisitor = new PolyhedraEnvironment <Expression> .PolyhedraTestFalseVisitor(decoder);

            testTrueVisitor.FalseVisitor = testFalseVisitor;
            testFalseVisitor.TrueVisitor = testTrueVisitor;
        }
Пример #3
0
        public PolyhedraEnvironment(IExpressionDecoder <Variable, Expression> decoder, IExpressionEncoder <Variable, Expression> encoder)
        {
            this.decoder = decoder;
            this.encoder = encoder;
            embedded     = UnderlyingPolyhedra.Top;
            intv         = new IntervalEnvironment <Variable, Expression>(decoder, encoder);

            testTrueVisitor = new PolyhedraEnvironment <Expression> .PolyhedraTestTrueVisitor(decoder);

            testFalseVisitor = new PolyhedraEnvironment <Expression> .PolyhedraTestFalseVisitor(decoder);

            testTrueVisitor.FalseVisitor = testFalseVisitor;
            testFalseVisitor.TrueVisitor = testTrueVisitor;
        }
Пример #4
0
 private void AssignIntervalJustInPolyhedra(Expression x, Interval value)
 {
     if (!value.IsBottom)
     {
         if (!value.LowerBound.IsInfinity)
         {
             AI.IExpr lowerBound = linearfactory.AtMost(linearfactory.Const((Int32)value.LowerBound.PreviousInteger), Converter.BoxAsVariable(x, decoder));
             embedded = UnderlyingPolyhedra.Constrain(embedded, lowerBound);
         }
         if (!value.UpperBound.IsInfinity)
         {
             AI.IExpr upperBound = linearfactory.AtMost(Converter.BoxAsVariable(x, decoder), linearfactory.Const((Int32)value.UpperBound.NextInteger));
             embedded = UnderlyingPolyhedra.Constrain(embedded, upperBound);
         }
     }
 }
Пример #5
0
 private PolyhedraEnvironment <Expression> Factory(AI.PolyhedraLattice.Element element, IAbstractDomain intv)
 {
     return(new PolyhedraEnvironment <Expression>(decoder, encoder, element, (IntervalEnvironment <Variable, Expression>)intv));
 }
Пример #6
0
 public void RenameVariable(Expression OldName, Expression NewName)
 {
     embedded = UnderlyingPolyhedra.Rename(embedded, Converter.BoxAsVariable <Expression>(OldName, decoder), Converter.BoxAsVariable <Expression>(NewName, decoder));
     intv.RenameVariable(OldName, NewName);
 }
Пример #7
0
 public void RemoveVariable(Expression var)
 {
     embedded = UnderlyingPolyhedra.Eliminate(embedded, Converter.BoxAsVariable <Expression>(var, decoder));
     intv.RemoveVariable(var);
 }
Пример #8
0
 public void Assign(Expression x, Expression exp, INumericalAbstractDomainQuery <Variable, Expression> preState)
 {
     embedded = UnderlyingPolyhedra.Constrain(embedded, Converter.Box(encoder.CompoundExpressionFor(ExpressionType.Bool, ExpressionOperator.Equal, x, exp), decoder));
 }
Пример #9
0
 private PolyhedraEnvironment(PolyhedraEnvironment <Expression> pe, AI.PolyhedraLattice.Element value, IntervalEnvironment <Variable, Expression> intv)
     : this(pe.decoder, pe.encoder, value, intv)
 {
     testTrueVisitor  = pe.testTrueVisitor;
     testFalseVisitor = pe.testFalseVisitor;
 }
Пример #10
0
 public void ProjectVariable(Expression var)
 {
     this.embedded = UnderlyingPolyhedra.Eliminate(this.embedded, Converter.BoxAsVariable <Expression>(var, this.decoder));
     this.intv.ProjectVariable(var);
 }