예제 #1
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);
        }
예제 #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);
        }
예제 #3
0
        /// <summary>
        /// Creates a numeric option based on the information of the given XML Node (calls base function)
        /// </summary>
        /// <param name="numOptNode">The XML Element containing the information</param>
        /// <param name="variabilityModel">The variability model to which the option belongs to</param>
        /// <returns>The newly created option</returns>
        internal static ConfigurationOption loadFromXML(XmlElement numOptNode, VariabilityModel variabilityModel)
        {
            NumericOption numOpt = new NumericOption(variabilityModel, "temp");

            numOpt.loadFromXML(numOptNode);
            return(numOpt);
        }
 /// <summary>
 /// Creates an influence function based on the expression. Only the name of the numeric option, numbers, operators, 
 /// and " n " should exist in the expression. 
 /// </summary>
 /// <param name="expression">A function consisting of numbers, operators and the configuration-option name.</param></param>
 /// <param name="option">A configuration option.</param>
 public InfluenceFunction(String expression, NumericOption option)
 {
     numOption = option;
     if (option.Name != "n" && expression.Split(' ').Contains("n"))
         expression = expression.Replace("n", option.Name);
     parseExpressionToPolnishNotation(expression);
 }
예제 #5
0
 /// <summary>
 /// Creates an influence function based on the expression. Only the name of the numeric option, numbers, operators,
 /// and " n " should exist in the expression.
 /// </summary>
 /// <param name="expression">A function consisting of numbers, operators and the configuration-option name.</param></param>
 /// <param name="option">A configuration option.</param>
 public InfluenceFunction(String expression, NumericOption option)
 {
     numOption = option;
     if (option.Name != "n" && expression.Split(' ').Contains("n"))
     {
         expression = expression.Replace("n", option.Name);
     }
     parseExpressionToPolnishNotation(expression);
 }
예제 #6
0
 private void loadNumericOptions(XmlElement xmlNode)
 {
     foreach (XmlElement numOptNode in xmlNode.ChildNodes)
     {
         if (!addConfigurationOption(NumericOption.loadFromXML(numOptNode, this)))
         {
             GlobalState.logError.logLine("Could not add option to the variability model. Possible reasons: invalid name, option already exists.");
         }
     }
 }
예제 #7
0
        /// <summary>
        /// Returns the csv-representation of the configuration.
        /// </summary>
        /// <returns>The csv-representation of the configuration.</returns>
        /// <param name="order">The order of the configuration options.</param>
        public string toCsv(List <ConfigurationOption> order, List <NFProperty> nfpProperties)
        {
            StringBuilder result = new StringBuilder();

            for (int i = 0; i < order.Count; i++)
            {
                ConfigurationOption c = order[i];

                if (i != 0)
                {
                    result.Append(ConfigurationPrinter.CSV_ELEMENT_DELIMITER);
                }

                if (c.GetType().Equals(typeof(BinaryOption)))
                {
                    if (this.BinaryOptions.ContainsKey((BinaryOption)c) &&
                        this.BinaryOptions[(BinaryOption)c] == BinaryOption.BinaryValue.Selected)
                    {
                        result.Append(1);
                    }
                    else
                    {
                        result.Append(0);
                    }
                }
                else
                {
                    NumericOption n = (NumericOption)c;
                    if (this.numericOptions.ContainsKey(n))
                    {
                        result.Append(this.NumericOptions[n]);
                    }
                }
            }

            if (nfpProperties != null && nfpProperties.Count != 0 && !GlobalState.currentNFP.Equals(NFProperty.DefaultProperty))
            {
                result.Append(ConfigurationPrinter.CSV_ELEMENT_DELIMITER);
                foreach (NFProperty nfp in this.nfpValues.Keys)
                {
                    if (nfpProperties.Contains(nfp))
                    {
                        result.Append(this.nfpValues[nfp]);
                        result.Append(ConfigurationPrinter.CSV_ELEMENT_DELIMITER);
                    }
                }
                result.Remove(result.Length - ConfigurationPrinter.CSV_ELEMENT_DELIMITER.Length, ConfigurationPrinter.CSV_ELEMENT_DELIMITER.Length);
            }
            result.Append(ConfigurationPrinter.CSV_ROW_DELIMITER);
            return(result.ToString());
        }
