Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Optimization Algorithms by Prof. R.V. Rao

![Language](https://img.shields.io/badge/language-JavaScript-F7DF1E)


This package implements several powerful optimization algorithms developed by Prof. Ravipudi Venkata Rao:
- **BMR (Best-Mean-Random) Algorithm**
- **BWR (Best-Worst-Random) Algorithm**
Expand Down
52 changes: 52 additions & 0 deletions docs/algorithms/bmwr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# BMWR — Best-Mean-Worst-Random

Parameter-free, metaphor-free optimization algorithm introduced by R. Venkata Rao (2025) in *Optimization of Different Metal Casting Processes Using Three Simple and Efficient Advanced Algorithms* (MDPI Metals 15/9/1057). Combines BMR's best-vs-mean attraction with BWR's worst-vs-random repulsion.

## Update rule

For each candidate `V_{j,k}` (variable j, candidate k) at iteration i, with random factors `r1..r5 ∼ U(0,1)` and `T ∼ {1, 2}`:

If `r4 > 0.5`:

```
V'_{j,k} = V_{j,k}
+ r1 · (V_{j,best} − T · V_{j,mean})
+ r2 · (V_{j,best} − V_{j,random})
− r5 · (V_{j,worst} − V_{j,random})
```

Otherwise (random reset, exploration):

```
V'_{j,k} = U_j − (U_j − L_j) · r3
```

Greedy acceptance: keep `V'` iff `f(V') < f(V)`.

## Python usage

```python
from rao_algorithms import BMWR_algorithm
import numpy as np

bounds = np.array([[-10, 10], [-10, 10]])
result = BMWR_algorithm(
bounds=bounds,
num_iterations=500,
population_size=50,
num_variables=2,
objective_func=lambda x: float(np.sum(x**2)),
track_history=True,
)
best_x, history, history_dict = result
```

## When to use

- Problems where BMR alone over-exploits (only attraction terms).
- Problems where BWR alone under-exploits (no mean information).
- BMWR balances both — recommended default within the BMR/BWR/BMWR family.

## Reference

Rao, R. V. (2025). *Optimization of Different Metal Casting Processes Using Three Simple and Efficient Advanced Algorithms*. Metals, 15(9), 1057. https://www.mdpi.com/2075-4701/15/9/1057
41 changes: 41 additions & 0 deletions docs/algorithms/mo_bmwr_family.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# MO-BMR / MO-BWR / MO-BMWR

Multi-objective extensions of the BMR/BWR/BMWR family (Rao 2025/2026). Wraps the per-variable single-objective base updates with five MOO features:

1. **Elite seeding** — best solutions of rank 0 used as the "best" reference; rank-N solutions as "worst".
2. **Fast non-dominated sorting** (Deb et al. 2002) — O(M·c²) ranking.
3. **Constraint repairing** — bound-clipping first, then quadratic penalty fallback for inequality/equality violations.
4. **Local exploration** — per iteration, ~10% of the population is replaced by Gaussian-perturbed elites (σ = 5% of bound range).
5. **Edge boosting** — with probability `edge_boost_prob` per iteration, perturb the extreme solutions of each objective to extend the Pareto front.

Total complexity per iteration: `O(M·c² + c·(m + tf + tp))` where `M` = number of objectives, `c` = population size, `m` = variables, `tf` = objective evaluation cost, `tp` = penalty evaluation cost.

## Python usage

```python
from rao_algorithms import samyama_optimization as rust_opt
import numpy as np

def objs(x):
return np.array([x[0], (1 + 9*np.sum(x[1:])/(len(x)-1)) * (1 - np.sqrt(x[0] / (1 + 9*np.sum(x[1:])/(len(x)-1))))])

lower = np.zeros(30)
upper = np.ones(30)
result = rust_opt.solve_mo_bmwr(objs, lower, upper, 50, 100) # population, iterations
for ind in result.pareto_front:
print(ind.variables, ind.fitness, ind.rank, ind.crowding_distance)
```

`solve_mo_bmr`, `solve_mo_bwr`, `solve_mo_bmwr` all share the same signature.

## Variant choice

- **MO-BMR** — favors exploitation of the best solutions; smoother fronts on convex problems.
- **MO-BWR** — favors exploration via worst-repulsion; better on disconnected/discontinuous fronts (ZDT3-style).
- **MO-BMWR** — balanced, recommended default. Mirrors the JMMP 2025 paper's recommended choice for manufacturing problems.

## References

- Rao, R. V. (2025). *Optimization of Different Metal Casting Processes...*. Metals 15(9), 1057. https://www.mdpi.com/2075-4701/15/9/1057
- Rao, R. V. (2026). MDPI Energies 19(1), 34.
- Rao, R. V. (2025). *Single, Multi-, and Many-Objective Optimization of Manufacturing Processes Using Two Novel and Efficient Algorithms with Integrated Decision-Making*. JMMP 9(8), 249. https://www.mdpi.com/2504-4494/9/8/249
15 changes: 15 additions & 0 deletions docs/references/rao_publications.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,18 @@ His algorithms are particularly notable for being:
Prof. Rao's research has received significant attention in the scientific community. His papers on optimization algorithms have been cited thousands of times, demonstrating the impact and usefulness of his contributions to the field.

For the most up-to-date list of publications and citation metrics, please refer to [Prof. Rao's Google Scholar profile](https://scholar.google.com/citations?user=4NoqGCEAAAAJ).

## 2025–2026 additions (MO family)

- Rao, R. V. (2025). *Optimization of Different Metal Casting Processes Using Three Simple and Efficient Advanced Algorithms*. **MDPI Metals 15(9), 1057.** Introduces **BMWR** (best–mean–worst–random) and the multi-objective **MO-BMR / MO-BWR / MO-BMWR** with case studies on lost-foam, die-, low-pressure, and squeeze-casting. https://www.mdpi.com/2075-4701/15/9/1057
- Rao, R. V. (2026). **MDPI Energies 19(1), 34.** Multi-objective MO-* application to energy systems. https://www.mdpi.com/1996-1073/19/1/34
- Rao, R. V. (2025). *Single, Multi-, and Many-Objective Optimization of Manufacturing Processes Using Two Novel and Efficient Algorithms with Integrated Decision-Making*. **MDPI JMMP 9(8), 249.** Contains the MO-* "Algorithm 2" pseudocode (elite seeding + FNDS + constraint repair + local exploration + edge boosting). https://www.mdpi.com/2504-4494/9/8/249
- Sample Python codes (BWR, BMR, BMWR, MO-BWR, MO-BMR, MO-BMWR): https://sites.google.com/d/1qNsqo0kHkQD9Bhi4-prZlxo5K7QuntgI/p/1OeRlPp5dhwkqfeNvLP4CtHqFhwk74DqB/edit

## Related self-adaptive / hybrid variants implemented

- **SAMP-Jaya** — Rao, R. V., & Saroj, A. (2017). *A self-adaptive multi-population based Jaya algorithm for engineering optimization.* Swarm and Evolutionary Computation 37, 1–26.
- **SAPHR** — *A Self-Adaptive Population-Based Hybrid Optimisation Technique for Multireservoir Benchmark Problems* (2025). Water Resources Management. doi:10.1007/s11269-025-04186-7
- **EHR-Jaya** — Wang, Z. et al. (2022). *Self-adaptive classification learning hybrid JAYA and Rao-1 algorithm for large-scale numerical and engineering problems.* Engineering Applications of AI.
- **QO-Rao** — Rao, R. V., & Saroj, A. (2020). *Quasi-oppositional-based Rao algorithms for multi-objective design optimization of selected heat sinks.* JCDE 7(6), 830.
- **MO-Rao+DE** — *An efficient multi-objective algorithm based on Rao and differential evolution for solving bi-objective truss optimization* (2025). Engineering Optimization. doi:10.1080/0305215X.2025.2463976
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ build-backend = "maturin"

[project]
name = "rao-algorithms"
version = "0.9.3"
description = "High-performance optimization algorithms by Prof. R.V. Rao (Jaya, Rao, TLBO) backed by Rust"
version = "0.10.0"
description = "High-performance metaphor-free optimization algorithms by Prof. R.V. Rao (Jaya, Rao-1/2/3, TLBO, BMR, BWR, BMWR, QOJaya, ITLBO, GOTLBO, SAMP-Jaya, EHR-Jaya, QO-Rao, SAPHR, MO-BMR/BWR/BMWR, MO-Rao+DE, NSGA-II) backed by Rust"
authors = [
{ name = "Sandeep Kunkunuru", email = "sandeep.kunkunuru@gmail.com" }
]
Expand Down
10 changes: 9 additions & 1 deletion rao_algorithms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
ITLBO_algorithm,
MultiObjective_TLBO_algorithm,
PSO_algorithm,
DE_algorithm
DE_algorithm,
BMWR_algorithm,
SAMP_Jaya_algorithm,
EHRJaya_algorithm,
QO_Rao_algorithm
)
from .optimization import run_optimization, save_convergence_curve, save_convergence_history
from .objective_functions import (
Expand Down Expand Up @@ -45,6 +49,10 @@
'MultiObjective_TLBO_algorithm',
'PSO_algorithm',
'DE_algorithm',
'BMWR_algorithm',
'SAMP_Jaya_algorithm',
'EHRJaya_algorithm',
'QO_Rao_algorithm',
'run_optimization',
'save_convergence_curve',
'save_convergence_history',
Expand Down
26 changes: 26 additions & 0 deletions rao_algorithms/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,29 @@ def DE_algorithm(bounds, num_iterations, population_size, num_variables, objecti
if RUST_AVAILABLE:
return _run_rust_solver(rust_opt.solve_de, bounds, num_iterations, population_size, objective_func, constraints, track_history=track_history)
raise NotImplementedError("Rust backend required")

# --- New algorithms (Rao 2025 + self-adaptive variants) ---

def BMWR_algorithm(bounds, num_iterations, population_size, num_variables, objective_func, constraints=None, track_history=True):
"""Best-Mean-Worst-Random (Rao 2025, MDPI Metals 15/9/1057). Combines BMR + BWR terms."""
if RUST_AVAILABLE:
return _run_rust_solver(rust_opt.solve_bmwr, bounds, num_iterations, population_size, objective_func, constraints, track_history=track_history)
raise NotImplementedError("Rust backend required")

def SAMP_Jaya_algorithm(bounds, num_iterations, population_size, num_variables, objective_func, constraints=None, track_history=True):
"""Self-Adaptive Multi-Population Jaya (Rao & Saroj 2017)."""
if RUST_AVAILABLE:
return _run_rust_solver(rust_opt.solve_samp_jaya, bounds, num_iterations, population_size, objective_func, constraints, track_history=track_history)
raise NotImplementedError("Rust backend required")

def EHRJaya_algorithm(bounds, num_iterations, population_size, num_variables, objective_func, constraints=None, track_history=True):
"""Hybrid Jaya + Rao-1 with classification-based update (Wang et al. 2022, EAAI)."""
if RUST_AVAILABLE:
return _run_rust_solver(rust_opt.solve_ehrjaya, bounds, num_iterations, population_size, objective_func, constraints, track_history=track_history)
raise NotImplementedError("Rust backend required")

def QO_Rao_algorithm(bounds, num_iterations, population_size, num_variables, objective_func, constraints=None, variant="Rao1", track_history=True):
"""Quasi-Oppositional Rao (Rao & Saroj 2020, JCDE). variant ∈ {Rao1, Rao2, Rao3}."""
if RUST_AVAILABLE:
return _run_rust_solver(rust_opt.solve_qo_rao, bounds, num_iterations, population_size, objective_func, constraints, variant=variant, track_history=track_history)
raise NotImplementedError("Rust backend required")
4 changes: 3 additions & 1 deletion rust_bindings/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "samyama-optimization-python"
version = "0.9.3"
version = "0.10.0"
edition = "2021"
authors = ["Sandeep Kunkunuru <sandeep@samyama.ai>"]
description = "Python bindings for Samyama Optimization Engine"
Expand All @@ -13,5 +13,7 @@ crate-type = ["cdylib"]
[dependencies]
pyo3 = { version = "0.23", features = ["extension-module"] }
samyama-optimization = { git = "https://github.com/samyama-ai/samyama-graph.git", branch = "main" }
# For local dev against unpublished crate changes, swap to:
# samyama-optimization = { path = "../../samyama-graph/crates/samyama-optimization" }
ndarray = "0.15"
numpy = "0.23"
Loading
Loading