Source code for kappa_sdk.kw.model.improve_variable
import math
from .model_parameter import ModelParameter
[docs]
class ImproveVariable:
    """ ImproveVariable object.
    Describes an improve variable with mim/max, actual value and transformation applied
    """
[docs]
    def __init__(self, model_parameter: ModelParameter, current_value: float, use_log_space: bool, minimum_bound: float, maximum_bound: float):
        self.model_parameter = model_parameter
        self.__use_log_space = use_log_space
        self._minimum_bound = minimum_bound
        self._maximum_bound = maximum_bound
        self._current_value_internal = current_value 
    def _apply_transformation_if_required(self, value: float) -> float:
        return math.log10(value) if self.__use_log_space else value
    @property
    def current_value_transformed(self) -> float:
        """
        Returns
        -------
        float:
            Current value transformed
        """
        return self._apply_transformation_if_required(self._current_value_internal)
    @property
    def minimum_bound_transformed(self) -> float:
        """
        Returns
        -------
        float:
            Minimum value transformed
        """
        return self._apply_transformation_if_required(self._minimum_bound)
    @property
    def maximum_bound_transformed(self) -> float:
        """
        Returns
        -------
        float:
            Maximum value transformed
        """
        return self._apply_transformation_if_required(self._maximum_bound)
    def __str__(self) -> str:
        return "Parameter: " + str(self.model_parameter.conditions['Type']) + ", min: " + str(self._minimum_bound) + ", max: " + str(self._maximum_bound)