/// <summary> /// Returns the value of the given numeric function. /// </summary> /// <param name="function">Grounded function atom.</param> /// <returns>Numeric value.</returns> public double GetNumericFunctionValue(IAtom function) { if (NumericFunctions == null || !NumericFunctions.ContainsKey(function)) { return(NumericFunction.UndefinedValue); } return(NumericFunctions[function]); }
/// <summary> /// Scale-down the value of the requested numeric function by the specified value. /// </summary> /// <param name="function">Requested numeric function.</param> /// <param name="value">Value to be scaled-down by.</param> public void ScaleDownNumericFunction(IAtom function, double value) { CheckNumericFunctionsInitialized(); if (!NumericFunctions.ContainsKey(function)) { NumericFunctions[function] = 0.0; } else { NumericFunctions[function] /= value; } }
/// <summary> /// Decrease the value of the requested numeric function by the specified value. /// </summary> /// <param name="function">Requested numeric function.</param> /// <param name="value">Value to be decreased by.</param> public void DecreaseNumericFunction(IAtom function, double value) { CheckNumericFunctionsInitialized(); if (!NumericFunctions.ContainsKey(function)) { NumericFunctions[function] = -value; } else { NumericFunctions[function] -= value; } }
/// <summary> /// Defines a new value for the requested function in the state. /// </summary> /// <param name="function">Requested function.</param> /// <param name="assignment">Value to be assigned.</param> public void AssignNumericFunction(IAtom function, double assignment) { if (NumericFunction.IsValueUndefined(assignment)) { if (NumericFunctions != null && NumericFunctions.ContainsKey(function)) { NumericFunctions.Remove(function); } } else { CheckNumericFunctionsInitialized(); NumericFunctions[function] = assignment; } }