**4. Scheduling**

Scheduling is one of the most important management functions and is a fundamental problem in the control of any resource-sharing organisation. Scheduling problems are very complex and many have been proven to be NP hard [8].

Literature on deterministic scheduling classifies the manufacturing scheduling problems according to machine environment structure, processing characteristics and constraints, and objectives. Standard machine environment structures lead to standard scheduling problems, e.g., open shop, flow shop and job shop problems, which are commonly studied. All three

problem classes address a problem of sequencing *n* jobs (tasks) through a set of *r* machines (resources) where every job has to be processed once on every machine and every such job operation requires a specified processing time. The problems differ in restrictions on the job routings.

12 Will-be-set-by-IN-TECH

if they exist. With the function *insertPN()* the resulting subnet is inserted into the main PN structure. If the operation represents the production operation, the function *constructPN*() is called. With it, basic elements (Figures 1–6) are recognised, joined together and placed in the model, again using the function *insertPN()*. All the data about resources and time durations are acquired from the routing table. The described algorithm has been implemented in Matlab. The resulting model is stored in a XML-based format employing Petri Net Markup Language

When the model is built up, it should be verified to see whether it reflects the system operation as defined with data about the production process. Some interesting properties of the model can be checked with the P-invariant analysis. Several P-invariants can be identified in the model. Their number is defined with the sum of all the resources, the number of product routes and the number of all precedences that are present in the model. It can be stated that the weighted sum of tokens that belongs to every P-invariant, which is a consequence of a resource, is equal to the capacity of that resource. The weighted sum of all other invariants is

If possible, the model is later simplified in a way, that eliminated nodes do not influence the

Scheduling is one of the most important management functions and is a fundamental problem in the control of any resource-sharing organisation. Scheduling problems are very complex

Literature on deterministic scheduling classifies the manufacturing scheduling problems according to machine environment structure, processing characteristics and constraints, and objectives. Standard machine environment structures lead to standard scheduling problems, e.g., open shop, flow shop and job shop problems, which are commonly studied. All three

defined with the common number of batches of demanded product.

and many have been proven to be NP hard [8].

**Algorithm 2** Read Routing **function** PN = *routing*(PN, R) datRoute *= readRouting*(R) [E, q, pre] *= readBOM*(R) **for** i=1 **to** *length*(datRoute.Op)

> **end else**

**end end**

(PNML) [6].

**3.6. Verification**

model behaviour.

**4. Scheduling**

**if** datRoute.Resources ==BOM PN1 = *placePN*(R, E, q, pre, [ ]) PN = *insertPN*(PN, PN1) **for** j=1 **to** *length*(E)

PN1 = *routing*(PN1, E(j))

PN = *insertPN*(PN, PN1)

PN = *constructPN*(PN, datRoute(i))

The scheduling problems related to batch plants possess a more complicated structure compared to standard scheduling problems. Batch plants are flexible and alternative resources can be used for conveying recipe operations. There may be different operation processing time assignments based on which equipment is used for processing and there may be specific requests on precedences or allowable intermediate storage time. This significantly complicates the problem of operations scheduling in batch processes. A comprehensive review of the state-of-the art of short-term batch scheduling is presented in [12]. Different types of batch scheduling problems are specified and the types of optimization models are reviewed. The presented models result in a formulation of MILP optimization problem and its solution yields an optimal schedule.

Petri nets can be used to effectively model all standard deterministic scheduling problem classes. Furthermore, the modelling power of Petri nets allows for derivation of models also for problems, which do not have standard problem structure but are closer to real process specifics. This is typical e.g. in batch systems where complex interconnections among process equipment are possible and vary considerably with used batch recipes. Even when the models are not as general as the above mentioned MILP problem representations, Petri nets can be used to model main model components of a two stage batch scheduling approach as defined in [12]. In contrast to monolithic approach the two stage approach assumes that the number of batches of each size is known in advance. The scheduling stage therefore concentrates on the allocation of processing resources to the batches while the plant work load is determined in a previous stage.

## **4.1. Petri net based derivation of optimal or sub-optimal schedules**

To derive a feasible schedule, the obtained Petri net model can be simulated by an appropriate simulation algorithm. During the simulation, the occurring conflicts are resolved 'on the fly', e.g. by randomly choosing a transition in conflict that should fire. Instead, heuristic dispatching rules [5], such as Shortest Processing Time (SPT), can be introduced when solving the conflicting situations. The schedule of process operations can be determined by observing the marking evolution of the net. Depending on the given scheduling problem a convenient rule should be chosen. Usually, different rules are needed to improve different predefined production objectives (makespan, throughput, production rates, and other temporal quantities).

A more extensive exploration of the reachability tree is possible by PN-based heuristic search method proposed by [11]. It is based on generating parts of the Petri net reachability tree, where the branches are weighted by the time of the corresponding operations. The chosen transition firing sequence corresponds to a schedule, and by evaluating a number of sequences a (sub)optimal schedule can be determined. The method is further investigated in [22], where a modified heuristic function is proposed and tested on a number of benchmark tests. The problems of the approach are in the complexity of the reachability tree, which can generally not be completely explored. The search has to be limited to predefined maximum tree size in order to complete in a reasonable time. In addition to that, the heuristic function used within the search has to be chosen such that the search is directed more into the depth of the tree,

