Class OptimizeAttribute
- Namespace
- Balsam
- Assembly
- Balsam.Backtester.dll
An attribute to control optimization variables
[AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)]
public sealed class OptimizeAttribute : Attribute, IEnumerable<double>, IEnumerable
- Inheritance
-
OptimizeAttribute
- Implements
- Inherited Members
- Extension Methods
Constructors
OptimizeAttribute()
Default constructor. Typically one of the other constructors should be used.
public OptimizeAttribute()
OptimizeAttribute(double, double, double, bool, bool, bool)
Initializes a new OptimizeAttribute using the specifed start, stop, step and (optionally) multiply parameters.
public OptimizeAttribute(double start, double stop, double step, bool multiply = false, bool isInt = false, bool includeNaN = false)
Parameters
start
doubleThe starting value
stop
doubleThe ending value
step
doubleThe step value
multiply
boolIf true, the current value will be multiplied by 1 + step to get the next value in the sequence; otherwise, it is additive.
isInt
boolTrue if the parameter is an integer.
includeNaN
bool
OptimizeAttribute(params double[])
Initializes a new OptimizeAttribute using an arbitrary sequence of values.
public OptimizeAttribute(params double[] values)
Parameters
values
double[]
OptimizeAttribute(int)
Initializes a new OptimizeAttribute with the specified number of iterations. Useful for bootstrapping optimizations.
public OptimizeAttribute(int iterations)
Parameters
iterations
int
OptimizeAttribute(string, double, double, double, bool, bool, bool)
Optimizes the specified property using the specified parameters.
public OptimizeAttribute(string propertyName, double start, double stop, double step, bool multiply = false, bool isInt = false, bool includeNaN = false)
Parameters
OptimizeAttribute(string, params double[])
Optimizes the specified property using an arbitrary sequence of values.
public OptimizeAttribute(string propertyName, params double[] values)
Parameters
OptimizeAttribute(string, int)
Optimizes the specified property for the specified iterations.
public OptimizeAttribute(string propertyName, int iterations)
Parameters
OptimizeAttribute(Type)
Optimizes all values of the specified enum or boolean.
public OptimizeAttribute(Type type)
Parameters
type
Type
Properties
IsMultiplicative
Returns true if parameters are incremented using a multiplier.
public bool IsMultiplicative { get; set; }
Property Value
PropertyName
Gets/sets the name of the property that is the optimization target. For use in optimization scenarios where you are unable to decorate the class.
public string PropertyName { get; set; }
Property Value
PropertyType
Gets/sets the underlying property type that is the optimization target.
public Type PropertyType { get; set; }
Property Value
Start
Gets the starting value.
public double Start { get; set; }
Property Value
Step
Gets the increment.
public double Step { get; set; }
Property Value
Stop
Gets the ending value.
public double Stop { get; set; }
Property Value
TotalIterations
Gets the total number of iterations.
public int TotalIterations { get; }
Property Value
Methods
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<double> GetEnumerator()
Returns
ToString()
Returns a string representation of this object.
public override string ToString()