예제 #1
0
        /// <summary>
        /// Same as Solve, but will relay if the solution was aborted due to incompatible dimensions.
        /// </summary>
        /// <param name="inputs"></param>
        /// <param name="successful"></param>
        /// <returns></returns>
        public double[] Solve(double[] inputs, out SolutionRemark remark)
        {
            //double[] results = (double[])inputs.Clone();

            if (HasParent)
            {
                inputs = parent.Solve(inputs, out remark);
                if (remark.Equals(SolutionRemark.UndersizedInputs))
                {
                    return(inputs);
                }
            }

            if (inputs.Length < InputDimension)
            {
                remark = SolutionRemark.UndersizedInputs;
                return(inputs);
            }

            else if (InputIsFixedSize && inputs.Length > InputDimension)
            {
                remark = SolutionRemark.OversizedInputs;
            }
            else
            {
                remark = SolutionRemark.Successful;
            }

            return(solveAlgorithm(inputs));
        }
예제 #2
0
        protected bool SolveAlgorithm(ref double[] inputs, Boa_Algorithm algorithm, string errorMessage)
        {
            SolutionRemark remark = 0;

            inputs = algorithm.Solve(inputs, out remark);

            if (remark.Equals(SolutionRemark.OversizedInputs))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Length of input list is oversized. Some values were ignored.");
            }

            else if (remark.Equals(SolutionRemark.UndersizedInputs))
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, errorMessage);
                return(false);
            }

            return(true);
        }