# legrin/smpr architecture

> Architecture diagram of the GitHub repository legrin/smpr, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/legrin/smpr
- Repository: https://github.com/legrin/smpr

## Overview

##### Main components
- Core Application (SMPR): This is the central user interface and orchestrator. It contains main forms (e.g., MainForm, ModulesListForm, LicenseForm) and configuration files. It is responsible for loading and interacting with various decision modules.
- Common Library (Common): Contains shared components (data types, user controls, reflection helpers, serialization, and helper classes) that are used by different modules.
- Modular Decision Methods: There are many subprojects/directories (e.g., ModuleCollectiveBenefitFunctions, ModuleConflictsAndCompromisesMethods, ModuleCooperativeProblemSolving, ModuleDecisionsUnderFuzzyConditionsMethods, ModuleDecisionsUnderRiskAndUncertainityMethods, ModuleExpertProcessingMethods, ModuleFuzzyLogic, ModuleMulticriterionProblemMethods, ModuleNumericalAnalysis, ModuleResults, ModuleVotingMethods, ModuleTests, etc.) that encapsulate individual methods and strategies. Each module implements particular decision-making/optimization algorithms and often includes its own UI forms, business logic, and resource files.
- Supplemental Components:
– KeyGenerator: Likely a utility for generating keys or licenses.
– BuildProcessTemplates: Contains templates for continuous integration and deployment.
– Test Projects: SMPR.Tests and ModuleTests provide unit tests to ensure reliability.

##### Out relationships and interactions
- The SMPR core interacts with the modular decision methods via a plug-in architecture. Components are likely designed to be loosely coupled so that new modules can be added seamlessly. You might represent this with a “Module Manager” inside SMPR that dynamically loads modules.
- The Common library serves as the shared backbone that provides re-usable classes (like data buffers, matrix and vector operations, serialization, and helper methods) that modules and the core application depend on.
- UI components (forms, user controls) from both SMPR and the modules exchange data (e.g., decision model parameters, matrices, test results) using services provided by the Common layer.
- Test projects and build templates exist outside the main runtime flow, ensuring that the architecture supports continuous integration and systematic testing.

##### Architectural patterns and design principles
- Modular / Plug-In Architecture: Modules encapsulate distinct decision methods that can be loaded and run independently.
- Separation of Concerns: The UI (SMPR forms), business logic (modules and methods), and shared utilities (Common) are clearly separated.
- Reusability: Shared data types and utility functions in the Common directory are used across modules.
- Possibly some Model-View-Controller (MVC) or similar pattern is implicitly used as many modules have separate views, controllers (logic forms), and underlying data classes.

