File size: 3,332 Bytes
b1b3bae |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
/// ------------------------------------------------------
/// 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
{
/// <summary>
/// Base-class for a benchmark optimization problem.
/// </summary>
public abstract class Benchmark : Problem
{
#region Constructors.
/// <summary>
/// Construct the object.
/// </summary>
/// <param name="dimensionality">Dimensionality of the problem.</param>
/// <param name="lowerBound">Lower boundary for entire search-space.</param>
/// <param name="upperBound">Upper boundary for entire search-space.</param>
/// <param name="lowerInit">Lower boundary for initialization.</param>
/// <param name="upperInit">Upper boundary for initialization.</param>
/// <param name="maxIterations">Max optimization iterations to perform.</param>
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;
/// <summary>
/// Dimensionality of the benchmark problem.
/// </summary>
public override int Dimensionality
{
get { return _dimensionality; }
}
double[] _lowerBound;
/// <summary>
/// Lower search-space boundary for the benchmark problem.
/// </summary>
public override double[] LowerBound
{
get { return _lowerBound; }
}
double[] _upperBound;
/// <summary>
/// Upper search-space boundary for the benchmark problem.
/// </summary>
public override double[] UpperBound
{
get { return _upperBound; }
}
double[] _lowerInit;
/// <summary>
/// Lower initialization boundary for the benchmark problem.
/// </summary>
public override double[] LowerInit
{
get { return _lowerInit; }
}
double[] _upperInit;
/// <summary>
/// Upper initialization boundary for the benchmark problem.
/// </summary>
public override double[] UpperInit
{
get { return _upperInit; }
}
#endregion.
}
}
|