Exemplo n.º 1
0
        public RobustOptimisationStudy(string name, Treatment treatment, ExecutableComponent ec, OptimisationTemplate template, string parentName = "")
            : base(name, null, null, name, parentName)
        {
            Treatment        = treatment;
            StudiedComponent = ec;


            var DesignVariables = template.DesignVariables.Select(v => new RobOptDesignVariable {
                Name = v.Name
            }).ToList();
            var Objectives = template.Objectives.Select(o => new RobOptObjective {
                Name = o.Name, Type = o.Type
            }).ToList();
            var Constraints = template.Constraints.Select(c => new RobOptConstraint {
                Name = c.Name, Type = c.Type, Value = c.Value
            }).ToList();

            robOptTemplate = new RobOptTemplate()
            {
                DesignVariables = DesignVariables, Objectives = Objectives, Constraints = Constraints
            };


            ColumnNames.Add("ID");
            ColumnTypes.Add(DataTypes.INTEGER);
            ColumnFormats.Add(0);
            ColumnUnits.Add("");

            for (int i = 0; i < robOptTemplate.DesignVariables.Count(); i++)
            {
                string columnHeader = robOptTemplate.DesignVariables[i].Name;
                ColumnNames.Add(columnHeader);
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
            }
            for (int i = 0; i < robOptTemplate.Objectives.Count(); i++)
            {
                string columnHeader = robOptTemplate.Objectives[i].Name;

                // Loss Function
                ColumnNames.Add(columnHeader + "LF");
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
                // Mean
                ColumnNames.Add(columnHeader + "mean");
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
                // Variance
                ColumnNames.Add(columnHeader + "var");
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
            }
            for (int i = 0; i < robOptTemplate.Constraints.Count(); i++)
            {
                string columnHeader = robOptTemplate.Constraints[i].Name;

                // Loss Function
                ColumnNames.Add(columnHeader + "LF");
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
                // Mean
                ColumnNames.Add(columnHeader + "mean");
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
                // Variance
                ColumnNames.Add(columnHeader + "var");
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
            }


            TableNames.Add("RobOptimAllResults");
            TableNames.Add("RobOptimGenResults");
            Template = template;
        }
Exemplo n.º 2
0
        //public DOEplusURQStudy(string name, string description, Model worflow, List<Data> factors, List<Data> responses)
        public DOEplusURQStudy(string name, string description, List <string> names, Treatment treatment, FullFactorial fullFactorialDOE, WorkflowComponent worflow)
            : base(name, description)
        {
            TreatmentURQ     = treatment;
            this.names       = names; //DOE factors
            Treatment        = treatment;
            StudiedComponent = worflow;

            FullFactorialDOE = fullFactorialDOE;



            var DesignVariables = new List <RobOptDesignVariable>();

            for (int i = 0; i < ((string[, ])(Treatment.input_options.setuplist[0])).GetLength(0); i++)
            {
                var designVariable = new RobOptDesignVariable
                {
                    Name = ((string[, ])(Treatment.input_options.setuplist[0]))[i, 0]
                };
                //designVariable.LowerBound = ;
                //designVariable.UpperBound = ;
                DesignVariables.Add(designVariable);
            }
            var Objectives = new List <RobOptObjective>();

            for (int i = 0; i < ((string[, ])(Treatment.input_options.setuplist[1])).GetLength(0); i++)
            {
                var objective = new RobOptObjective
                {
                    Name = ((string[, ])(Treatment.input_options.setuplist[1]))[i, 0]
                };
                if (((string[, ])(Treatment.input_options.setuplist[1]))[i, 2] == "minimise")
                {
                    objective.Type = ObjectiveType.Minimise;
                }
                else if (((string[, ])(Treatment.input_options.setuplist[1]))[i, 2] == "maximise")
                {
                    objective.Type = ObjectiveType.Maximise;
                }
                Objectives.Add(objective);
            }
            var Constraints = new List <RobOptConstraint>();

            for (int i = 0; i < ((string[, ])(Treatment.input_options.setuplist[2])).GetLength(0); i++)
            {
                var constraint = new RobOptConstraint
                {
                    Name = ((string[, ])(Treatment.input_options.setuplist[2]))[i, 0]
                };
                if (((string[, ])(Treatment.input_options.setuplist[2]))[i, 2] == "<=")
                {
                    constraint.Type = ConstraintType.LessThanOrEqual;
                }
                else if (((string[, ])(Treatment.input_options.setuplist[2]))[i, 2] == ">=")
                {
                    constraint.Type = ConstraintType.GreatorThanOrEqual;
                }
                constraint.Value = Convert.ToDouble(((string[, ])(Treatment.input_options.setuplist[2]))[i, 3]);
                Constraints.Add(constraint);
            }
            robOptTemplate = new RobOptTemplate()
            {
                DesignVariables = DesignVariables, Objectives = Objectives, Constraints = Constraints
            };



            ColumnNames.Add("ID");
            ColumnTypes.Add(DataTypes.INTEGER);
            ColumnFormats.Add(0);
            ColumnUnits.Add("");

            for (int i = 0; i < this.names.Count; i++)
            {
                string columnHeader = this.names[i];
                ColumnNames.Add(columnHeader);
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
            }


            for (int i = 0; i < robOptTemplate.DesignVariables.Count(); i++)
            {
                if (!this.names.Contains(robOptTemplate.DesignVariables[i].Name))
                {
                    string columnHeader = robOptTemplate.DesignVariables[i].Name;
                    ColumnNames.Add(columnHeader);
                    ColumnTypes.Add(DataTypes.DOUBLE);
                    ColumnFormats.Add(4);
                    ColumnUnits.Add("");
                }
            }
            for (int i = 0; i < robOptTemplate.Objectives.Count(); i++)
            {
                string columnHeader = robOptTemplate.Objectives[i].Name;

                // Loss Function
                ColumnNames.Add(columnHeader + "LF");
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
                // Mean
                ColumnNames.Add(columnHeader + "mean");
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
                // Variance
                ColumnNames.Add(columnHeader + "var");
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
            }
            for (int i = 0; i < robOptTemplate.Constraints.Count(); i++)
            {
                string columnHeader = robOptTemplate.Constraints[i].Name;

                // Loss Function
                ColumnNames.Add(columnHeader + "LF");
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
                // Mean
                ColumnNames.Add(columnHeader + "mean");
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
                // Variance
                ColumnNames.Add(columnHeader + "var");
                ColumnTypes.Add(DataTypes.DOUBLE);
                ColumnFormats.Add(4);
                ColumnUnits.Add("");
            }



            TableNames.Add("DOE");
        }