-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add advanced manufacturing optimization framework #1
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
feat: add advanced manufacturing optimization framework #1
Conversation
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| class ScheduleEvaluator: | ||
| """Simulate scheduling execution for a given priority list.""" | ||
|
|
||
| def __init__(self, config: ExperimentalConfig, simulator: StochasticSimulator) -> None: | ||
| self.config = config | ||
| self.simulator = simulator | ||
|
|
||
| def evaluate( | ||
| self, | ||
| df_original: pd.DataFrame, | ||
| prioritized_df: pd.DataFrame, | ||
| scenario: str, | ||
| replication_seed: int, | ||
| ) -> Tuple[pd.DataFrame, Dict[str, float]]: | ||
| rng = np.random.default_rng(self.config.random_seed + replication_seed) | ||
| machine_available_time = defaultdict(float) | ||
| job_records = [] | ||
|
|
||
| for order_index, row in enumerate(prioritized_df.itertuples(index=False)): | ||
| base_proc = float(row.Processing_Time) | ||
| proc_time = self.simulator.sample_processing_time(base_proc, scenario, order_index, rng) | ||
| energy = self.simulator.sample_energy(float(row.Energy_Consumption), scenario, rng) | ||
| machine = row.Machine_ID | ||
| availability = float(row.Machine_Availability) | ||
|
|
||
| arrival_time = float(row.Scheduled_Start_Minutes) | ||
| ready_time = max(arrival_time, machine_available_time[machine]) | ||
| breakdown_delay = self.simulator.machine_breakdown_delay(scenario, rng) | ||
| start_time = ready_time + breakdown_delay | ||
| end_time = start_time + proc_time | ||
|
|
||
| due_date = float(row.Due_Date_Minutes) | ||
| tardiness = max(0.0, end_time - due_date) | ||
| waiting_time = start_time - arrival_time | ||
|
|
||
| success_prob = self.simulator.success_probability(availability) | ||
| status = "Completed" | ||
| if rng.random() > success_prob: | ||
| status = "Failed" | ||
| elif tardiness > 0 and rng.random() < 0.5: | ||
| status = "Delayed" |
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.
Random noise tied to schedule order distorts method comparisons
Each call to ScheduleEvaluator.evaluate seeds a new RNG with only self.config.random_seed + replication_seed and then consumes it in the order of the prioritized schedule. Because the same seed is reused for every method in a replication, the sequence of sampled processing times, breakdown delays and success events is assigned to whichever job happens to appear first, second, etc. in that method’s priority list. This means a job receives different random perturbations purely because it moved in the schedule, so differences between methods mix scheduling quality with unrelated stochastic variation, undermining the accuracy of the reported Friedman/Wilcoxon analyses. Consider generating randomness per job (e.g., keyed by job id) or by sharing the same pre-sampled noise table across methods so each job experiences identical stochastic conditions in every method.
Useful? React with 👍 / 👎.
Summary
Testing
python advanced_manufacturing_optimization.py --methods FCFS SPT --replications 1 --scenarios baseline --max-jobs 30(fails: missing matplotlib dependency in execution environment)https://chatgpt.com/codex/tasks/task_e_690557fcc90083248625ad62c0c232df