Stock Market Inspired Optimization
Version 1.0.1 (2,58 KB) von
Adisorn Owatsiriwong
A new swarm intelligence (SI) algorithm through the analogy of investors and retailers in the stock market is proposed.
In this post, I introduce a new way of thinking about Swarm Intelligence (SI) algorithms through the analogy of investors and retailers in the stock market. Unlike traditional metaphors that focus on birds, bees, or wolves, this approach models the solutions themselves as “stocks” while investors and retailers represent different search behaviors. Investors are the leaders who identify promising opportunities first, pulling the search toward profitable regions. Retailers follow these leads but apply their own tweaks and randomness, occasionally finding even better opportunities. If the “stocks” turn out to be unprofitable, the system refreshes them—just as in real markets where underperforming assets are abandoned.
This simple analogy translates directly into a population-based metaheuristic:
- Exploration comes from retailers experimenting with random tweaks and regenerated stocks.
- Exploitation arises from investors steadily pulling solutions toward the best opportunities.
- Adaptivity is introduced through simulated annealing–style acceptance, gradually reducing risk over time.
By combining these ingredients, the Investor–Retailer SI provides a flexible and intuitive search mechanism for engineering optimization and other complex design tasks.
An example of optimization of a cantilever beam is given to play with the algorithm.
Pseudo code
Input: Objective function f(x), search space bounds [lb, ub]
Parameters: population size N, max iterations MaxIt leader pull β, tweak scale σ0, initial acceptance T0 refresh rate (fraction of solutions to regenerate), stall limit
1. Initialize population of "stocks" Xi randomly within [lb, ub], i=1…N 2. Evaluate fitness Fi = f(Xi) for all i
3. Identify the best stock X* with fitness F*
4. For t = 1 to MaxIt:
T = T0 * (1 - t/MaxIt) // cooling schedule
σ = σ0 * (1 - t/MaxIt) // shrinking tweak scale
For each stock i = 1…N:
a) Investor move (leader pull): Xnew = Xi + β * (X* - Xi)
b) Retailer tweak (local/random search):
With probability 0.5:
Xnew = Xnew + σ * Normal(0,1) Else: Select random stock k ≠ i φ = random(-1,1) Xnew = Xnew + φ * (Xi - Xk)
c) Bound correction: clamp Xnew to [lb, ub]
d) Evaluate fnew = f(Xnew)
e) Acceptance rule: If fnew ≤ Fi Accept: Xi = Xnew, Fi = fnew Else if rand < exp(-(fnew - Fi)/T) Accept with probability (simulated annealing style) Else Reject: keep Xi End For
f) Update global best (X*, F*)
g) If no improvement for "stall limit": Refresh a fraction of worst solutions randomly (scout step)
h) Record best fitness F* for history End For Output: Best solution X*, best fitness F*
Zitieren als
Adisorn Owatsiriwong (2025). Stock Market Inspired Optimization (https://de.mathworks.com/matlabcentral/fileexchange/182147-stock-market-inspired-optimization), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Erstellt mit
R2024b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
| Version | Veröffentlicht | Versionshinweise | |
|---|---|---|---|
| 1.0.1 | Add pseudo code |
||
| 1.0.0 |
