自适应制造优化框架

Adaptive MCP-RMS是一个基于大型语言模型的动态可重构制造系统优化框架,提供完整的模拟、自学习原语和实验分析功能。

  • by BEZOUI
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 BEZOUI/MCP_RMS

使用说明

自适应MCP-RMS:动态可重构制造系统的自适应模型上下文协议

使用大型语言模型完成自适应MCP-RMS框架的智能制造优化实施。

特性

  • 完成RMS模拟:可重构制造系统的离散事件仿真
  • 自学习原语:基于经验学习的情景记忆操作
  • LLM集成:Claude API集成用于智能推理
  • 综合基线:FIFO、SPT、EDD、MWKR、GA、SA实现
  • 完整的实验管道:基准生成、执行和分析
  • 丰富的可视化:性能概况、可扩展性分析、统计比较

安装

# Clone repository
git clone <repository-url>
cd adaptive_mcp_rms

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Set API key
export ANTHROPIC_API_KEY="your-api-key-here"

快速开始

快速测试

python main.py --quick-test

完整的实验管道

# Generate benchmarks, run experiments, and analyze
python main.py --mode full --trials 10

# Or use the shell script
chmod +x run_experiments.sh
./run_experiments.sh full

各个阶段

# Generate benchmark instances
python main.py --mode generate --suite benchmark_suite

# Run experiments
python main.py --mode run --suite benchmark_suite --trials 10

# Analyze results
python main.py --mode analyze --suite benchmark_suite

定制实验

# Run specific methods
python main.py --mode run --methods fifo spt adaptive_mcp_rms --trials 5

# Small-scale testing
./run_experiments.sh small

项目结构

adaptive_mcp_rms/
├── src/
│   ├── environment.py          # RMS simulation
│   ├── primitives.py           # MCP primitives
│   ├── memory.py               # Self-learning memory
│   ├── mcp_server.py           # MCP server
│   ├── llm_client.py           # LLM client
│   ├── baselines.py            # Comparison methods
│   └── utils.py                # Utilities
├── experiments/
│   ├── benchmark_generator.py  # Instance generation
│   ├── experiment_runner.py    # Experiment execution
│   └── analysis.py             # Results analysis
├── data/
│   ├── instances/              # Benchmark instances
│   ├── results/                # Experimental results
│   └── memory/                 # Memory storage
├── config/
│   └── config.yaml             # Configuration
├── main.py                     # Main entry point
├── run_experiments.sh          # Bash script
├── requirements.txt            # Dependencies
└── README.md                   # This file

配置

编辑 config/config.yaml 自定义:

  • 环境参数(机器、作业)
  • LLM设置(型号、温度)
  • 算法参数(GA、SA)
  • 实验设置(试验、方法)

实施的方法

  1. 自适应MCP-RMS:我们使用自学习原语的新颖方法
  2. 先进先出:先进先出
  3. SPT:最短的处理时间
  4. 预计交货日期:最早到期日
  5. MWKR:剩余大部分工作
  6. 遗传算法:基于人口的元启发式
  7. 模拟退火:基于温度的本地搜索

结果与分析

结果保存到 data/results/:

  • summary_table.csv:综合比较
  • statistical_analysis.csv:统计测试
  • figures/:所有生成的图

绘图包括:

  • Makespan比较
  • 性能配置文件
  • 可扩展性分析
  • 计算时间
  • 改进热图

示例用法

from src.environment import RMSEnvironment
from src.memory import MemorySystem
from src.llm_client import LLMClient
from src.mcp_server import MCPServer

# Create environment
env = RMSEnvironment(num_machines=10, seed=42)
env.generate_jobs(num_jobs=30)

# Initialize components
memory = MemorySystem()
llm = LLMClient(api_key="your-key")
server = MCPServer(env, memory, llm)

# Solve
result = server.solve(max_iterations=50)
print(f"Makespan: {result['final_metrics']['makespan']:.2f}")

引用

如果您使用此代码,请引用:

@article{bezoui2024adaptive,
  title={Adaptive Model Context Protocol for Dynamic Reconfigurable Manufacturing Systems with Self-Learning Primitives},
  author={Bezoui, Madani and Bounceur, Ahcene},
  journal={IEEE Conference on ...},
  year={2024}
}

许可证

MIT许可证

联系

如有疑问或问题,请联系:mbezoui@cesi.fr