Exemplo n.º 1
0
        /// <summary>Initializes a new instance of the <see cref="OneDimSAOptimizer"/> class.
        /// </summary>
        /// <param name="randomNumberStream">The random number stream.</param>
        /// <param name="configuration">The configuration of the Simulated Annealing optimizer.</param>
        /// <param name="abortCondition">The abort (stopping) condition for the Simulated Annealing optimizer.</param>
        public OneDimSAOptimizer(IRandomNumberStream randomNumberStream, OneDimSAOptimizerConfiguration configuration, OneDimSAOptimizerAbortCondition abortCondition)
        {
            AbortCondition = abortCondition ?? throw new ArgumentNullException(nameof(abortCondition));
            Configuration  = configuration ?? throw new ArgumentNullException(nameof(configuration));

            if (randomNumberStream == null)
            {
                throw new ArgumentNullException(nameof(randomNumberStream));
            }
            m_SingleRandomNumberStream = new SingleRandomNumberStream(randomNumberStream, 250);

            m_Name = new IdentifierString(String.Format("1-dim Simulated Annealing; {0}", abortCondition.ToString()));
            m_ObjectiveFunctionFactory = new OneDimOptimizerFunctionFactory();
            m_ConstraintDescriptor     = new OneDimOptimizerConstraintFactory(OneDimOptimizerConstraintFactory.ConstraintType.BoundedInterval);
        }
Exemplo n.º 2
0
        /// <summary>Initializes a new instance of the <see cref="PraxisOptimizer"/> class.
        /// </summary>
        /// <param name="randomNumberStream">The random number stream.</param>
        /// <param name="abortCondition">The abort (stopping) condition for the Simulated Annealing optimizer.</param>
        /// <param name="constraintProvider">The constraint provider, i.e. transformation etc. for the support of specific constraints (the original algorithm does not support any constraints).</param>
        /// <param name="scalingFactor">A scaling parameter. If the scales for the different parameters are very different this value should be/ set to a value of about 10.0.</param>
        /// <param name="expectedDistanceToSolution">A step length parameter which should be set equal to the expected distance from the solution.</param>
        public PraxisOptimizer(IRandomNumberStream randomNumberStream, PraxisOptimizerAbortCondition abortCondition, MultiDimOptimizerConstraintProvider constraintProvider, double scalingFactor = 1.0, double expectedDistanceToSolution = 1.0)
        {
            if (randomNumberStream == null)
            {
                throw new ArgumentNullException(nameof(randomNumberStream));
            }
            m_SingleRandomNumberStream = new SingleRandomNumberStream(randomNumberStream, 250);
            AbortCondition             = abortCondition ?? throw new ArgumentNullException(nameof(abortCondition));
            m_ConstraintProvider       = constraintProvider ?? throw new ArgumentNullException(nameof(constraintProvider));

            ScalingFactor = scalingFactor;
            ExpectedDistanceToSolution = expectedDistanceToSolution;
            m_Name = new IdentifierString("PRAXIS optimizer");
            m_FunctionDescriptor   = new OrdinaryMultiDimOptimizerFunctionFactory();
            m_ConstraintDescriptor = new MultiDimOptimizerConstraintFactory(constraintProvider.SupportedConstraints);
        }