Exemplo n.º 1
0
        /// <summary>
        /// Replaces the names for parent, children, etc. with their actual objects of the variability model
        /// </summary>
        internal void init()
        {
            this.parent = vm.getBinaryOption(parentName);
            foreach (var name in this.children_names)
            {
                ConfigurationOption c = vm.getBinaryOption(name);
                if (c == null)
                {
                    c = vm.getNumericOption(name);
                }
                if (c == null)
                {
                    continue;
                }
                this.children.Add(c);
            }

            foreach (var imply_names in this.implied_Options_names)
            {
                List <ConfigurationOption> optionImplies = new List <ConfigurationOption>();
                foreach (var optName in imply_names)
                {
                    ConfigurationOption c = vm.getBinaryOption(optName);
                    if (c == null)
                    {
                        c = vm.getNumericOption(optName);
                    }
                    if (c == null)
                    {
                        continue;
                    }
                    optionImplies.Add(c);
                }
                this.implied_Options.Add(optionImplies);
            }

            foreach (var exclud_names in this.excluded_Options_names)
            {
                List <ConfigurationOption> excImplies = new List <ConfigurationOption>();
                foreach (var optName in exclud_names)
                {
                    ConfigurationOption c = vm.getBinaryOption(optName);
                    if (c == null)
                    {
                        c = vm.getNumericOption(optName);
                    }
                    if (c == null)
                    {
                        continue;
                    }
                    excImplies.Add(c);
                }
                this.excluded_Options.Add(excImplies);
            }
        }
Exemplo n.º 2
0
        private VariabilityModel extractFeatureModelFromExpression(String expression)
        {
            VariabilityModel varModel = new VariabilityModel("TEMP");

            string[] parts = expression.Split(new char[] { '+', '*', '[', ']' });

            double value = 0.0;

            for (int i = 0; i < parts.Length; i++)
            {
                string part = parts[i].Trim();
                if (part.Length > 0)
                {
                    if (!Double.TryParse(part, out value))
                    {
                        if (varModel.getNumericOption(part) == null)
                        {
                            NumericOption option = new NumericOption(varModel, part);
                            varModel.addConfigurationOption(option);
                        }
                    }
                }
            }
            return(varModel);
        }
Exemplo n.º 3
0
        private double getValueOfToken(Dictionary <NumericOption, double> config, string token, VariabilityModel varModel)
        {
            token = token.Trim();

            double value = 0.0;

            if (Double.TryParse(token, out value))
            {
                return(value);
            }

            if (varModel == null)
            {
                if (token.Equals(this.numOption.Name))
                {
                    return(config[this.numOption]);
                }
            }
            else
            {
                NumericOption numOpt = varModel.getNumericOption(token);
                if (numOpt != null)
                {
                    return(config[numOpt]);
                }
            }
            return(0.0);
        }
Exemplo n.º 4
0
        private static BinaryOption getAbstractOption(String token, VariabilityModel vm)
        {
            NumericOption numOpt;

            if (token.StartsWith("Enabled"))
            {
                numOpt = vm.getNumericOption(token.Substring(7));
                if (numOpt != null)
                {
                    return(numOpt.abstractEnabledConfigurationOption());
                }
            }
            else
            {
                numOpt = vm.getNumericOption(token.Substring(8));
                if (numOpt != null)
                {
                    return(numOpt.abstractDisabledConfigurationOption());
                }
            }
            return(null);
        }
