Ejemplo n.º 1
0
        /// <summary>
        /// <inheritdoc />
        /// In addition this method will register the following data:
        /// <list>
        ///  <item><see cref="SolutionCallback{T, TPolicy}"/></item>
        ///  <item><see cref="PivotSelectionRule"/></item>
        /// </list>
        /// </summary>
        /// <param name="optData"></param>
        protected override void ParseOptimizationData(params IOptimizationData[] optData)
        {
            // Allow base class to register its own data.
            base.ParseOptimizationData(optData);

            // reset the callback before parsing
            solutionCallback = null;

            foreach (var data in optData)
            {
                if (data is SolutionCallback <T, TPolicy> )
                {
                    solutionCallback = (SolutionCallback <T, TPolicy>)data;
                    continue;
                }
                if (data is PivotSelectionRule)
                {
                    pivotSelection = (PivotSelectionRule)data;
                    continue;
                }
                if (data is GoalType)
                {
                    GoalType = (GoalType)data;
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Builds a simplex solver with a specified accepted amount of error.
 /// </summary>
 /// <param name="epsilon">Amount of error to accept for algorithm convergence.</param>
 /// <param name="maxUlps">Amount of error to accept in floating point comparisons.</param>
 /// <param name="cutOff">Values smaller than the cutOff are treated as zero.</param>
 /// <param name="goalType"></param>
 public SimplexSolver(T epsilon, int maxUlps, T cutOff, GoalType goalType)
 {
     this.epsilon        = epsilon;
     this.maxUlps        = maxUlps;
     this.cutOff         = cutOff;
     this.pivotSelection = PivotSelectionRule.DANTZIG;
     GoalType            = goalType;
 }