fuzzy_dl_owl2.fuzzydl.util.config_reader

A centralized configuration manager for a fuzzy description logic reasoning engine that loads parameters from files and command-line arguments to control precision, optimization strategies, and solver selection.

Description

The software establishes a single source of truth for operational parameters, defining default values for critical aspects such as the precision threshold, maximum individual generation limits, and various blocking optimizations used during reasoning. By leveraging the standard configuration parser, it reads settings from an external file and supports runtime overrides through a list of string arguments, allowing users to customize behavior without modifying the source code. During the loading process, the logic automatically derives secondary values, such as the number of precision digits based on the epsilon threshold, and dynamically updates global constants within the application to align with the numerical limits of the selected Mixed-Integer Linear Programming (MILP) solver. Error handling mechanisms are included to catch file access or parsing issues, printing diagnostic messages to standard output to aid troubleshooting while attempting to preserve a valid configuration state.

Classes

ConfigReader

A centralized configuration manager for a reasoning engine, defining default parameters that control precision, optimization levels, blocking strategies, and the selection of the Mixed-Integer Linear Programming (MILP) solver. It allows users to customize the reasoner's behavior by loading settings from a configuration file and overriding specific values via command-line arguments. When parameters are loaded, the manager automatically adjusts internal precision calculations and updates global constants within the application to match the capabilities of the selected solver provider.

Module Contents

UML Class Diagram for ConfigReader

UML Class Diagram for ConfigReader

class ConfigReader[source]

A centralized configuration manager for a reasoning engine, defining default parameters that control precision, optimization levels, blocking strategies, and the selection of the Mixed-Integer Linear Programming (MILP) solver. It allows users to customize the reasoner’s behavior by loading settings from a configuration file and overriding specific values via command-line arguments. When parameters are loaded, the manager automatically adjusts internal precision calculations and updates global constants within the application to match the capabilities of the selected solver provider.

Parameters:
  • ANYWHERE_DOUBLE_BLOCKING (bool) – Determines whether the anywhere double blocking optimization is applied.

  • ANYWHERE_SIMPLE_BLOCKING (bool) – Determines whether anywhere simple blocking is applied during reasoning.

  • DEBUG_PRINT (bool) – Flag to enable or disable the printing of debug messages to the console.

  • EPSILON (float) – Precision threshold defining the minimum degree of satisfaction required for a concept to be considered satisfied by an individual.

  • MAX_INDIVIDUALS (int) – Defines the maximum number of new individuals that can be generated during reasoning. A negative value disables this limit, allowing unlimited creation.

  • NUMBER_DIGITS (int) – Number of digits of precision, computed from the epsilon value to define the decimal places required for the reasoner’s operations.

  • OPTIMIZATIONS (int) – Level of optimizations applied. A value of 0 disables optimizations, while a positive value enables them. Default is 1.

  • RULE_ACYCLIC_TBOXES (bool) – Enables the rule acyclic TBox optimization.

  • OWL_ANNOTATION_LABEL (str) – The XML annotation label used to identify fuzzy logic constructs when creating or parsing Fuzzy OWL 2 ontologies.

  • MILP_PROVIDER (constants.MILPProvider) – Specifies the Mixed-Integer Linear Programming (MILP) solver backend used by the reasoner for optimization tasks, influencing internal numerical limits based on the selected provider.

static load_parameters(config_file: str, args: list[str]) None[source]

Reads configuration settings from the specified file and applies overrides from the provided argument list, which is interpreted as sequential key-value pairs. This method updates class-level attributes of ConfigReader and modifies global constants within the application’s constants module based on the loaded settings, such as the MILP provider and epsilon value. It also calculates derived values like NUMBER_DIGITS and prints a debug message if enabled. The provided argument list must contain an even number of elements to form valid key-value pairs; otherwise, a generic exception is triggered. Errors during file reading or parsing are caught and printed to standard output without halting execution, potentially leaving the configuration in a partially updated state.

Parameters:
  • config_file (str) – Filesystem path to the configuration file containing default parameters.

  • args (list[str]) – A list of strings representing key-value pairs to override configuration settings, interpreted as alternating keys and values.

ANYWHERE_DOUBLE_BLOCKING: bool = True
ANYWHERE_SIMPLE_BLOCKING: bool = True
DEBUG_PRINT: bool = True
EPSILON: float = 0.001
MAX_INDIVIDUALS: int = -1
MILP_PROVIDER: fuzzy_dl_owl2.fuzzydl.util.constants.MILPProvider
NUMBER_DIGITS: int = 2
OPTIMIZATIONS: int = 1
OWL_ANNOTATION_LABEL: str = 'fuzzyLabel'
RULE_ACYCLIC_TBOXES: bool = True