Add Anarchic Society Optimization (ASO) algorithm#762
Conversation
Port ASO from NiaPy 1.x to 2.x API: - Add init method with proper parameter initialization - Fix in-place mutation bug in MP_C, MP_S, MP_P strategies - Fix euclidean distance used on scalar fitness values in EI and II indices - Rename methods to snake_case per new API conventions - Add elitism, sequential and crossover combination strategies - Add tests for all three strategies
|
@marryzhuuu, please review this PR - unit tests are failing. |
scipy is not a dependency of NiaPy, which caused ModuleNotFoundError on CI. Replaced scipy.spatial.distance.euclidean with a small numpy-based implementation.
- run_iteration now matches base Algorithm.run_iteration signature (5 explicit params + **params), unpacking ASO-specific state from params dict - init now forwards **kwargs to set_parameters so extra keyword arguments are not silently dropped
set_parameters and init now correctly forward *args before keyword arguments when calling super(), matching the base Algorithm class signature (population_size, *args, **kwargs).
|
Thanks, @marryzhuuu! PR is now ready. However, can you please confirm that the results provided by the Niapy implementation are consistent with the original publications? |
|
Hi @firefly-cpp, thanks for the review! I checked the formulas against the original paper (Ahmadi-Javid, 2011, "Anarchic Society Optimization: A human-inspired method", IEEE CEC 2011). The Fickleness Index (FI) formula matches the paper exactly (Eq. 1-2 in the general framework): For the External Irregularity Index (EI) and Internal Irregularity Index (II), it's worth noting that the original paper presents ASO as a general framework rather than a single fixed algorithm. The paper explicitly offers two alternative formulations for EI (comparison with G-best, Eq. 3, or a society-wide dispersion measure, Eq. 4), and states that II "can be used in the scenarios presented for EI" without giving one fixed closed-form formula. The implementation here uses a neighbor-based variant consistent with the framework's intent (exponential decay based on fitness difference), which is one of the valid concretizations the paper allows for, since the paper leaves the exact choice of comparison basis and dispersion measure to the implementer for each specific problem. This was verified through:
|
Port ASO from NiaPy 1.x to 2.x API:
Summary
Port ASO algorithm from NiaPy 1.x to 2.x API.
Bugs fixed:
Other changes: