# scipopt/scip architecture

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

- Interactive diagram: https://gitdiagram.com/scipopt/scip
- Repository: https://github.com/scipopt/scip

## Overview

##### Main Components Identification

The system should be organized into these major components:

a. Core Solver Components:
- Constraint Handler System
- Cutting Plane Separator System
- Presolving System
- Branching System
- Node Selection System
- Pricing System
- Propagation System
- Heuristics System

b. Infrastructure Components:
- Memory Management
- File I/O System
- Linear Programming Interface
- Expression Framework
- Symmetry Handling
- Concurrent Solving Framework

##### Interface Layer
- Reader interfaces (MPS, LP, NL, etc.)
- Shell interface
- API interfaces

##### Problem Management Layer
- Problem data structures
- Variable management
- Constraint management
- Solution management

##### Algorithmic Layer
- Branch-and-bound framework
- Cut generation
- Presolving
- Heuristics
- Propagation

##### Infrastructure Layer
- Memory management
- Thread management
- Linear algebra
- Numerical components

##### Component Relationships

Key interactions:

a. Data Flow:
- Problem input → Reader → Problem Management
- Problem Management ↔ Algorithmic Components
- Solution Management → Output Handling

b. Control Flow:
- Main Solver Loop → Various Algorithmic Components
- Branch-and-Bound Tree Management → Node Selection
- Cut Manager → Separator Plugins

##### Plugin Architecture

Plugin system with:
- Core plugin interfaces
- Plugin management system
- Standard plugins
- Custom plugin integration points

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style definitions
    classDef interface fill:#a8d1ff,stroke:#000
    classDef core fill:#ffb366,stroke:#000
    classDef infra fill:#90EE90,stroke:#000
    classDef plugin fill:#FFB6C1,stroke:#000
    classDef management fill:#DDA0DD,stroke:#000

    %% Interface Layer
    subgraph Interface
        Reader["Reader Interfaces"]:::interface
        Shell["Shell Interface"]:::interface
        API["API Interfaces"]:::interface
    end

    %% Problem Management Layer
    subgraph ProblemMgmt
        ProbData["Problem Data Structures"]:::management
        VarMgmt["Variable Management"]:::management
        ConsMgmt["Constraint Management"]:::management
        SolMgmt["Solution Management"]:::management
    end

    %% Algorithmic Layer
    subgraph Algorithmic
        BnB["Branch-and-Bound Framework"]:::core
        CutGen["Cut Generation"]:::core
        Presol["Presolving"]:::core
        Heur["Heuristics"]:::core
        Prop["Propagation"]:::core
    end

    %% Core Components
    subgraph CoreComponents
        ConsHandler["Constraint Handler"]:::core
        CutPlane["Cutting Plane Separator"]:::core
        Branch["Branching System"]:::core
        NodeSel["Node Selection"]:::core
        Price["Pricing System"]:::core
        PropSys["Propagation System"]:::core
        HeurSys["Heuristics System"]:::core
    end

    %% Infrastructure Layer
    subgraph Infrastructure
        MemMgmt["Memory Management"]:::infra
        ThreadMgmt["Thread Management"]:::infra
        LinAlg["Linear Algebra"]:::infra
        NumComp["Numerical Components"]:::infra
        FileIO["File I/O System"]:::infra
        LPInterface["Linear Programming Interface"]:::infra
        ExprFrame["Expression Framework"]:::infra
        SymHandle["Symmetry Handling"]:::infra
        ConcSolve["Concurrent Solving"]:::infra
    end

    %% Relationships
    Reader --> ProbData
    ProbData --> BnB
    BnB --> CoreComponents
    CoreComponents --> SolMgmt
    SolMgmt --> Shell

    %% Infrastructure connections
    Infrastructure --> CoreComponents
    Infrastructure --> Algorithmic

    %% Click events
    click ConsHandler "https://github.com/scipopt/scip/blob/master/src/scip/cons.c"
    click CutPlane "https://github.com/scipopt/scip/blob/master/src/scip/sepa.c"
    click Presol "https://github.com/scipopt/scip/blob/master/src/scip/presol.c"
    click Branch "https://github.com/scipopt/scip/blob/master/src/scip/branch.c"
    click NodeSel "https://github.com/scipopt/scip/blob/master/src/scip/nodesel.c"
    click Price "https://github.com/scipopt/scip/blob/master/src/scip/pricer.c"
    click PropSys "https://github.com/scipopt/scip/blob/master/src/scip/prop.c"
    click HeurSys "https://github.com/scipopt/scip/blob/master/src/scip/heur.c"
    click MemMgmt "https://github.com/scipopt/scip/blob/master/src/blockmemshell/memory.c"
    click FileIO "https://github.com/scipopt/scip/blob/master/src/scip/reader.c"
    click LPInterface "https://github.com/scipopt/scip/blob/master/src/lpi/lpi.h"
    click ExprFrame "https://github.com/scipopt/scip/blob/master/src/scip/expr.c"
    click SymHandle "https://github.com/scipopt/scip/blob/master/src/symmetry/compute_symmetry.h"
    click ConcSolve "https://github.com/scipopt/scip/blob/master/src/scip/concurrent.c"

    %% Legend
    subgraph Legend
        L1["Interface Component"]:::interface
        L2["Core Component"]:::core
        L3["Infrastructure Component"]:::infra
        L4["Plugin Component"]:::plugin
        L5["Management Component"]:::management
    end
```