예제 #8
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);
        }
        /// <summary>
        /// Returns the csv-representation of the configuration.
        /// </summary>
        /// <returns>The csv-representation of the configuration.</returns>
        /// <param name="order">The order of the configuration options.</param>
        public string toCsv(List <ConfigurationOption> order)
        {
            StringBuilder result = new StringBuilder();

            for (int i = 0; i < order.Count; i++)
            {
                ConfigurationOption c = order[i];

                if (i != 0)
                {
                    result.Append(ConfigurationPrinter.CSV_ELEMENT_DELIMITER);
                }

                if (c.GetType().Equals(typeof(BinaryOption)))
                {
                    if (this.BinaryOptions.ContainsKey((BinaryOption)c))
                    {
                        result.Append(1);
                    }
                    else
                    {
                        result.Append(0);
                    }
                }
                else
                {
                    NumericOption n = (NumericOption)c;
                    if (this.numericOptions.ContainsKey(n))
                    {
                        result.Append(this.NumericOptions[n]);
                    }
                }
            }

            if (!GlobalState.currentNFP.Equals(NFProperty.DefaultProperty))
            {
                result.Append(ConfigurationPrinter.CSV_ELEMENT_DELIMITER);
                if (this.nfpValues.ContainsKey(GlobalState.currentNFP))
                {
                    result.Append(this.nfpValues[GlobalState.currentNFP]);
                }
                else
                {
                    result.Append(Double.NaN);
                }
            }
            result.Append(ConfigurationPrinter.CSV_ROW_DELIMITER);
            return(result.ToString());
        }
예제 #10
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);
        }
예제 #12
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>
 /// Creates a numeric option based on the information of the given XML Node (calls base function)
 /// </summary>
 /// <param name="numOptNode">The XML Element containing the information</param>
 /// <param name="variabilityModel">The variability model to which the option belongs to</param>
 /// <returns>The newly created option</returns>
 internal static ConfigurationOption loadFromXML(XmlElement numOptNode, VariabilityModel variabilityModel)
 {
     NumericOption numOpt = new NumericOption(variabilityModel, "temp");
     numOpt.loadFromXML(numOptNode);
     return numOpt;
 }
예제 #15
0
            /// <summary>
            /// Constructor of this class.
            /// </summary>
            /// <param name="opt">NumericOption with information for the componentsy</param>
            public NumericPanel(NumericOption opt, double currValue)
            {
                if (opt == null)
                    throw new ArgumentNullException("Parameter option must not be null!");

                option = opt;
                upDown = new OwnNumericUpDown(option.getAllValues(), currValue);
                upDown.MouseWheel += UpDown_MouseWheel;

                initializePanel(option);
            }
예제 #16
0
            /// <summary>
            /// Initializes this panel with the specified NumericOption.
            /// </summary>
            /// <param name="option">NumericOption with information for the components</param>
            private void initializePanel(NumericOption option)
            {
                // Configuring this panel
                Controls.Add(upDown);
                Controls.Add(label);
                Location = new System.Drawing.Point(0, 0);
                Name = "panel1";
                Size = new System.Drawing.Size(300, 37);
                TabIndex = 1;

                // Configuring the label
                label.AutoSize = true;
                label.Location = new System.Drawing.Point(12, 9);
                label.Name = "label";
                label.Size = new System.Drawing.Size(35, 13);
                label.TabIndex = 0;
                label.Text = option.Name;

                // Configuring the NumericUpDown
                upDown.Location = new System.Drawing.Point(200, 7);
                upDown.Name = "upDown";
                upDown.Size = new System.Drawing.Size(75, 20);
                upDown.TabIndex = 1;
            }
