Exemplo n.º 1
0
            /// <summary>Initializes a new instance of the <see cref="State"/> class.
            /// </summary>
            /// <param name="classification">The classification of the result.</param>
            /// <param name="details">Additional details in its <see cref="InfoOutputProperty"/> representation.</param>
            /// <param name="evaluationsNeeded">The number of function evaluations needed by the algorithm to reach the desired accuracy.</param>
            /// <param name="iterationsNeeded">The number of iterations needed by the algorithm to reach the desired accuracy.</param>
            protected internal State(OptimizerErrorClassification classification, IEnumerable <InfoOutputProperty> details, int evaluationsNeeded = Int32.MaxValue, int iterationsNeeded = Int32.MaxValue)
            {
                Classification        = classification;
                EvaluationsNeeded     = evaluationsNeeded;
                IterationsNeeded      = iterationsNeeded;
                InfoOutputDetailLevel = InfoOutputDetailLevel.Full;

                var strBuilder = new StringBuilder();

                strBuilder.AppendFormat("{0}", Classification);

                if (details != null)
                {
                    foreach (var property in details)
                    {
                        strBuilder.AppendFormat("; {0}: {1}", property.Name.String, property.Value);
                    }
                    m_InfoOutputPackageAction = infoOutputPackage =>
                    {
                        foreach (var property in details)
                        {
                            infoOutputPackage.Add(property);
                        }
                    };
                }
                if (iterationsNeeded < Int32.MaxValue)
                {
                    strBuilder.AppendFormat("; Iterations needed: {0}", iterationsNeeded);
                }
                if (evaluationsNeeded < Int32.MaxValue)
                {
                    strBuilder.AppendFormat("; Evaluations needed: {0}", evaluationsNeeded);
                }
                m_StringRepresentation = strBuilder.ToString();
            }
Exemplo n.º 2
0
            /// <summary>Creates a new <see cref="State"/> object.
            /// </summary>
            /// <param name="classification">The classification of the result.</param>
            /// <param name="minimum">The estimated minimum of the specific algorithm.</param>
            /// <param name="evaluationsNeeded">The number of function evaluations needed by the algorithm to reach the desired accuracy.</param>
            /// <param name="iterationsNeeded">The number of iterations needed by the algorithm to reach the desired accuracy.</param>
            /// <param name="details">Additional details in its <see cref="InfoOutputProperty"/> representation.</param>
            /// <returns>A <see cref="State"/> object that represents the state of a specific calculation.</returns>
            public static State Create(OptimizerErrorClassification classification, double minimum, int evaluationsNeeded = Int32.MaxValue, int iterationsNeeded = Int32.MaxValue, params InfoOutputProperty[] details)
            {
                var properties = new List <InfoOutputProperty>()
                {
                    InfoOutputProperty.Create("Minimum", minimum)
                };

                if (details != null)
                {
                    properties.AddRange(details);
                }
                return(new State(classification, properties, evaluationsNeeded, iterationsNeeded));
            }
Exemplo n.º 3
0
            /// <summary>Initializes a new instance of the <see cref="State"/> class.
            /// </summary>
            /// <param name="classification">The classification of the result.</param>
            /// <param name="evaluationsNeeded">The number of function evaluations needed by the algorithm to reach the desired accuracy.</param>
            /// <param name="iterationsNeeded">The number of iterations needed by the algorithm to reach the desired accuracy.</param>
            protected internal State(OptimizerErrorClassification classification, int evaluationsNeeded = Int32.MaxValue, int iterationsNeeded = Int32.MaxValue)
            {
                Classification        = classification;
                EvaluationsNeeded     = evaluationsNeeded;
                IterationsNeeded      = iterationsNeeded;
                InfoOutputDetailLevel = InfoOutputDetailLevel.Full;

                var strBuilder = new StringBuilder();

                strBuilder.AppendFormat("{0}", Classification);

                if (iterationsNeeded < Int32.MaxValue)
                {
                    strBuilder.AppendFormat("; Iterations needed: {0}", iterationsNeeded);
                }
                if (evaluationsNeeded < Int32.MaxValue)
                {
                    strBuilder.AppendFormat("; Evaluations needed: {0}", evaluationsNeeded);
                }
                m_StringRepresentation    = strBuilder.ToString();
                m_InfoOutputPackageAction = null;
            }
Exemplo n.º 4
0
 /// <summary>Creates a new <see cref="State"/> object.
 /// </summary>
 /// <param name="classification">The classification of the result.</param>
 /// <param name="evaluationsNeeded">The number of function evaluations needed by the algorithm to reach the desired accuracy.</param>
 /// <param name="iterationsNeeded">The number of iterations needed by the algorithm to reach the desired accuracy.</param>
 /// <param name="details">Additional details in its <see cref="InfoOutputProperty"/> representation.</param>
 /// <returns>A <see cref="State"/> object that represents the state of a specific calculation.</returns>
 public static State Create(OptimizerErrorClassification classification, int evaluationsNeeded = Int32.MaxValue, int iterationsNeeded = Int32.MaxValue, params InfoOutputProperty[] details)
 {
     return(new State(classification, details, evaluationsNeeded, iterationsNeeded));
 }
Exemplo n.º 5
0
 /// <summary>Creates a new <see cref="State"/> object.
 /// </summary>
 /// <param name="classification">The classification of the result.</param>
 /// <returns>A <see cref="State"/> object that represents the state of a specific calculation.</returns>
 public static State Create(OptimizerErrorClassification classification)
 {
     return(new State(classification));
 }