-
Notifications
You must be signed in to change notification settings - Fork 84
Add Cognitive Manufacturing Environment #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add Cognitive Manufacturing Environment #109
Conversation
A comprehensive manufacturing control environment with 30 tools for AI agents. Features: - Multi-machine production line simulation - Database persistence (PostgreSQL/SQLite support) - ML-powered analytics (predictive maintenance, anomaly detection, quality prediction) - Reinforcement learning optimization - Quality and inventory management - Energy monitoring and optimization - Scenario simulation and schedule optimization Architecture: - Physics-based simulator with temperature, vibration, and wear dynamics - Multi-objective reward system - 30 specialized tools across manufacturing operations - Complete OpenEnv compliance Author: Mohammad Mowas Dependencies: sqlalchemy, sentence-transformers, pandas, scikit-learn
|
Hi @MohammadMowas! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a comprehensive Cognitive Manufacturing Environment for the OpenEnv framework. The environment simulates a production facility with realistic physics-based machine dynamics, providing 30 specialized tools for AI agents to manage manufacturing operations across quality control, inventory management, energy optimization, and predictive analytics.
Key Changes:
- Complete manufacturing simulation with single-machine and 4-machine production line modes
- 30 specialized tools organized in 5 phases (basic control, production line, data management, ML analytics, advanced management)
- Multi-objective reward system balancing safety, throughput, quality, cost, and sustainability
- Optional database persistence (PostgreSQL/SQLite), ML-powered analytics, and RL optimization
Reviewed Changes
Copilot reviewed 48 out of 48 changed files in this pull request and generated 24 comments.
Show a summary per file
| File | Description |
|---|---|
src/envs/cognitive_manufacturing/tools/*.py |
30 tool implementations for manufacturing control, data management, ML analytics, and advanced operations |
src/envs/cognitive_manufacturing/server/environment.py |
Core environment implementation with tool orchestration and reward computation |
src/envs/cognitive_manufacturing/server/simulator.py |
Physics-based machine simulator with temperature, vibration, and wear dynamics |
src/envs/cognitive_manufacturing/server/production_line.py |
4-machine production line with material flow and buffers |
src/envs/cognitive_manufacturing/server/database.py |
Database manager for persistent storage with SQLAlchemy |
src/envs/cognitive_manufacturing/server/ml_models.py |
ML service with predictive maintenance, anomaly detection, quality prediction, RL, and demand forecasting |
src/envs/cognitive_manufacturing/server/rewards.py |
Multi-objective reward calculation system |
src/envs/cognitive_manufacturing/models.py |
Data models for actions, observations, and state |
src/envs/cognitive_manufacturing/client.py |
HTTP client for remote environment access |
src/envs/cognitive_manufacturing/README.md |
Comprehensive documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Returns: | ||
| List of sensor reading dicts | ||
| """ | ||
| session = self.Session() |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect session creation method. The attribute is SessionLocal (defined in __init__ at line 163), not Session. This will cause an AttributeError when calling get_sensor_readings().
| session = self.Session() | |
| session = self.SessionLocal() |
| Returns: | ||
| List of production unit dicts | ||
| """ | ||
| session = self.Session() |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect session creation method. The attribute is SessionLocal (defined in __init__ at line 163), not Session. This will cause an AttributeError when calling get_production_units().
| # Throughput rate (units/hour) - based on M4 output | ||
| if dt > 0: | ||
| m4_output = self.machines["M4"].units_produced | ||
| self.metrics.throughput_rate = m4_output / dt if dt > 0 else 0.0 |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test is always true, because of this condition.
| self.metrics.throughput_rate = m4_output / dt if dt > 0 else 0.0 | |
| self.metrics.throughput_rate = m4_output / dt |
| ) | ||
|
|
||
| forecast_horizon = parameters.get("forecast_horizon", 168) | ||
| confidence_level = parameters.get("confidence_level", 0.95) |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable confidence_level is not used.
| if self.anomaly_detector is not None: | ||
| # Use trained model | ||
| predictions = self.anomaly_detector.predict(X) | ||
| scores = self.anomaly_detector.score_samples(X) |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable scores is not used.
| scores = self.anomaly_detector.score_samples(X) |
| try: | ||
| forecast = env.ml_service.forecast_demand(horizon=time_horizon) | ||
| forecast_demand = [f["demand"] for f in forecast] | ||
| except: |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except block directly handles BaseException.
| event_type="material_order", | ||
| data=order | ||
| ) | ||
| except Exception: |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| "effects": effects, | ||
| } | ||
| ) | ||
| except Exception: |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| event_type="inventory_update", | ||
| data=transaction | ||
| ) | ||
| except Exception: |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
| "affected_machines": affected_machines, | ||
| } | ||
| ) | ||
| except Exception: |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'except' clause does nothing but pass and there is no explanatory comment.
A comprehensive manufacturing control environment with 30 tools for AI agents.
Features:
Architecture:
Author: Mohammad Mowas
Dependencies: sqlalchemy, sentence-transformers, pandas, scikit-learn