public DetOptStudy(string name, string description, ExecutableComponent studiedComponent, OptimisationTemplate optimisationTemplate, Treatment treatment, string parentName = "") : base(name, null, null, description, parentName) { OptimisationTemplate = optimisationTemplate; base.Treatment = treatment; StudiedComponent = studiedComponent; // Create SQL statements to create tables, sqlStatement1 for OptimAllResults and sqlStatement2 for OptimGenResults sqlStatement1 = "create table OptimAllResults ("; sqlStatement2 = "create table OptimGenResults ("; sqlStatement1 += "ID int, "; sqlStatement2 += "ID int, Category int, "; #region Atif // Prepare results database foreach (BoundedDesignVariableNoInital designVariable in this.OptimisationTemplate.DesignVariables) { string columnHeader = designVariable.Name; ColumnNames.Add(columnHeader); sqlStatement1 += columnHeader + " "; sqlStatement2 += columnHeader + " "; if (designVariable.Data is IntegerData) { ColumnTypes.Add(DataTypes.INTEGER); ColumnFormats.Add(0); sqlStatement1 += "int, "; sqlStatement2 += "int, "; } else if (designVariable.Data is DoubleData) { ColumnTypes.Add(DataTypes.DOUBLE); ColumnFormats.Add(((DoubleData)(designVariable.Data)).DecimalPlaces); sqlStatement1 += "float, "; sqlStatement2 += "float, "; } ColumnUnits.Add(designVariable.Data.Unit); MinValues.Add(designVariable.LowerBound); MaxValues.Add(designVariable.UpperBound); } foreach (Objective objective in this.OptimisationTemplate.Objectives) { string columnHeader = objective.Name; ColumnNames.Add(columnHeader); sqlStatement1 += columnHeader + " "; sqlStatement2 += columnHeader + " "; if (objective.Data is IntegerData) { ColumnTypes.Add(DataTypes.INTEGER); ColumnFormats.Add(0); sqlStatement1 += "int, "; sqlStatement2 += "int, "; } else if (objective.Data is DoubleData) { ColumnTypes.Add(DataTypes.DOUBLE); ColumnFormats.Add(((DoubleData)(objective.Data)).DecimalPlaces); sqlStatement1 += "float, "; sqlStatement2 += "float, "; } ColumnUnits.Add(objective.Data.Unit); MinValues.Add(Double.NaN); MaxValues.Add(Double.NaN); } foreach (Aircadia.ObjectModel.Treatments.Optimisers.Formulation.Constraint constraint in this.OptimisationTemplate.Constraints) { string columnHeader = constraint.Name; ColumnNames.Add(columnHeader); sqlStatement1 += columnHeader + " "; sqlStatement2 += columnHeader + " "; if (constraint.Data is IntegerData) { ColumnTypes.Add(DataTypes.INTEGER); ColumnFormats.Add(0); sqlStatement1 += "int, "; sqlStatement2 += "int, "; } else if (constraint.Data is DoubleData) { ColumnTypes.Add(DataTypes.DOUBLE); ColumnFormats.Add(((DoubleData)(constraint.Data)).DecimalPlaces); sqlStatement1 += "float, "; sqlStatement2 += "float, "; } ColumnUnits.Add(constraint.Data.Unit); MinValues.Add(Double.NaN); MaxValues.Add(Double.NaN); } TableNames.Add("OptimAllResults"); TableNames.Add("OptimGenResults"); if (this.OptimisationTemplate.DesignVariables.Count() + this.OptimisationTemplate.Objectives.Count() + this.OptimisationTemplate.Constraints.Count() > 0) { sqlStatement1 = sqlStatement1.Remove(sqlStatement1.Length - 2); sqlStatement2 = sqlStatement2.Remove(sqlStatement2.Length - 2); } sqlStatement1 += ")"; sqlStatement2 += ")"; #endregion Atif Treatment.CreateFolder(); }