public override IHyperCube <double> HomotheticTransform(IHyperCube <double> point, double factor) { var pt = point as BasicHyperCube; HyperCube <double> result = (BasicHyperCube)this.Clone(); performHomoteticTransform(point, factor, ref result); return(result); }
protected void performHomoteticTransform(IHyperCube <T> point, T factor, ref HyperCube <T> result) { foreach (var varName in this.GetVariableNames()) { var min = this.GetMinValue(varName); var max = this.GetMaxValue(varName); result.SetMinValue(varName, min); result.SetMaxValue(varName, max); var newVal = reflect(point.GetValue(varName), this.GetValue(varName), factor); var isInBounds = MetaheuristicsHelper.CheckInBounds(newVal, min, max, throwIfFalse: this.ThrowOnOutOfBounds); if (!isInBounds) { result = null; break; } result.SetValue(varName, newVal); } }