#### 14 Will-be-set-by-IN-TECH 16 Petri Nets – Manufacturing and Computer Science Automated Petri-Net Modelling for Batch Production Scheduling <sup>15</sup>

which makes the obtained solution very sensitive to decisions taken at initial levels of the tree and in many cases the quality of the obtained solutions is rather low.

**4.3. Evaluation of schedules**

of the work order is denoted by *Cj*.

timestamp equals the completion time of *oji*: *Cji* = *ρji* + *f*(*tji*).

can be read from *Mf*(*pWO*\_*j*\_*end*): *Cj* = *Mf*(*pWO*\_*j*\_*end*) ⊂ *TSMS*.

schedule [16]. Given a final marking *Mf* the cost can be calculated as

∑*wjCj* =

*max*(*C*1,..., *Cn*). Considering the above notation

as the difference *Cj* − *dj* if positive, and 0 otherwise:

*4.3.2. Total weighted completion time*

net simulation.

*4.3.1. Makespan*

*4.3.3. Tardiness*

needs of the particular production scenario.

As the majority of commonly used scheduling objective functions are based on completion times of the jobs or work orders and due dates, the timed Petri net modelling framework yields a possibility to use the same kind of model with an objective function tailored to the

Automated Petri-Net Modelling for Batch Production Scheduling 17

In the field of deterministic scheduling the objective to be minimised is always a function of the completion times of the jobs or work orders [16]. This fits well in the timed Petri net scheduling framework where the time evolution of the net marking depends on timestamps associated with the tokens. If the schedule is modelled properly, the work order completion times can be read from the timestamps of tokens in the final marking obtained by timed Petri

Let *oji* denote the *i*-th operation of work order *j*. Let *Cji* denote the completion time of the operation *oji*. The completion time of the work order, i.e. the completion of the last operation

During the timed Petri net marking evolution, start of *oji* corresponds to triggering of a related transition *tji*. Associated delay *f*(*tji*) corresponds to duration of *oji*. Following the firing rule, the transition output places are marked with tokens whose time attribute is set to @(*ρji* + *f*(*tji*)) if *ρji* denotes the moment of transition firing, i.e., the release time of *oji*. The generated

Assuming the timed Petri net model of scheduling problem as described above, let *pWO*\_*j*\_*end* ⊂ *P* denote the *j*-th work order end place, i.e. the place that holds a token representing finished status of the work order. Let *Mf* denote the final marking reached after all the operations had been finished. If a token in *pWO*\_*j*\_*end* corresponds to finishing the last operation of work order *WOj* then *Mf*(*pWO*\_*j*\_*end*) = 1@*Cj*. Therefore the completion times

Makespan *Cmax* is equivalent to the completion time of the last finished work order: *Cmax* =

The sum of weighted completion times gives an indication of the inventory costs related to a

If a set of due dates *dj* is adjoined to the work orders, the tardiness of a work order is defined

*n* ∑ *j*=1

*Cmax* = *max*(*Mf*(*pWO*\_*j*\_*end*)), *j* = 1... *n* (1)

*wjMf*(*pWO*\_*j*\_*end*) (2)

Recent reports in scheduling literature show an increased interest in the use of meta-heuristics, such as genetic algorithms (GA), simulated annealing (SA), and tabu search (TS). Meta-heuristics have also been combined with Petri net modelling framework to solve complex scheduling problems [19]. With such an approach, the modelling power of Petri nets can be employed, and relatively good solutions of scheduling problems can be found with a reasonable computational effort, although the convergence to the optimum can not be guaranteed. Compared to reachability tree based search methods, meta-heuristics require less memory.

The problem is that these methods require a sort of neghbouring solution generation strategy. This is easily accomplished for well structured problems, e.g. standard scheduling problems, but may be problematic for general models. In contrast, reachability tree methods as well as priority rule based methods can be used with any type of Petri net model. This motivates the investigation of combined methods, such as the combination of dispatching rules and local search [13].

Dispatching rules, however, do not always enable to reach the optimum even if combined with optimization methods. Using the rule based conflict resolution strategy the solution space is explored in a time driven manner where a transition is fired whenever at least one transition is enabled. In contrast, the reachability tree based methods enable to explore the solution space in an event driven manner. It is possible that a chosen firing sequence imposes one or more intervals of idle time between transitions, i.e. some transitions are enabled but do not fire due to waiting for enablement of another transition in accordance to the chosen sequence. The difference is important in cases when the optimal solution can be missed unless some idle time is included in the schedule as shown in [15]. In other words, the optimal solution generally belongs to the class of semi-active schedules [16]. The schedules generated by an event-driven reachability tree search are semi-active schedules.
