public FullFactorialDOEStudySergio(string name, string description, WorkflowComponent studiedComponent, List <BoundedDesignVariableNoInitial> factors, List <Data> responses, bool createFolder, string parentName = "")
            : base(name, description, studiedComponent, factors.Select(f => f.Data).ToList(), responses, parentName)
        {
            base.StudiedComponent = studiedComponent;

            // Copy factors to avoid aliasing problems when editing studies
            Factors   = factors.Select(f => f.Copy() as BoundedDesignVariableNoInitial).ToList();
            Responses = responses;


            SetIDColumn();

            foreach (BoundedDesignVariableNoInitial factor in Factors)
            {
                SetColumn(factor.Name, factor.Data);
            }


            foreach (Data response in Responses)
            {
                SetColumn(response.Name, response);
            }

            TableNames.Add(Name);

            Treatment = new FullFactorial("FullFactorial", "", studiedComponent, Factors, responses);
            if (createFolder)
            {
                Treatment.CreateFolder();
            }
        }
        public FullFactorialDOEStudy(string name, string description, WorkflowComponent workflow, List <Data> factors, List <decimal> startingValues, List <decimal> stepSizes, List <int> noOfLevels, List <Data> responses)
            : base(name, description, workflow, factors, responses)
        {
            base.StudiedComponent = workflow;

            this.startingValues = startingValues;
            this.stepSizes      = stepSizes;
            this.noOfLevels     = noOfLevels;



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

            for (int i = 0; i < factors.Count; i++)
            {
                string columnHeader = factors[i].Name;
                ColumnNames.Add(columnHeader);
                if (factors[i] is IntegerData)
                {
                    ColumnTypes.Add(DataTypes.INTEGER);
                    ColumnFormats.Add(0);
                    ColumnUnits.Add(((IntegerData)factors[i]).Unit);
                }
                else if (factors[i] is DoubleData)
                {
                    ColumnTypes.Add(DataTypes.DOUBLE);
                    ColumnFormats.Add(((DoubleData)factors[i]).DecimalPlaces);
                    ColumnUnits.Add(((DoubleData)factors[i]).Unit);
                }
            }
            for (int i = 0; i < responses.Count; i++)
            {
                string columnHeader = responses[i].Name;
                ColumnNames.Add(columnHeader);
                if (responses[i] is IntegerData)
                {
                    ColumnTypes.Add(DataTypes.INTEGER);
                    ColumnFormats.Add(0);
                    ColumnUnits.Add(((IntegerData)responses[i]).Unit);
                }
                else if (responses[i] is DoubleData)
                {
                    ColumnTypes.Add(DataTypes.DOUBLE);
                    ColumnFormats.Add(((DoubleData)responses[i]).DecimalPlaces);
                    ColumnUnits.Add(((DoubleData)responses[i]).Unit);
                }
            }



            TableNames.Add(Name);



            Treatment = new FullFactorial("testFF", "", Project.ProjectPath + "\\DOE.sdf", workflow as Workflow, factors, startingValues, stepSizes, noOfLevels, responses);
            Treatment.CreateFolder();
        }
示例#3
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");
        }