예제 #17
0
        private void button6_Click(object sender, EventArgs e)
        {
            if (this.optionName.Text != "")
            {
                if (this.optionName.Text.Contains("-"))
                {
                    hintLabel.Text = ("No '-' in option name!");
                    return;
                }
                ConfigurationOption newOption = null;
                if (numericButton.Checked)
                {
                    newOption = new NumericOption(GlobalState.varModel, this.optionName.Text);
                    ((NumericOption)newOption).Min_value = Convert.ToDouble(minValue.Text);
                    ((NumericOption)newOption).Max_value = Convert.ToDouble(maxValue.Text);
                    ((NumericOption)newOption).StepFunction = new InfluenceFunction(stepSize.Text, (NumericOption)newOption);
                    ((NumericOption)newOption).Prefix = prefix.Text;
                    ((NumericOption)newOption).Postfix = suffix.Text;
                }
                else
                {
                    newOption = new BinaryOption(GlobalState.varModel, this.optionName.Text);
                }
                if (this.parentBox.Text.Length > 0)
                    newOption.Parent = GlobalState.varModel.getOption(this.parentBox.Text);

                if (!GlobalState.varModel.addConfigurationOption(newOption))
                {
                    hintLabel.Text = ("Option with the name already exists.");
                    return;
                }
                this.Dispose();
                GlobalState.varModel.addConfigurationOption(newOption);
            }
            else
            {
                hintLabel.Text = ("Some values are missing!");
            }
        }
        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;
        }
예제 #19
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());
        }
        public VariabilityModel createVarModel()
        {
            VariabilityModel varMod = new VariabilityModel("testModel_1");

            // -------------------- BINARY OPTIONS ----------------
            BinaryOption binOp1 = new BinaryOption(varMod, "binOpt1");
            binOp1.Optional = false;
            binOp1.Prefix = "--";
            varMod.addConfigurationOption(binOp1);

            BinaryOption binOp2 = new BinaryOption(varMod, "binOpt2");
            binOp2.Optional = true;
            binOp2.Prefix = "-?";
            binOp2.Postfix = "kg";
            binOp2.Parent = binOp1;
            binOp2.OutputString = "binOpt2";
            varMod.addConfigurationOption(binOp2);

            BinaryOption binOp3 = new BinaryOption(varMod, "binOpt3");
            binOp3.Optional = true;
            binOp3.Prefix = "";
            binOp3.Postfix = "";
            binOp3.Parent = binOp1;
            List<List<ConfigurationOption>> exclude = new List<List<ConfigurationOption>>();
            List<ConfigurationOption> subExclude = new List<ConfigurationOption>();
            subExclude.Add(binOp2);
            exclude.Add(subExclude);
            binOp3.Excluded_Options = exclude;
            varMod.addConfigurationOption(binOp3);

            BinaryOption binOp4 = new BinaryOption(varMod, "binOpt4");
            binOp4.Optional = true;
            binOp4.Prefix = "4_";
            binOp4.Postfix = "_4";
            binOp4.Parent = binOp1;
            List<List<ConfigurationOption>> implied = new List<List<ConfigurationOption>>();
            List<ConfigurationOption> subimplied = new List<ConfigurationOption>();
            subimplied.Add(binOp2);
            implied.Add(subimplied);
            binOp4.Implied_Options = implied;
            varMod.addConfigurationOption(binOp4);

            // -------------------- NUMERIC OPTIONS ----------------

            NumericOption numOpt1 = new NumericOption(varMod, "numOpt1");
            numOpt1.DefaultValue = 0.0;
            numOpt1.Prefix = "num1-";
            numOpt1.Postfix = "--";
            numOpt1.Min_value = 0;
            numOpt1.Max_value = 10;
            numOpt1.StepFunction = new InfluenceFunction("n + 2");
            varMod.addConfigurationOption(numOpt1);

            NumericOption numOpt2 = new NumericOption(varMod, "numOpt2");
            numOpt2.DefaultValue = 0.8;
            numOpt2.Prefix = "";
            numOpt2.Postfix = "";
            numOpt2.Min_value = 0.1;
            numOpt2.Max_value = 5;
            numOpt2.StepFunction = new InfluenceFunction("n * 2");
            varMod.addConfigurationOption(numOpt2);

            return varMod;
        }