  Resource utilization and production process optimization are crucial for
companies in today's competitive industrial landscape. Addressing the
complexities of job shop scheduling problems (JSSP) is essential to improving
productivity, reducing costs, and ensuring timely delivery. We propose PetriRL,
a novel framework integrating Petri nets and deep reinforcement learning (DRL)
for JSSP optimization. PetriRL capitalizes on the inherent strengths of Petri
nets in modelling discrete event systems while leveraging the advantages of a
graph structure. The Petri net governs automated components of the process,
ensuring adherence to JSSP constraints. This allows for synergistic
collaboration with optimization algorithms such as DRL, particularly in
critical decision-making. Unlike traditional methods, PetriRL eliminates the
need to preprocess JSSP instances into disjunctive graphs and enhances the
explainability of process status through its graphical structure based on
places and transitions. Additionally, the inherent graph structure of Petri
nets enables the dynamic additions of job operations during the inference phase
without requiring agent retraining, thus enhancing flexibility. Experimental
results demonstrate PetriRL's robust generalization across various instance
sizes and its competitive performance on public test benchmarks and randomly
generated instances. Results are compared to a wide range of optimization
solutions such as heuristics, metaheuristics, and learning-based algorithms.
Finally, the added values of the framework's key elements, such as event-based
control and action masking, are studied in the ablation study.
