Social Entropy Diffusion Optimization Algorithm (SEDO)
Project description
社会熵扩散优化算法(SEDO) / Social Entropy Diffusion Optimizer (SEDO)
受社会学与量子物理启发的创新型全局优化算法
算法特点
- 🌐 文化空间信息传播模型
- ⚛️ 量子化粒子表示
- 🔥 基于熵流的探索-开发平衡
- 🎯 支持单目标/多目标优化
- ⚡ 并行计算加速
安装方法
pip install sedo
快速开始
不要使用 lambda 函数作为目标函数!
from sedo import SEDOptimizer
# 定义目标函数
def rastrigin(x):
return 10*len(x) + sum(x**2 - 10*np.cos(2*np.pi*x))
# 初始化优化器
optimizer = SEDOptimizer(
objective_func=rastrigin,
problem_dim=20,
n_particles=50
)
# 执行优化
optimizer.optimize(max_iter=200)
# 获取结果
best_solution = optimizer.get_best_solution()
print(f"最优解: {best_solution}")
对比测试结果
| 函数 | 算法 | 平均适应度 | 标准差 |
|---|---|---|---|
| Sphere | SEDO | 0.105087 | 0.057231 |
| Sphere | PSO | 0.097989 | 0.080966 |
| Rosenbrock | SEDO | -25124.000000 | 531.337934 |
| Rosenbrock | PSO | -24136.000000 | 1778.088862 |
| Ackley | SEDO | 1.739894 | 0.821921 |
| Ackley | PSO | 2.284575 | 0.898855 |
高级特性
文化传播可视化
from sedo.utils import plot_cultural_diffusion
plot_cultural_diffusion(optimizer.particles)
参数敏感性分析
from sedo.utils import parameter_sensitivity
results = parameter_sensitivity(
objective_func,
param_ranges={
'barrier_height': (0.1, 1.0),
'entropy_threshold': (0.3, 0.9)
}
)
应用案例
- 神经网络超参数优化
optimizer = SEDOptimizer(
objective_func=neural_net_train,
problem_dim=8,
bounds=[(32,512), (0.0001,0.1), ...] # 各参数范围
)
- 投资组合优化
optimizer = SEDOptimizer(
objective_func=portfolio_eval,
problem_dim=10,
multi_objective=True # 同时优化收益和风险
)
参与贡献
欢迎提交Issue和Pull Request!
- Fork项目
- 创建特性分支 (
git checkout -b feature/your-feature) - 提交更改 (
git commit -am 'Add some feature') - 推送分支 (
git push origin feature/your-feature) - 新建Pull Request
许可证
MIT License
Social Entropy Diffusion Optimizer (SEDO)
[English] | [中文] | [Development Documentation]
An innovative global optimization algorithm inspired by sociology and quantum physics
Key Features
- 🌐 Cultural space information diffusion model
- ⚛️ Quantum particle representation
- 🔥 Exploration-exploitation balance based on entropy flow
- 🎯 Single/Multi-objective optimization support
- ⚡ Parallel computing acceleration
Installation
pip install sedo
Quick Start
Do Not USE lambda function as objective function!
from sedo import SEDOptimizer
# Define objective function
def rastrigin(x):
return 10*len(x) + sum(x**2 - 10*np.cos(2*np.pi*x))
# Initialize optimizer
optimizer = SEDOptimizer(
objective_func=rastrigin,
problem_dim=20,
n_particles=50
)
# Run optimization
optimizer.optimize(max_iter=200)
# Get results
best_solution = optimizer.get_best_solution()
print(f"Optimal solution: {best_solution}")
Comparative Test Results
| Function | Algorithm | Avg Fitness | Std Dev |
|---|---|---|---|
| Sphere | SEDO | 0.105087 | 0.057231 |
| Sphere | PSO | 0.097989 | 0.080966 |
| Rosenbrock | SEDO | -25124.000000 | 531.337934 |
| Rosenbrock | PSO | -24136.000000 | 1778.088862 |
| Ackley | SEDO | 1.739894 | 0.821921 |
| Ackley | PSO | 2.284575 | 0.898855 |
Advanced Features
Cultural Diffusion Visualization
from sedo.utils import plot_cultural_diffusion
plot_cultural_diffusion(optimizer.particles)
Parameter Sensitivity Analysis
from sedo.utils import parameter_sensitivity
results = parameter_sensitivity(
objective_func,
param_ranges={
'barrier_height': (0.1, 1.0),
'entropy_threshold': (0.3, 0.9)
}
)
Application Examples
- Neural Network Hyperparameter Tuning
optimizer = SEDOptimizer(
objective_func=neural_net_train,
problem_dim=8,
bounds=[(32,512), (0.0001,0.1), ...] # Parameter ranges
)
- Portfolio Optimization
optimizer = SEDOptimizer(
objective_func=portfolio_eval,
problem_dim=10,
multi_objective=True # Optimize return and risk simultaneously
)
How to Contribute
We welcome issues and pull requests!
- Fork the project
- Create your feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin feature/your-feature) - Create a new Pull Request
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sedo-1.2.5.tar.gz.
File metadata
- Download URL: sedo-1.2.5.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56995b9735300f137042256a097f3f3d680fbe1bc1ac32652460948e3f708a94
|
|
| MD5 |
597af8007c2ca940a87107926d44d7a1
|
|
| BLAKE2b-256 |
db4ff5719dd05168286ca17bf0fe891d7af1197db367c819b500f8db90e91614
|
File details
Details for the file sedo-1.2.5-py3-none-any.whl.
File metadata
- Download URL: sedo-1.2.5-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f4efca1b3b3f3c14467fe319f441d56d12ae2176eaaa2599d35630bdf3415f0
|
|
| MD5 |
0d2399c0145d26284773a6d0aa9ca4ee
|
|
| BLAKE2b-256 |
974c4e5f710f604424066a15ab60109a28074f03683be08692716427725ec76d
|