/// <summary> /// Adds a MSF variable with the coresponding assertion to the Z3 variables. /// </summary> /// <param name="vid">The MSF id of the variable</param> internal void AddVariable(int vid) { // Is the variable an integer bool isInteger = _model.GetIntegrality(vid); // Construct the sort we will be using Sort sort = isInteger ? (Sort)_context.IntSort : (Sort)_context.RealSort; // Get the variable key object key = _model.GetKeyFromIndex(vid); // Try to construct the name string name; if (key != null) { name = String.Format("x_{0}_{1}", key, vid); } else { name = String.Format("x_{0}", vid); } ArithExpr variable = (ArithExpr)_context.MkConst(name, sort); // Create the variable and add it to the map Debug.Assert(!_variables.ContainsKey(vid), "Variable names should be unique."); _variables.Add(vid, variable); AssertArith(vid, variable); }