/// <summary> /// Add new local variable /// </summary> /// <param name="name"></param> /// <param name="lower"></param> /// <param name="upper"></param> public void AddLocalVar(string name, int lower, int upper) { varList.AddNewVariable(name, lower, upper); int numBits = varList.GetNumberOfBits(name); CUDDNode vr, vc; CUDDVars rowVar = new CUDDVars(); CUDDVars colVar = new CUDDVars(); for (int j = 0; j < numBits; j++) { vr = CUDD.Var(numverOfBoolVars++); vc = CUDD.Var(numverOfBoolVars++); rowVar.AddVar(vr); colVar.AddVar(vc); } this.rowVars.Add(rowVar); this.colVars.Add(colVar); this.AllRowVars.AddVars(rowVar); this.AllRowVarsExceptSingleCopy.AddVars(rowVar); this.AllColVars.AddVars(colVar); // used for unchanged variable in transition. CUDDNode identity = CUDD.Constant(0); for (int i = lower; i <= upper; i++) { identity = CUDD.Matrix.SetMatrixElement(identity, rowVar, colVar, i - lower, i - lower, 1); } this.varIdentities.Add(identity); // CUDDNode expressionDD = CUDD.MINUS_INFINITY; CUDD.Ref(expressionDD); for (int i = lower; i <= upper; i++) { expressionDD = CUDD.Matrix.SetVectorElement(expressionDD, rowVar, i - lower, i); } this.variableEncoding.Add(expressionDD); // CUDD.Ref(identity); allRowVarRanges = CUDD.Function.And(allRowVarRanges, CUDD.Abstract.ThereExists(identity, colVar)); CUDD.Ref(identity); colVarRanges.Add(CUDD.Abstract.ThereExists(identity, rowVar)); }