/// <summary>Initializes a new instance of the <see cref="OneDimSAOptimizerConfiguration"/> class. /// </summary> /// <param name="initialTemperature">The initial temperature.</param> /// <param name="coolDownFactor">The cool down factor.</param> /// <param name="initialStepLength">The initial step size.</param> /// <param name="stepLengthControlFactor">The factor that controls the step length adjustment.</param> /// <param name="pointGenerationRule">A value that describes the way how to generate the next randomly choosen point.</param> public OneDimSAOptimizerConfiguration(double initialTemperature = 1.0, double coolDownFactor = 0.85, double initialStepLength = 1.0, double stepLengthControlFactor = 2.0, GenerationRule pointGenerationRule = GenerationRule.UseWholeDomain) { InitialTemperature = initialTemperature; CoolDownFactor = coolDownFactor; InitialStepLength = initialStepLength; StepLengthControlFactor = stepLengthControlFactor; PointGenerationRule = pointGenerationRule; }
public PointField3D(int width, int height, int depth, GenerationRule rule = null) { if (rule == null) { rule = (x, y, z) => false; } data = Generate(width, height, depth, rule); }
// Generate iterates over each point in the point field and applies a given rule to each point public int[,,] Generate(int width, int height, int depth, [CanBeNull] GenerationRule rule = null) { int[,,] generatedData = new int[width, height, depth]; if (rule == null) { return(generatedData); } foreach (var x in Enumerable.Range(0, width)) { foreach (var y in Enumerable.Range(0, height)) { foreach (var z in Enumerable.Range(0, depth)) { generatedData[x, y, z] = rule(x, y, z) ? 1 : 0; } } } return(generatedData); }
/// <summary>Creates a new <see cref="OneDimSAOptimizerConfiguration"/> object. /// </summary> /// <param name="initialTemperature">The initial temperature.</param> /// <param name="coolDownFactor">The cool down factor.</param> /// <param name="initialStepLength">The initial step size.</param> /// <param name="stepLengthControlFactor">The factor that controls the step length adjustment.</param> /// <param name="pointGenerationRule">A value that describes the way how to generate the next randomly choosen point.</param> /// <returns>The specified <see cref="OneDimSAOptimizerConfiguration"/> object.</returns> public static OneDimSAOptimizerConfiguration Create(double initialTemperature = 1.0, double coolDownFactor = 0.85, double initialStepLength = 1.0, double stepLengthControlFactor = 2.0, GenerationRule pointGenerationRule = GenerationRule.UseWholeDomain) { return(new OneDimSAOptimizerConfiguration(initialTemperature, coolDownFactor, initialStepLength, stepLengthControlFactor, pointGenerationRule)); }