社会熵扩散优化算法(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
Metadata
Release files for sedo 1.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sedo-1.2.5.tar.gz | 13.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sedo-1.2.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.0 kB
Release files / sedo-1.2.5.tar.gz
| Download URL | sedo-1.2.5.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
56995b9735300f137042256a097f3f3d680fbe1bc1ac32652460948e3f708a94
|
|
BLAKE2b-256 checksum How to use checksums |
db4ff5719dd05168286ca17bf0fe891d7af1197db367c819b500f8db90e91614
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.17
|
Release files / sedo-1.2.5-py3-none-any.whl
| Download URL | sedo-1.2.5-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f4efca1b3b3f3c14467fe319f441d56d12ae2176eaaa2599d35630bdf3415f0
|
|
BLAKE2b-256 checksum How to use checksums |
974c4e5f710f604424066a15ab60109a28074f03683be08692716427725ec76d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.17
|