Exemplo n.º 5
0
        private bool tokenIsAFeatureOrNumber(string token, VariabilityModel varModel)
        {
            token = token.Trim();

            double value = 0.0;

            if (Double.TryParse(token, out value))
            {
                return(true);
            }

            if (varModel != null)
            {
                NumericOption numOption = varModel.getNumericOption(token);
                if (numOption != null)
                {
                    if (!participatingNumOptions.Contains(numOption))
                    {
                        this.participatingNumOptions.Add(numOption);
                    }
                    numberOfParticipatingFeatures++;
                    return(true);
                }

                BinaryOption binOption = varModel.getBinaryOption(token);

                if (token.StartsWith("Enabled") || token.StartsWith("Disabled"))
                {
                    binOption = getAbstractOption(token, varModel);
                }

                if (binOption != null)
                {
                    if (!participatingBoolOptions.Contains(binOption))
                    {
                        this.participatingBoolOptions.Add(binOption);
                    }
                    numberOfParticipatingFeatures++;
                    return(true);
                }
            }
            else
            {
                if (token.Equals(this.numOption.Name))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 6
0
        private static double getValueOfToken(Configuration config, string token, VariabilityModel fm)
        {
            token = token.Trim();

            double value = 0.0;

            if (Double.TryParse(token, out value))
            {
                return(value);
            }

            NumericOption numOpt = fm.getNumericOption(token);

            if (numOpt != null)
            {
                return(config.NumericOptions[numOpt]);
            }
            BinaryOption binOpt = fm.getBinaryOption(token);

            if (token.StartsWith("Enabled") || token.StartsWith("Disabled"))
            {
                binOpt = getAbstractOption(token, fm);
            }

            if (binOpt != null)
            {
                if (token.Equals("base") || token.Equals("root"))
                {
                    return(1.0);
                }

                if (config.BinaryOptions.Keys.Contains(binOpt) && config.BinaryOptions[binOpt] == BinaryOption.BinaryValue.Selected)
                {
                    return(1.0);
                }
                else
                {
                    foreach (BinaryOption option in config.BinaryOptions.Keys)
                    {
                        // option has to be selected in the configuration
                        if (option.Name == binOpt.Name && config.BinaryOptions[option] == BinaryOption.BinaryValue.Selected)
                        {
                            return(1.0);
                        }
                    }
                }
            }
            return(0.0);
        }
        /// <summary>
        /// Parses the numeric options, represented as string, of a configuration.
        /// </summary>
        /// <param name="numericString">The string representation of the numeric configuration options.</param>
        /// <param name="numericOptions">The data strcutre containing the parsed numeric options and their values.</param>
        /// <param name="varModel">The variability model the configuration is defined for.</param>
        /// <returns>True if the configuration is valid</returns>
        private static bool parseNumericOptionString(string numericString, out Dictionary <NumericOption, double> numericOptions, VariabilityModel varModel)
        {
            bool valid = true;

            Dictionary <NumericOption, double> _numericOptions = new Dictionary <NumericOption, double>();

            if (!string.IsNullOrEmpty(numericString))
            {
                string[] numOptionArray = numericString.Trim().Split(',');
                foreach (string numOption in numOptionArray)
                {
                    if (!valid)
                    {
                        break;
                    }

                    string[] numOptionsKeyValue;
                    if (numOption.Contains(";"))
                    {
                        numOptionsKeyValue = numOption.Split(';');
                    }
                    else
                    {
                        numOptionsKeyValue = numOption.Split(' ');// added for rc-lookahead 40
                    }
                    numOptionsKeyValue[0] = numOptionsKeyValue[0].Trim();
                    if (numOptionsKeyValue[0].Length == 0)
                    {
                        continue;
                    }
                    NumericOption varFeat = varModel.getNumericOption(numOptionsKeyValue[0]);
                    if (varFeat == null)
                    {
                        GlobalState.logError.logLine("No numeric option found with name: " + numOptionsKeyValue[0]);
                        valid = false;
                    }
                    else
                    {
                        double varFeatValue = Convert.ToDouble(numOptionsKeyValue[1]);
                        _numericOptions.Add(varFeat, varFeatValue);
                    }
                }
            }

            numericOptions = _numericOptions;

            return(valid);
        }
Exemplo n.º 8
0
        private static double getValueOfToken(Configuration config, string token, VariabilityModel fm)
        {
            token = token.Trim();

            double value = 0.0;

            if (Double.TryParse(token, out value))
            {
                return(value);
            }

            NumericOption numOpt = fm.getNumericOption(token);

            if (numOpt != null)
            {
                return(config.NumericOptions[numOpt]);
            }
            BinaryOption binOpt = fm.getBinaryOption(token);

            if (binOpt != null)
            {
                if (token.Equals("base"))
                {
                    return(1.0);
                }

                if (config.BinaryOptions.Keys.Contains(binOpt) && config.BinaryOptions[binOpt] == BinaryOption.BinaryValue.Selected)
                {
                    return(1.0);
                }
                else
                {
                    foreach (BinaryOption option in config.BinaryOptions.Keys)
                    {
                        if (option.Name == binOpt.Name)
                        {
                            return(1.0);
                        }
                    }
                }
            }
            return(0.0);
        }
        /// <summary>
        /// Creates a configuration based on a hash representation of that configuration.
        /// </summary>
        /// <param name="hashString">The String which from which we can infer the configuration</param>
        /// <param name="vm">The variability model that is required for identifying options in the hash string to instantiate actual configuration options.</param>
        /// <returns>A configuration that maps to the given hash string.</returns>
        internal static Configuration createFromHashString(string hashString, VariabilityModel vm)
        {
            Dictionary <NumericOption, double> numOptions = new Dictionary <NumericOption, double>();
            List <BinaryOption> binaryFeatures            = new List <BinaryOption>();
            Configuration       c;

            String[] optionList = hashString.Split(new String[] { "%;%" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (String option in optionList)
            {
                if (Char.IsDigit(option[option.Length - 1]))//If last char is a digit, then it must be a numeric option
                {
                    //Now remove the digit from the name
                    int  index = option.Length - 1;
                    Char last  = option[index];

                    while (Char.IsDigit(last) || last == ',' || last == '.' || last == '-')
                    {
                        index--;
                        last = option[index];
                    }
                    Double        optionsValue = Math.Round(Double.Parse(option.Substring(index + 1).Replace(',', '.')), 1);
                    NumericOption no           = vm.getNumericOption(option.Substring(0, index + 1));
                    if (no == null)
                    {
                        continue;
                    }
                    numOptions.Add(no, optionsValue);
                }
                else
                {
                    BinaryOption binOpt = vm.getBinaryOption(option);
                    binaryFeatures.Add(binOpt);
                }
            }
            c = new Configuration(binaryFeatures, numOptions);
            return(c);
        }
        /// <summary>
        /// This method returns a list of all configurations stored in a given file. All options of the configurations have to be defined in the variability model. 
        /// </summary>
        /// <param name="dat">Object representing the configuration file.</param>
        /// <param name="model">Variability model of the configurations.</param>
        /// <returns>Returns a list of configurations that were defined in the XML document. Can be an empty list.</returns>
        public static List<Configuration> readConfigurations(XmlDocument dat, VariabilityModel model)
        {
            XmlElement currentElemt = dat.DocumentElement;

            // Retrieve the decimal delimiter and the separator sign if included
            if (currentElemt.HasAttribute(decimalDelimiterTag) && currentElemt.HasAttribute(separatorTag))
            {
                // I assume that the decimal delimiter as well as the separator are only one symbol
                ConfigurationReader.decimalDelimiter = currentElemt.GetAttribute(decimalDelimiterTag)[0];
                ConfigurationReader.separator = currentElemt.GetAttribute(separatorTag)[0];

                if (currentElemt.GetAttribute(decimalDelimiterTag).Length > 1 || currentElemt.GetAttribute(separatorTag).Length > 1)
                {
                    GlobalState.logError.log("The decimal delimiter and the separator must consist of only one symbol.");
                }
                if (ConfigurationReader.decimalDelimiter == ConfigurationReader.separator)
                {
                    GlobalState.logError.log("The decimal delimiter symbol and the separator symbol must be different.");
                }
            }
            else if (currentElemt.HasAttribute(decimalDelimiterTag))
            {
                ConfigurationReader.decimalDelimiter = currentElemt.GetAttribute(decimalDelimiterTag)[0];
                if (currentElemt.GetAttribute(decimalDelimiterTag).Length > 1)
                {
                    GlobalState.logError.log("The decimal delimiter must consist of only one symbol.");
                }
            }
            else if (currentElemt.HasAttribute(separatorTag))
            {
                ConfigurationReader.separator = currentElemt.GetAttribute(separatorTag)[0];
                if (currentElemt.GetAttribute(separatorTag).Length > 1)
                {
                    GlobalState.logError.log("The separator symbol must be different.");
                }
            }

            HashSet<Configuration> configurations = new HashSet<Configuration>();

            int numberOfConfigs = currentElemt.ChildNodes.Count;
            int configsWithTooLargeDeviation = 0;
            foreach (XmlNode node in currentElemt.ChildNodes)
            {
                bool readMultipleMeasurements = false;
                if (node.Attributes.Count > 0 && node.Attributes[0].Value.ToLower() == "true")
                {
                    readMultipleMeasurements = true;
                }
                Dictionary<NFProperty, double> propertiesForConfig = new Dictionary<NFProperty, double>(); ;
                bool alternativeFormat = false;
                string binaryString = "";
                string numericString = "";
                string configID = "";
                Dictionary<NFProperty, double> measuredProperty = new Dictionary<NFProperty, double>();
                Configuration c = null;
                bool hasSetConfig = false;
                foreach (XmlNode childNode in node.ChildNodes)
                {
                    if (c == null && hasSetConfig)
                        continue;
                    switch (childNode.Attributes[0].Value)
                    {
                        // TODO we use this to support result files having the old structure
                        case "Configuration":
                            binaryString = childNode.InnerText;
                            break;
                        case "Variable Features":
                            numericString = childNode.InnerText;
                            break;

                        case "BinaryOptions":
                            binaryString = childNode.InnerText;
                            break;
                        case "NumericOptions":
                            numericString = childNode.InnerText;
                            break;
                        case "ConfigID":
                            if (readMultipleMeasurements)
                            {
                                configID = childNode.InnerText.Replace("_", "%;%");
                            }
                            else
                                configID = childNode.InnerText;
                            if (configID.Contains("%;%seek") && configID.Contains("%;%seek0") == false)
                            {
                                hasSetConfig = true;
                                c = null;
                                break;
                            }
                            alternativeFormat = true;
                            c = Configuration.createFromHashString(configID, GlobalState.varModel);
                            hasSetConfig = true;
                            break;
                        case "CompilerOptions":
                            //todo
                            break;
                        case "ConfigFileOptions":
                            //todo
                            break;
                        case "ParameterOptions":
                            //todo
                            break;
                        case "ProgramName":
                            //todo
                            break;
                        case "StartupBegin":
                            //todo
                            break;
                        case "StartupEnd":
                            //todo
                            break;
                        default:
                            NFProperty property = GlobalState.getOrCreateProperty(childNode.Attributes[0].Value);
                            double measuredValue = 0;
                            //-1 means that measurement failed... 3rd values strongly devigates in C.'s measurements, hence we use it only in case we have no other measurements
                            if (readMultipleMeasurements)
                            {
                                //if (property.Name != "run-real")
                                //    continue;
                                String[] m = childNode.InnerText.ToString().Split(separator);
                                double val1 = 0;
                                if (!Double.TryParse(m[0], out val1))
                                    break;
                                if (m.Length > 1)
                                {
                                    List<double> values = new List<double>();
                                    double avg = 0;
                                    foreach (var i in m)
                                    {
                                        double d = Convert.ToDouble(i.Replace(decimalDelimiter, '.'));
                                        if (d != -1)
                                        {
                                            values.Add(d);
                                            avg += d;
                                        }
                                    }
                                    if (values.Count == 0)
                                    {
                                        configsWithTooLargeDeviation++;
                                        c = null;
                                        break;
                                    }
                                    avg = avg / values.Count;
                                    /* foreach (var d in values)
                                        {
                                            if ((d / avg) * 100 > 10)
                                            {
                                                configsWithTooLargeDeviation++;
                                                c = null;
                                                break;
                                            }
                                        }*/
                                    measuredValue = avg;
                                    /*double val2 = Convert.ToDouble(m[1]);
                                        if (val1 == -1)
                                            measuredValue = val2;
                                        else if (val1 == -1 && val2 == -1)
                                            measuredValue = Convert.ToDouble(m[2]);
                                        else if (val2 == -1)
                                            measuredValue = val1;
                                        else
                                            measuredValue = (val1 + val2) / 2;*/
                                }
                                else
                                    measuredValue = val1;
                            }
                            else
                                measuredValue = Convert.ToDouble(childNode.InnerText.ToString().Replace(decimalDelimiter, '.'));

                            // Save the largest measured value.
                            double currentMaxMeasuredValue;
                            if (GlobalState.allMeasurements.maxMeasuredValue.TryGetValue(property, out currentMaxMeasuredValue))
                            {
                                if (Math.Abs(measuredValue) > Math.Abs(currentMaxMeasuredValue))
                                {
                                    GlobalState.allMeasurements.maxMeasuredValue[property] = measuredValue;
                                }
                            }
                            else
                            {
                                GlobalState.allMeasurements.maxMeasuredValue.Add(property, measuredValue);
                            }

                            // Add measured value to the configuration.
                            if (alternativeFormat && c != null)
                            {
                                c.setMeasuredValue(property, measuredValue);
                            }
                            else
                            {
                                measuredProperty.Add(property, measuredValue);
                            }
                            break;
                    }
                }

                if (alternativeFormat && c != null)
                {
                    if (configurations.Contains(c))
                    {
                        GlobalState.logError.logLine("Mutiple definition of one configuration in the configurations file:  " + c.ToString());
                    }
                    else
                    {
                        // if (GlobalState.currentNFP != null && c.nfpValues.Keys.Contains(GlobalState.currentNFP) && c.nfpValues[GlobalState.currentNFP] != -1)
                        configurations.Add(c);
                    }
                cont: { }
                    continue;
                }

                Dictionary<BinaryOption, BinaryOption.BinaryValue> binaryOptions = new Dictionary<BinaryOption, BinaryOption.BinaryValue>();

                string[] binaryOptionNames = binaryString.Split(',');
                foreach (string binaryOptionName in binaryOptionNames)
                {
                    string currOption = binaryOptionName.Trim();
                    if (currOption.Length > 0)
                    {
                        BinaryOption bOpt = null;

                        bOpt = model.getBinaryOption(currOption);

                        if (bOpt == null)
                            GlobalState.logError.logLine("No Binary option found with name: " + currOption);
                        binaryOptions.Add(bOpt, BinaryOption.BinaryValue.Selected);
                    }
                }

                // Add "root" binary option to the configuration
                if (!binaryOptions.ContainsKey(model.Root))
                    binaryOptions.Add(model.Root, BinaryOption.BinaryValue.Selected);

                Dictionary<NumericOption, double> numericOptions = new Dictionary<NumericOption, double>();
                if (!string.IsNullOrEmpty(numericString))
                {
                    string[] numOptionArray = numericString.Trim().Split(',');
                    foreach (string numOption in numOptionArray)
                    {
                        string[] numOptionsKeyValue;
                        if (numOption.Contains(";"))
                            numOptionsKeyValue = numOption.Split(';');
                        else
                            numOptionsKeyValue = numOption.Split(' ');// added for rc-lookahead 40
                        numOptionsKeyValue[0] = numOptionsKeyValue[0].Trim();
                        if (numOptionsKeyValue[0].Length == 0)
                            continue;
                        NumericOption varFeat = model.getNumericOption(numOptionsKeyValue[0]);
                        if (varFeat == null)
                            GlobalState.logError.logLine("No numeric option found with name: " + numOptionsKeyValue[0]);
                        double varFeatValue = Convert.ToDouble(numOptionsKeyValue[1]);

                        numericOptions.Add(varFeat, varFeatValue);
                    }
                }

                Configuration config = new Configuration(binaryOptions, numericOptions, measuredProperty);

                //if(configurations.Contains(config))
                //{
                //    GlobalState.logError.log("Mutiple definition of one configuration in the configurations file:  " + config.ToString());
                //}else
                //{
                configurations.Add(config);
                //}
            }
            GlobalState.logInfo.logLine("Configs with too large deviation: " + configsWithTooLargeDeviation);
            return configurations.ToList();
        }
Exemplo n.º 11
0
        /// <summary>
        /// This method returns a list of all configurations stored in a given file. All options of the configurations have to be defined in the variability model.
        /// </summary>
        /// <param name="dat">Object representing the configuration file.</param>
        /// <param name="model">Variability model of the configurations.</param>
        /// <returns>Returns a list of configurations that were defined in the XML document. Can be an empty list.</returns>
        public static List <Configuration> readConfigurations(XmlDocument dat, VariabilityModel model)
        {
            XmlElement currentElemt = dat.DocumentElement;

            HashSet <Configuration> configurations = new HashSet <Configuration>();

            int numberOfConfigs = currentElemt.ChildNodes.Count;
            int configsWithTooLargeDeviation = 0;

            foreach (XmlNode node in currentElemt.ChildNodes)
            {
                bool readMultipleMeasurements = false;
                if (node.Attributes.Count > 0 && node.Attributes[0].Value.ToLower() == "true")
                {
                    readMultipleMeasurements = true;
                }
                Dictionary <NFProperty, double> propertiesForConfig = new Dictionary <NFProperty, double>();;
                bool   alternativeFormat = false;
                string binaryString      = "";
                string numericString     = "";
                string configID          = "";
                Dictionary <NFProperty, double> measuredProperty = new Dictionary <NFProperty, double>();
                Configuration c            = null;
                bool          hasSetConfig = false;
                foreach (XmlNode childNode in node.ChildNodes)
                {
                    if (c == null && hasSetConfig)
                    {
                        continue;
                    }
                    switch (childNode.Attributes[0].Value)
                    {
                    // TODO we use this to support result files having the old structure
                    case "Configuration":
                        binaryString = childNode.InnerText;
                        break;

                    case "Variable Features":
                        numericString = childNode.InnerText;
                        break;

                    case "BinaryOptions":
                        binaryString = childNode.InnerText;
                        break;

                    case "NumericOptions":
                        numericString = childNode.InnerText;
                        break;

                    case "ConfigID":
                        if (readMultipleMeasurements)
                        {
                            configID = childNode.InnerText.Replace("_", "%;%");
                        }
                        else
                        {
                            configID = childNode.InnerText;
                        }
                        if (configID.Contains("%;%seek") && configID.Contains("%;%seek0") == false)
                        {
                            hasSetConfig = true;
                            c            = null;
                            break;
                        }
                        alternativeFormat = true;
                        c            = Configuration.createFromHashString(configID, GlobalState.varModel);
                        hasSetConfig = true;
                        break;

                    case "CompilerOptions":
                        //todo
                        break;

                    case "ConfigFileOptions":
                        //todo
                        break;

                    case "ParameterOptions":
                        //todo
                        break;

                    case "ProgramName":
                        //todo
                        break;

                    case "StartupBegin":
                        //todo
                        break;

                    case "StartupEnd":
                        //todo
                        break;

                    default:
                        NFProperty property      = GlobalState.getOrCreateProperty(childNode.Attributes[0].Value);
                        double     measuredValue = 0;
                        //-1 means that measurement failed... 3rd values strongly devigates in C.'s measurements, hence we use it only in case we have no other measurements
                        if (readMultipleMeasurements)
                        {
                            if (property.Name != "run-real")
                            {
                                continue;
                            }
                            String[] m    = childNode.InnerText.ToString().Split(',');
                            double   val1 = 0;
                            if (!Double.TryParse(m[0], out val1))
                            {
                                break;
                            }
                            if (m.Length > 1)
                            {
                                List <double> values = new List <double>();
                                double        avg    = 0;
                                foreach (var i in m)
                                {
                                    double d = Convert.ToDouble(i);
                                    if (d != -1)
                                    {
                                        values.Add(d);
                                        avg += d;
                                    }
                                }
                                if (values.Count == 0)
                                {
                                    configsWithTooLargeDeviation++;
                                    c = null;
                                    break;
                                }
                                avg = avg / values.Count;

                                /* foreach (var d in values)
                                 * {
                                 *   if ((d / avg) * 100 > 10)
                                 *   {
                                 *       configsWithTooLargeDeviation++;
                                 *       c = null;
                                 *       break;
                                 *   }
                                 * }*/
                                measuredValue = avg;

                                /*double val2 = Convert.ToDouble(m[1]);
                                 * if (val1 == -1)
                                 *  measuredValue = val2;
                                 * else if (val1 == -1 && val2 == -1)
                                 *  measuredValue = Convert.ToDouble(m[2]);
                                 * else if (val2 == -1)
                                 *  measuredValue = val1;
                                 * else
                                 *  measuredValue = (val1 + val2) / 2;*/
                            }
                            else
                            {
                                measuredValue = val1;
                            }
                        }
                        else
                        {
                            measuredValue = Convert.ToDouble(childNode.InnerText.ToString().Replace(',', '.'));
                        }
                        if (alternativeFormat && c != null)
                        {
                            c.setMeasuredValue(property, measuredValue);
                        }
                        else
                        {
                            measuredProperty.Add(property, measuredValue);
                        }
                        break;
                    }
                }

                if (alternativeFormat && c != null)
                {
                    if (configurations.Contains(c))
                    {
                        GlobalState.logError.log("Mutiple definition of one configuration in the configurations file:  " + c.ToString());
                    }
                    else
                    {
                        // if (GlobalState.currentNFP != null && c.nfpValues.Keys.Contains(GlobalState.currentNFP) && c.nfpValues[GlobalState.currentNFP] != -1)
                        configurations.Add(c);
                    }
                    cont : { }
                    continue;
                }

                Dictionary <BinaryOption, BinaryOption.BinaryValue> binaryOptions = new Dictionary <BinaryOption, BinaryOption.BinaryValue>();

                string[] binaryOptionNames = binaryString.Split(',');
                foreach (string binaryOptionName in binaryOptionNames)
                {
                    string currOption = binaryOptionName.Trim();
                    if (currOption.Length > 0)
                    {
                        BinaryOption bOpt = null;

                        bOpt = model.getBinaryOption(currOption);

                        if (bOpt == null)
                        {
                            GlobalState.logError.log("No Binary option found with name: " + currOption);
                        }
                        binaryOptions.Add(bOpt, BinaryOption.BinaryValue.Selected);
                    }
                }

                // Add "root" binary option to the configuration
                if (!binaryOptions.ContainsKey(model.Root))
                {
                    binaryOptions.Add(model.Root, BinaryOption.BinaryValue.Selected);
                }


                Dictionary <NumericOption, double> numericOptions = new Dictionary <NumericOption, double>();
                if (!string.IsNullOrEmpty(numericString))
                {
                    string[] numOptionArray = numericString.Trim().Split(',');
                    foreach (string numOption in numOptionArray)
                    {
                        string[] numOptionsKeyValue;
                        if (numOption.Contains(";"))
                        {
                            numOptionsKeyValue = numOption.Split(';');
                        }
                        else
                        {
                            numOptionsKeyValue = numOption.Split(' ');// added for rc-lookahead 40
                        }
                        numOptionsKeyValue[0] = numOptionsKeyValue[0].Trim();
                        if (numOptionsKeyValue[0].Length == 0)
                        {
                            continue;
                        }
                        NumericOption varFeat = model.getNumericOption(numOptionsKeyValue[0]);
                        if (varFeat == null)
                        {
                            GlobalState.logError.log("No numeric option found with name: " + numOptionsKeyValue[0]);
                        }
                        double varFeatValue = Convert.ToDouble(numOptionsKeyValue[1]);

                        numericOptions.Add(varFeat, varFeatValue);
                    }
                }

                Configuration config = new Configuration(binaryOptions, numericOptions, measuredProperty);

                //if(configurations.Contains(config))
                //{
                //    GlobalState.logError.log("Mutiple definition of one configuration in the configurations file:  " + config.ToString());
                //}else
                //{
                configurations.Add(config);
                //}
            }
            GlobalState.logInfo.log("Configs with too large deviation: " + configsWithTooLargeDeviation);
            return(configurations.ToList());
        }
        private bool tokenIsAFeatureOrNumber(string token, VariabilityModel varModel)
        {
            token = token.Trim();

            double value = 0.0;

            if (Double.TryParse(token, out value))
            {
                return true;
            }

            if (varModel != null)
            {
                NumericOption numOption = varModel.getNumericOption(token);
                if (numOption != null)
                {
                    if (!participatingNumOptions.Contains(numOption))
                        this.participatingNumOptions.Add(numOption);
                    numberOfParticipatingFeatures++;
                    return true;
                }

                BinaryOption binOption = varModel.getBinaryOption(token);
                if (binOption != null)
                {
                    if (!participatingBoolOptions.Contains(binOption))
                        this.participatingBoolOptions.Add(binOption);
                    numberOfParticipatingFeatures++;
                    return true;
                }
            }
            else
            {
                if(token.Equals(this.numOption.Name))
                    return true;
            }
            return false;
        }
        private double getValueOfToken(Dictionary<NumericOption,double> config, string token, VariabilityModel varModel)
        {
            token = token.Trim();

            double value = 0.0;

            if (Double.TryParse(token, out value))
            {
                return value;
            }

            if (varModel == null)
            {
                if (token.Equals(this.numOption.Name))
                    return config[this.numOption];
            }
            else
            {
                NumericOption numOpt = varModel.getNumericOption(token);
                if (numOpt != null)
                    return (config[numOpt]);
            }
            return 0.0;
        }
        private VariabilityModel extractFeatureModelFromExpression(String expression)
        {
            VariabilityModel varModel = new VariabilityModel("TEMP");

            string[] parts = expression.Split(new char[] { '+', '*', '[', ']' });

            double value = 0.0;
            for (int i = 0; i < parts.Length;i++)
            {
                string part = parts[i].Trim();
                if (part.Length > 0)
                {
                    if (!Double.TryParse(part, out value))
                    {
                        if (varModel.getNumericOption(part) == null)
                        {
                            NumericOption option = new NumericOption(varModel, part);
                            varModel.addConfigurationOption(option);
                        }
                    }
                }
            }
            return varModel;
        }
        private static double getValueOfToken(Configuration config, string token, VariabilityModel fm)
        {
            token = token.Trim();

            double value = 0.0;

            if (Double.TryParse(token, out value))
            {
                return value;
            }

            NumericOption numOpt = fm.getNumericOption(token);
            if (numOpt != null)
            {
                return config.NumericOptions[numOpt];
            }
            BinaryOption binOpt = fm.getBinaryOption(token);
            if (binOpt != null)
            {
                if(token.Equals("base"))
                    return 1.0;

                if (config.BinaryOptions.Keys.Contains(binOpt) && config.BinaryOptions[binOpt] == BinaryOption.BinaryValue.Selected)
                    return 1.0;
                else
                {
                    foreach (BinaryOption option in config.BinaryOptions.Keys)
                    {
                        if (option.Name == binOpt.Name )
                        {
                            return 1.0;
                        }
                    }
                }

            }
            return 0.0;
        }