/// ------------------------------------------------------ /// SwarmOps - Numeric and heuristic optimization for C# /// Copyright (C) 2003-2011 Magnus Erik Hvass Pedersen. /// Please see the file license.txt for license details. /// SwarmOps on the internet: http://www.Hvass-Labs.org/ /// ------------------------------------------------------ namespace SwarmOps.Problems { /// /// Base-class for a benchmark optimization problem. /// public abstract class Benchmark : Problem { #region Constructors. /// /// Construct the object. /// /// Dimensionality of the problem. /// Lower boundary for entire search-space. /// Upper boundary for entire search-space. /// Lower boundary for initialization. /// Upper boundary for initialization. /// Max optimization iterations to perform. public Benchmark( int dimensionality, double lowerBound, double upperBound, double lowerInit, double upperInit, int maxIterations) : base(maxIterations) { _dimensionality = dimensionality; _lowerBound = new double[Dimensionality]; _upperBound = new double[Dimensionality]; _lowerInit = new double[Dimensionality]; _upperInit = new double[Dimensionality]; for (int i = 0; i < Dimensionality; i++) { _lowerBound[i] = lowerBound; _upperBound[i] = upperBound; _lowerInit[i] = lowerInit; _upperInit[i] = upperInit; } } #endregion #region Base-class overrides. int _dimensionality; /// /// Dimensionality of the benchmark problem. /// public override int Dimensionality { get { return _dimensionality; } } double[] _lowerBound; /// /// Lower search-space boundary for the benchmark problem. /// public override double[] LowerBound { get { return _lowerBound; } } double[] _upperBound; /// /// Upper search-space boundary for the benchmark problem. /// public override double[] UpperBound { get { return _upperBound; } } double[] _lowerInit; /// /// Lower initialization boundary for the benchmark problem. /// public override double[] LowerInit { get { return _lowerInit; } } double[] _upperInit; /// /// Upper initialization boundary for the benchmark problem. /// public override double[] UpperInit { get { return _upperInit; } } #endregion. } }