fuzzy_dl_owl2.fuzzydl.concept.concrete.right_concrete_concept

A specialized class models a fuzzy logic concept characterized by a “right shoulder” membership function, where the degree of truth transitions linearly from zero to one as an input value increases.

Description

It is designed to represent linguistic terms that imply a threshold or increasing magnitude, such as “high temperature” or “large size,” by defining a specific domain interval and a transition range. Initialization logic enforces strict geometric constraints to ensure the domain boundaries fully encompass the transition interval, guaranteeing structural validity for subsequent calculations. Core functionality involves computing membership degrees through linear interpolation for values falling within the transition range, while returning absolute truth values for inputs outside this range. Additionally, the component integrates with a broader fuzzy description logic framework by supporting standard logical operations like negation, conjunction, and disjunction through operator overloading, which delegates complex logic to a centralized operator handler.

Classes

RightConcreteConcept

This class models a specific type of fuzzy logic concept characterized by a "right shoulder" membership function, where the degree of truth increases linearly from zero to one over a specified interval. It is typically used to represent concepts that become increasingly true as a variable grows larger, such as "high temperature" or "large size." To use this class, instantiate it with a name, the domain boundaries (k1, k2) defining the valid range of the variable, and the transition boundaries (a, b) defining the interval over which the membership ramps up. The class ensures structural integrity by validating that the domain fully encompasses the transition interval and that the transition boundaries are ordered correctly. Once instantiated, the membership degree for any value can be calculated using the get_membership_degree method, and the concept supports standard fuzzy logic operations like negation, conjunction, and disjunction.

Module Contents

UML Class Diagram for RightConcreteConcept

UML Class Diagram for RightConcreteConcept

class RightConcreteConcept(name: str, k1: float, k2: float, a: float, b: float)[source]

Bases: fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_concrete_concept.FuzzyConcreteConcept

Inheritance diagram of fuzzy_dl_owl2.fuzzydl.concept.concrete.right_concrete_concept.RightConcreteConcept

This class models a specific type of fuzzy logic concept characterized by a “right shoulder” membership function, where the degree of truth increases linearly from zero to one over a specified interval. It is typically used to represent concepts that become increasingly true as a variable grows larger, such as “high temperature” or “large size.” To use this class, instantiate it with a name, the domain boundaries (k1, k2) defining the valid range of the variable, and the transition boundaries (a, b) defining the interval over which the membership ramps up. The class ensures structural integrity by validating that the domain fully encompasses the transition interval and that the transition boundaries are ordered correctly. Once instantiated, the membership degree for any value can be calculated using the get_membership_degree method, and the concept supports standard fuzzy logic operations like negation, conjunction, and disjunction.

Parameters:
  • k1 (float) – The lower bound of the domain interval over which the concept is defined.

  • k2 (float) – The upper bound of the interval [k1, k2] defining the domain of the concept.

  • _a (float) – The lower bound of the interval for which the concept is satisfied, representing the threshold where the membership degree begins to increase from zero.

  • _b (float) – The upper bound of the satisfaction interval, representing the threshold where the membership degree becomes 1.

__and__(value: Self) Self[source]

Performs a logical or bitwise conjunction between the current instance and another instance of the same type, typically invoked via the & operator. This method delegates the core logic to the and_ static method of the OperatorConcept class, ensuring that the operation is handled consistently within the broader module architecture. It returns a new instance of the class representing the result of the conjunction, leaving the original operands unchanged unless the underlying OperatorConcept implementation specifies otherwise.

Parameters:

value (Self) – The operand to perform the AND operation with.

Returns:

A new instance representing the logical conjunction of this object and the provided value.

Return type:

Self

__hash__() int[source]

Calculates the hash value of the instance by hashing the string representation of the object. This allows instances of this class to be used as keys in dictionaries or elements in sets. The hash is derived directly from the output of the __str__ method, meaning that any changes to the object’s state that modify its string representation will also change its hash value, potentially affecting its behavior in hash-based collections.

Returns:

An integer representing the hash of the object, computed from its string representation.

Return type:

int