##### Relevant technologies
- .NET Framework – The project is built with C# and Windows Forms.
- Visual Studio Build and Deployment (build process templates, solution files, project files).
- Localization resources in multiple languages (files like About.en-US.resx, About.ru-RU.resx, etc.)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Application"
        SMPR["SMPR Core Application"]:::core
        Common["Common Library"]:::common
    end

    subgraph "Decision Modules"
        MCBF["Module: Collective Benefit Functions"]:::module
        MCCM["Module: Conflicts And Compromises Methods"]:::module
        MCPS["Module: Cooperative Problem Solving"]:::module
        MDFCM["Module: Decisions Under Fuzzy Conditions Methods"]:::module
        MDRAM["Module: Decisions Under Risk And Uncertainty Methods"]:::module
        MEP["Module: Expert Processing Methods"]:::module
        MFLogic["Module: Fuzzy Logic"]:::module
        MMCPM["Module: Multicriterion Problem Methods"]:::module
        MNumerical["Module: Numerical Analysis"]:::module
        MResults["Module: Results"]:::module
        MVoting["Module: Voting Methods"]:::module
    end

    subgraph "Auxiliary Components"
        Kg["KeyGenerator"]:::supp
        SMPRTests["SMPR.Tests"]:::test
        ModuleTests["ModuleTests"]:::test
        Build["BuildProcessTemplates"]:::supp
    end

    %% SMPR Core loads each decision module
    SMPR -->|"loads"| MCBF
    SMPR -->|"loads"| MCCM
    SMPR -->|"loads"| MCPS
    SMPR -->|"loads"| MDFCM
    SMPR -->|"loads"| MDRAM
    SMPR -->|"loads"| MEP
    SMPR -->|"loads"| MFLogic
    SMPR -->|"loads"| MMCPM
    SMPR -->|"loads"| MNumerical
    SMPR -->|"loads"| MResults
    SMPR -->|"loads"| MVoting

    %% Both SMPR core and modules use Common Library
    SMPR -->|"uses"| Common
    MCBF -->|"uses"| Common
    MCCM -->|"uses"| Common
    MCPS -->|"uses"| Common
    MDFCM -->|"uses"| Common
    MDRAM -->|"uses"| Common
    MEP -->|"uses"| Common
    MFLogic -->|"uses"| Common
    MMCPM -->|"uses"| Common
    MNumerical -->|"uses"| Common
    MResults -->|"uses"| Common
    MVoting -->|"uses"| Common

    %% SMPR Core utilizes KeyGenerator for license validation
    SMPR -->|"license-check"| Kg

    %% Test projects target core and modules
    SMPRTests -->|"tests"| SMPR
    ModuleTests -->|"tests"| MCBF
    ModuleTests -->|"tests"| MCCM
    ModuleTests -->|"tests"| MCPS
    ModuleTests -->|"tests"| MDFCM
    ModuleTests -->|"tests"| MDRAM
    ModuleTests -->|"tests"| MEP
    ModuleTests -->|"tests"| MFLogic
    ModuleTests -->|"tests"| MMCPM
    ModuleTests -->|"tests"| MNumerical
    ModuleTests -->|"tests"| MResults
    ModuleTests -->|"tests"| MVoting

    %% Build process templates support CI/CD for the core application
    Build -->|"build"| SMPR

    %% Click Events
    click SMPR "https://github.com/legrin/smpr/tree/master/SMPR"
    click Common "https://github.com/legrin/smpr/tree/master/Common"
    click MCBF "https://github.com/legrin/smpr/tree/master/ModuleCollectiveBenefitFunctions"
    click MCCM "https://github.com/legrin/smpr/tree/master/ModuleConflictsAndCompromisesMethods"
    click MCPS "https://github.com/legrin/smpr/tree/master/ModuleCooperativeProblemSolving"
    click MDFCM "https://github.com/legrin/smpr/tree/master/ModuleDecisionsUnderFuzzyConditionsMethods"
    click MDRAM "https://github.com/legrin/smpr/tree/master/ModuleDecisionsUnderRiskAndUncertainityMethods"
    click MEP "https://github.com/legrin/smpr/tree/master/ModuleExpertProcessingMethods"
    click MFLogic "https://github.com/legrin/smpr/tree/master/ModuleFuzzyLogic"
    click MMCPM "https://github.com/legrin/smpr/tree/master/ModuleMulticriterionProblemMethods"
    click MNumerical "https://github.com/legrin/smpr/tree/master/ModuleNumericalAnalysis"
    click MResults "https://github.com/legrin/smpr/tree/master/ModuleResults"
    click MVoting "https://github.com/legrin/smpr/tree/master/ModuleVotingMethods"
    click SMPRTests "https://github.com/legrin/smpr/blob/master/SMPR.Tests"
    click ModuleTests "https://github.com/legrin/smpr/tree/master/ModuleTests"
    click Kg "https://github.com/legrin/smpr/tree/master/KeyGenerator"
    click Build "https://github.com/legrin/smpr/tree/master/BuildProcessTemplates"

    %% Styles
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef common fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef module fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef test fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef supp fill:#DDA0DD,stroke:#333,stroke-width:2px;
```
