/// <summary>Initializes a new instance of the <see cref="BoxTransformationAlgorithm"/> class. /// </summary> /// <param name="optimizer">The <see cref="MultiDimOptimizer"/> object that serves as factory of the current object and solve optimization problems without constraints.</param> /// <param name="boxConstraint">The box constraint.</param> internal BoxTransformationAlgorithm(MultiDimOptimizer optimizer, MultiDimRegion.Interval boxConstraint) { m_Optimizer = optimizer ?? throw new ArgumentNullException(nameof(optimizer)); m_BoxConstraint = boxConstraint ?? throw new ArgumentNullException(nameof(boxConstraint)); m_TempFunctionArgument = new double[boxConstraint.Dimension]; m_InnerOptimizerAlgorithm = optimizer.Create(boxConstraint.Dimension); }
/// <summary>Initializes a new instance of the <see cref="QuadraticPenaltyAlgorithm"/> class. /// </summary> /// <param name="optimizer">The <see cref="MultiDimOptimizer"/> object that serves as factory of the current object and solve optimization problems without constraints.</param> /// <param name="multiDimRegionCollection">The constraints in its <see cref="MultiDimOptimizer.IConstraint"/> representation.</param> /// <param name="relativePenaltyWeight">The relative weight of the penalty function.</param> /// <param name="absolutePenaltyWeight">The absolute weight of the penalty function.</param> internal QuadraticPenaltyAlgorithm(MultiDimOptimizer optimizer, IEnumerable <MultiDimOptimizer.IConstraint> multiDimRegionCollection, double relativePenaltyWeight = 1e20, double absolutePenaltyWeight = 0.0) { m_Optimizer = optimizer ?? throw new ArgumentNullException(nameof(optimizer)); m_MultiDimRegions = CheckConstraintConsistency(multiDimRegionCollection); Dimension = multiDimRegionCollection.FirstOrDefault().Dimension; m_InnerOptimizerAlgorithm = optimizer.Create(Dimension); m_RelativePenaltyWeight = relativePenaltyWeight; m_AbsolutePenaltyWeight = absolutePenaltyWeight; }
/// <summary>Creates a new <see cref="IMultiDimOptimizerAlgorithm"/> object. /// </summary> /// <param name="multiDimOptimizer">The <see cref="MultiDimOptimizer"/> object.</param> /// <param name="constraints">A collection of contraints for the optimization algorithm.</param> /// <returns>A new <see cref="IMultiDimOptimizerAlgorithm"/> object.</returns> public static IMultiDimOptimizerAlgorithm Create(this MultiDimOptimizer multiDimOptimizer, params IMultiDimRegion[] constraints) { return(multiDimOptimizer.Create(GetConvertedConstraints(multiDimOptimizer, constraints).ToArray())); }
/// <summary>Creates a new <see cref="IMultiDimOptimizerAlgorithm"/> object. /// </summary> /// <param name="multiDimOptimizer">The <see cref="MultiDimOptimizer"/> object.</param> /// <param name="constraints">A collection of contraints for the optimization algorithm.</param> /// <returns>A new <see cref="IMultiDimOptimizerAlgorithm"/> object.</returns> public static IMultiDimOptimizerAlgorithm Create(this MultiDimOptimizer multiDimOptimizer, IEnumerable <IMultiDimRegion> constraints) { return(multiDimOptimizer.Create(GetConvertedConstraints(multiDimOptimizer, constraints).ToArray())); }