__neg__() fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_concrete_concept.FuzzyConcreteConcept[source]

Implements the unary negation operator, allowing the concept to be inverted using the minus sign. This method returns a new FuzzyConcreteConcept representing the logical negation of the current instance, effectively computing the complement of the concept. The operation is performed by delegating to OperatorConcept.not_ and does not modify the original object in place.

Returns:

A FuzzyConcreteConcept representing the logical negation of the current concept.

Return type:

FuzzyConcreteConcept

__or__(value: Self) Self[source]

Implements the bitwise OR operation using the | operator, allowing the instance to be combined with another value of the same type. The method delegates the specific logic of the operation to OperatorConcept.or_, passing both the current instance and the provided value as arguments. It returns the resulting instance, which maintains the type of the operands, though any side effects depend on the implementation of the delegated or_ method.

Parameters:

value (Self) – The right-hand operand to combine with the current instance using the OR operation.

Returns:

The result of the OR operation between this instance and the provided value.

Return type:

Self

clone() Self[source]

Creates and returns a distinct copy of the current instance by instantiating a new RightConcreteConcept object. The new object is initialized with the exact same values for the name, k1, k2, a, and b attributes as the original. This method ensures that the original object remains unmodified while providing a separate entity with identical state.

Returns:

A new instance of the class initialized with the same attribute values as the current object.

Return type:

Self

compute_name() str[source]

Generates a standardized string representation of the right-shoulder concept instance by interpolating the object’s defining parameters into a specific format. The returned string follows the pattern “right-shoulder(k1, k2, a, b)”, utilizing the values of the corresponding attributes. This operation is read-only and does not alter the state of the object, though it requires that the necessary attributes exist on the instance.

Returns:

A string representing the name of the right-shoulder function, formatted with the current parameters k1, k2, a, and b.

Return type:

str

get_membership_degree(x: float) float[source]

Calculates the membership degree of a given value x within a right-shoulder fuzzy set defined by the parameters a and b. The function returns 0.0 if x is less than or equal to a, and 1.0 if x is greater than or equal to b. For values falling strictly between a and b, the method computes a linear interpolation, returning a value between 0.0 and 1.0 that represents the proportional distance of x from the lower bound a. This calculation is stateless and does not modify the object’s attributes.

Parameters:

x (float) – The input value to evaluate for membership.

Returns:

The degree of membership of x in the interval [a, b], ranging from 0.0 to 1.0 based on linear interpolation.

Return type:

float

_a: float
_b: float
property a: float

Sets the value of the property ‘a’ by converting the provided input to a float and storing it in the internal attribute ‘_a’. This method ensures that the underlying state is always maintained as a floating-point number, automatically handling type coercion for compatible inputs such as integers or numeric strings. If the provided value cannot be converted to a float, a TypeError or ValueError will be raised.

Parameters:

value (float) – The value to assign, converted to a float.

property b: float

Sets the value of the property ‘b’ by converting the provided input to a float and storing it in the internal attribute ‘_b’. This method ensures that the underlying state is always maintained as a floating-point number, regardless of the input type, provided it is convertible. If the input value cannot be parsed as a float, a ValueError or TypeError will be raised, and the object’s state will remain unchanged until the exception is handled.

Parameters:

value (float) – The new value to assign, which will be converted to a float.

k1: float

Sets the value of the k1 attribute for the instance, converting the input to a float to ensure type consistency. This method updates the private _k1 variable, effectively modifying the internal state of the FuzzyConcreteConcept object. Any subsequent operations relying on this parameter will reflect the new value.

Parameters:

value (float) – The new value for the k1 attribute.

k2: float

Sets the upper bound parameter k2 for the fuzzy concrete concept. This method enforces a constraint ensuring that the new value is greater than or equal to the existing k1 parameter; if k1 is larger than the provided value, a ValueError is raised. Upon successful validation, the input is converted to a float and stored in the internal state.

Parameters:

value (float) – The value to assign to the k2 parameter, which must be greater than or equal to k1.

Raises:

ValueError – Raised if the provided value is less than k1, as k2 must be greater than or equal to k1.