/// <summary>Initializes a new instance of the <see cref="NLoptMultiDimOptimizer" /> class. /// </summary> /// <param name="algorithm">A value indicating the specific NLopt algorithm.</param> /// <param name="abortCondition">The abort (stopping) condition of the NLopt algorithm.</param> /// <param name="nloptPtrAdjustment">An optional delegate which will be called in the <c>Create</c> methods for <see cref="IMultiDimOptimizerAlgorithm"/> objects that allows individual adjustments of the internal <see cref="NLoptPtr"/> representation.</param> /// <param name="loggerStreamFactory">A factory for <see cref="ILoggerStream"/> objects, i.e. for a logging. Each <see cref="IMultiDimOptimizerAlgorithm"/> object will track the function values in the specified logger.</param> /// <remarks>One can use <paramref name="nloptPtrAdjustment"/> to change the Initial step size, initial "population" of random points, set Local/subsidiary optimization algorithm etc. See /// the documentation of the NLopt library http://ab-initio.mit.edu/wiki/index.php/NLopt for further details.</remarks> public NLoptMultiDimOptimizer(NLoptAlgorithm algorithm, NLoptAbortCondition abortCondition, Action <NLoptPtr> nloptPtrAdjustment = null, Func <IMultiDimOptimizerAlgorithm, ILogger> loggerStreamFactory = null) { Algorithm = algorithm; Configuration = NLoptConfiguration.Create(algorithm); if (abortCondition == null) { throw new ArgumentNullException("abortCondition"); } AbortCondition = abortCondition; m_LongName = new IdentifierString(NLoptPtr.GetName(algorithm)); m_Name = new IdentifierString(algorithm.ToFormatString(EnumStringRepresentationUsage.StringAttribute)); Constraint = new NLoptConstraintFactory(this); Function = new NLoptFunctionFactory(this); m_nloptPtrAdjustment = nloptPtrAdjustment; m_LoggerStreamFactory = loggerStreamFactory; }
/// <summary>Initializes a new instance of the <see cref="NLoptFunction" /> class. /// </summary> /// <param name="nloptFunctionDescriptor">The <see cref="NLoptFunctionFactory"/> object that has been used as factory of the current instance.</param> /// <param name="dimension">The dimension of the feasible region.</param> /// <param name="nloptObjectiveFunction">The objective function in its <see cref="NLoptObjectiveFunction"/> representation.</param> internal NLoptFunction(NLoptFunctionFactory nloptFunctionDescriptor, int dimension, NLoptObjectiveFunction nloptObjectiveFunction) { m_NLoptFunctionDescriptor = nloptFunctionDescriptor; Dimension = dimension; NLoptObjectiveFunction = nloptObjectiveFunction; }