Skip to content

esshaghi/S-RAP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S-RAP: Shared Redundancy Allocation Problem

Python License Dependencies

This repository provides the Python implementation accompanying the manuscript:

Khayami et al."S-RAP: A Shared Redundancy Allocation Framework for Multi-Strategy Reliability Optimisation" (2024/2025)

Two optimisation models are implemented:

File Model Description
SRAP.py S-RAP Single shared spare pool allocated across all N subsystems
DedicatedRAP.py Dedicated-RAP Each subsystem receives its own dedicated spare pool (baseline)

Table of Contents


System Model

Series system of N independent subsystems. The system fails when any subsystem fails without a replacement spare being available.

  • Each subsystem (and each active spare) fails at constant rate λ (exponential lifetime).
  • Cold-standby spares have failure rate 0 until activated.
  • Standby activation succeeds with probability ρ (imperfect switching).
  • Resource constraints (cost, weight, volume, power) are enforced globally.

S-RAP maintains a single shared spare pool of m components available to any subsystem.
Dedicated-RAP gives each subsystem m(i) components that can only be used by that subsystem.

Reliability is computed exactly via Continuous-Time Markov Chain (CTMC) models solved using the matrix exponential method.


Redundancy Strategies

Four strategies are supported, selectable independently per run (S-RAP) or per subsystem (Dedicated-RAP):

Index Strategy Description
0 Active All m spares operate from t = 0, each at rate λ
1 Standby All m spares in cold standby; activated on demand with probability ρ
2 Mixed a active + b = m−a cold-standby spares; active spares used first, then standby
3 K-Mixed a active + b = m−a cold-standby spares; standby replenishment attempted after every active spare loss

Solution Encoding

S-RAP — one triplet [m, s, a]:

  • m — total shared spares (integer ≥ 0)
  • s — strategy index ∈ {0, 1, 2, 3}
  • a — active spares (integer; used only when s ∈ {2, 3}; strict 1 ≤ a ≤ m−1)

Dedicated-RAP — list of N triplets [[m(1),s(1),a(1)], …, [m(N),s(N),a(N)]]


Optimisation Framework

Both models use a Hybrid GA-SA metaheuristic (Sections 3.7.1–3.7.2):

  • Genetic Algorithm (GA) — global exploration via elitism (top 10%), tournament selection (size 3), single-point crossover, and bit-flip mutation.
  • Simulated Annealing (SA) — local refinement applied periodically to elite individuals (geometric cooling: T₀ = 100, α = 0.95, T_min = 0.1).

An optional Bayesian Optimisation (BO) layer (Section 3.7.3) tunes the four GA hyper-parameters before the final run:

Parameter Default BO Search Range
pop_size 50 [20, 200]
num_gens 100 [50, 500]
cross_prob 0.65 [0.50, 0.90]
mut_prob 0.10 [0.01, 0.20]

The BO surrogate is a Gaussian Process with a squared-exponential (RBF) kernel. The acquisition function is Expected Improvement (EI). The default protocol runs 10 Latin Hypercube initial samples + 50 BO iterations, each averaging 3 GA-SA replicates (180 total GA-SA evaluations).


Repository Structure

S-RAP/
│
├── SRAP.py              # S-RAP: shared pool model + GA-SA + optional BO
├── DedicatedRAP.py      # Dedicated-RAP: per-subsystem model + GA-SA + optional BO
│
├── README.md            # This file
├── requirements.txt     # Python dependencies
├── LICENSE              # MIT licence
└── .gitignore           # Standard Python gitignore

Installation

Prerequisites

  • Python 3.8 or later
  • pip

Steps

# 1. Clone the repository
git clone https://github.com/esshaghi/S-RAP.git
cd S-RAP

# 2. (Recommended) Create and activate a virtual environment
python -m venv venv
source venv/bin/activate        # Linux / macOS
# venv\Scripts\activate         # Windows

# 3. Install dependencies
pip install -r requirements.txt

Quick Start

Run S-RAP with default parameters (no BO)

python SRAP.py

Expected output:

============================================================
  S-RAP: Shared Redundancy Allocation Problem
============================================================
  System : N=5 subsystems, λ=0.005, t=100, ρ=0.95
  GA-SA  : pop=50, gens=100, pc=0.65, pm=0.1, sa_freq=10
