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 }
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; }
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; }
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); } } }
private PolyhedraEnvironment <Expression> Factory(AI.PolyhedraLattice.Element element, IAbstractDomain intv) { return(new PolyhedraEnvironment <Expression>(decoder, encoder, element, (IntervalEnvironment <Variable, Expression>)intv)); }
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); }
public void RemoveVariable(Expression var) { embedded = UnderlyingPolyhedra.Eliminate(embedded, Converter.BoxAsVariable <Expression>(var, decoder)); intv.RemoveVariable(var); }
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)); }
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; }
public void ProjectVariable(Expression var) { this.embedded = UnderlyingPolyhedra.Eliminate(this.embedded, Converter.BoxAsVariable <Expression>(var, this.decoder)); this.intv.ProjectVariable(var); }