------------------------------------------------------------
  Phase 2 – Final Hybrid GA-SA optimisation
  ...
  Result  : m=5, s=3 (K-Mixed), a=1
  Reliability R(t) = 0.922239
  Fitness          = 0.922239
  Total time       = ~12 s
============================================================

Run Dedicated-RAP with default parameters (no BO)

python DedicatedRAP.py

Enable Bayesian Optimisation

Open SRAP.py (or DedicatedRAP.py) and set USE_BO = True in the BO_CONFIG section:

BO_CONFIG = {
    "USE_BO"    : True,          # <-- change this
    "param_bounds" : {
        "pop_size"   : (20, 200),
        "num_gens"   : (50, 500),
        "cross_prob" : (0.50, 0.90),
        "mut_prob"   : (0.01, 0.20),
    },
    "n_init"    : 10,
    "n_iter"    : 50,
    "replicates": 3,
    "verbose"   : True,
}

Then run as normal. BO progress is printed to the console:

  [BO] Initialisation: 10 Latin Hypercube samples (3 replicates each) ...
  [BO] Init complete. Best reliability so far: 0.918432
  [BO] Iter   1/50  f=0.920117  best=0.920117  [pop_size=84, ...]
  ...
  [BO] Tuning complete.
  [BO] Best reliability  : 0.924851
  [BO] Best parameters   : {'pop_size': 112, 'num_gens': 287, ...}

Use as a library

Both files can be imported directly:

from SRAP import reliability_active, reliability_kmixed, hybrid_ga_sa, bayesian_optimisation

# Compute reliability for a specific configuration
R = reliability_kmixed(N=5, a=2, b=3, lam=0.005, t=100, rho=0.95)
print(f"K-Mixed reliability: {R:.4f}")

# Run the optimiser
constraints = {"c": 20, "C": 200, "w": 5, "W": 100,
               "v": 5, "V": 100, "p": 2, "P": 50}
best = hybrid_ga_sa(N=5, lam=0.005, t=100, rho=0.95, constraints=constraints,
                    pop_size=50, num_gens=100, cross_prob=0.65,
                    mut_prob=0.10, sa_freq=10)
print(f"Best solution: m={best[0]}, s={best[1]}, a={best[2]}")

Configuration

Edit the three configuration blocks near the bottom of each file.

SYSTEM_CONFIG

Parameter Description Default
N Number of subsystems in series 5
lam Component failure rate λ [failures/time unit] 0.005
t Mission time [time units] 100
rho Switching success probability ρ 0.95

CONSTRAINTS

Key Description
c, C Cost per component; maximum total cost
w, W Weight per component; maximum total weight
v, V Volume per component; maximum total volume
p, P Power per active component; maximum total power

Omit any key pair to disable that constraint.

GA_PARAMS (used when USE_BO = False)

Parameter Description Default
pop_size Population size 50
num_gens Number of generations 100
cross_prob Crossover probability 0.65
mut_prob Mutation probability 0.10
sa_freq Generations between SA applications 10

BO_CONFIG

Parameter Description Default
USE_BO Enable Bayesian Optimisation tuning False
param_bounds Search ranges for the four tunable GA parameters see above
n_init Initial Latin Hypercube samples 10
n_iter BO iterations after initialisation 50
replicates GA-SA runs averaged per BO evaluation 3
verbose Print BO progress to console True

Output

Both scripts print a structured summary to the console. S-RAP reports the single best [m, s, a] triplet; Dedicated-RAP reports the per-subsystem allocation and individual subsystem reliabilities.

No output files are written by default. To save results, redirect stdout:

python SRAP.py > results_SRAP.txt
python DedicatedRAP.py > results_DedicatedRAP.txt

Citing This Work

If you use this code in your research, please cite:

@article{Khayami2025SRAP,
  author  = {Khayami, {et al.}},
  title   = {S-RAP: A Shared Redundancy Allocation Framework for
             Multi-Strategy Reliability Optimisation},
  journal = {--},
  year    = {2025},
}

Licence

This project is released under the MIT Licence.

About

Shared Redundancy Allocation Problem with GA-SA-BO optimisation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages