Table of Content

advertisement
Table of Content
1
Introduction
1.1 Background
1.2 Project Aim & Objectives
1.3 Description of the Problem
Page
2
5
6
2
Review of Related Works
2.1 Commercial Product
2.2 Academic Research Works
8
10
2.3
14
3
4
5
6
Conclusion
Conceptual Background
3.1 Introduction of GA
15
System Analysis
4.1 Basic System Requirements
4.2 Assumptions
17
18
4.3
4.4
4.5
4.6
19
27
33
37
Detailed Data Flow & Entity Relationship
Genetic Representation
Fitness Functions Analysis
Other special considerations
System Design
5.1 Structured Charts
5.2 Database Design
40
43
5.3
5.4
44
52
Process Specifications
Interfaces Design
Implementation
6.1
6.2
6.3
6.4
Technical considerations
Programs structure
Special programming issues highlight
GA parameters settings
-0-
55
56
57
59
7
8
9
System Evaluation
7.1 Evaluation Plan
60
7.2
62
Evaluation Result Analysis
Conclusion
8.1 About the Project aims
67
8.2
8.3
68
70
Further Developments
What has been learnt ?
References
71
10 Appendix
10.1 Project Plan
10.2 Database – Full listing
72
73
10.3 Installation Guide
10.4 System Screen Captures
10.5 Test Plan – Functional
79
81
-1-
1.
Introduction
1.1 Background
In these few years, Enterprise Resource Planning (ERP) system is so popular in the
field of manufacturing sector in Hong Kong that almost every manager knows or
hears of its necessity and importance to the development of a manufacturing company.
However, most of those commercial ERP packages use only planning techniques
called Materials Requirements Planning (MRP) and Capacity Requirements Planning
(CRP), which is not sufficient to satisfy the need of the SME of different industries in
Hong Kong …..
By the end of the 1960s, MRP had already been developed in the USA and Europe. As
from it’s naming, MRP mainly concentrates in the planning and scheduling of
materials supply to the manufacturing firm. Planned Purchase Order of materials and
planned Manufacturing (Production) Order of products or components are the output
of the MRP engine, with the input of information about Sales Orders (Required
quantity, delivery date of Finished Goods), Inventory Balances, Bill of Materials
(Materials Usage, purchase lead time, and production lead time). In short, the basic
philosophy of MRP is to ensure that the right number of components (and materials)
is planned at the right time to meet the demand for end items (products).
But MRP totally ignores the capacity constraints of the manufacturing facilities. It
assumes that there is infinite capacity of every work center of the firm. As a
consequence of the demand for finite capacity scheduling, two approaches were
implemented in commercial ERP package. They are :
(1) pre/post-MRP analysis and;
(2) Finite Capacity Planning (FCS)
The pre/post-approach is executed as a part of the MRP methodology, while the FCS
approach is executed as an extension to the shop floor control module.
There are two strategies in the pre/post-approach, namely, rough cut capacity planning
(RCCP) and Capacity Requirements Planning (CRP). RCCP is executed before the
MRP algorithm. It is simply a method of ensuring that bottleneck resources are not
overloaded. RCCP is often used in practice, but is limited in its effectiveness.
-2-
CRP on the other hand is executed after the MRP. The CRP first determines whether
the schedule is feasible. This is done via a variety of approaches including simulation
of machine loading. When a problem is detected CRP provides the user with multiple
solution options. These include forward and backward scheduling, midpoint
scheduling, and overtime planning. CRP is reported to be unpopular in practice. The
main reason for the unpopularity is that considerable user participation is required and
the lack of interaction.
The FCS approach is broadly interpreted. It encompasses approaches that generate a
detailed shop floor schedule from a basic plan. It is the process of creating an
operation schedule for a set of jobs that are to be produced on a limited set of
resources. Each job is comprised of one or more operations (e.g. drilling, turning,
painting, etc.) that must be performed in a specified sequence using the set of
available resources (machines, workers, etc.). A schedule assigns a starting and ending
time to each operation and sequences the operations across the resources so that no
resource conflicts occur (i.e. a given resource is not required to process two operations
at the same time). The operations are also assigned in a way that any sequencing
constraints are respected (e.g. Operation 2 cannot start until Operation 1 is complete).
Traditionally (and currently in a lot of manufacturing firms of Hong Kong), FCS can
be done using a manual planning board (sometimes called a Gantt Chart) in which the
available resources are listed down the left side and operations are assigned to
resource rows and spaced horizontally within each row to represent the passage of
time. Each operation is represented by a horizontal bar where the length of the bar
represents the duration of the operation. Figure 1 below can be a simple illustration.
Resource B
Job X-1
Resource A
Job Y1
JobY2
Job Z-1
Job Z-2
Job X-2
Time
In this simple example, Job X consists of two operations that are defined by Sequence
Number 1 and 2 and must be performed in that order. Operation 2 cannot begin until
Operation 1 is complete, i.e. precedence constraint. That is the reason why job Z-2
-3-
cannot start just after job Y2 finishes.
Here we can note that the schedule shown is merely one of several possible
production schedules that can be generated for this very simple two resources, three
job problem. In practical problems involving many different resources and many
different jobs, the number of possible schedules is enormous (actually it is well
known as NP-hard problem which will be further discussed in the next section.). We
clearly need an effective method for generating a “good” schedule that meets the
production objectives.
-4-
1.2 Project Aim & Objectives
“Is there any academic methodology or theory that may be able to solve the practical
scheduling problem ?”
“Are those theories or methodologies satisfactorily solve the problem, compared with
commercial scheduling application software ?”
“Any limitation or difficulty that may exist which hinder the commercialization of
those methodologies ?”
Above are the questions always appeared in the mind of the writer, knowing the
practical need described in the last section. Therefore, through this project by
designing and programming for an application, the writer wanted to find out the
answers.
Put it in a formal way, the objective of this project is to develop an application
program which can generate recommended production schedules, with the input of a
set of job orders and resources, together with their relationships in the practical
situation (detailed in the next section – Description of the Problem), considering :
1) Capacity constraints of the manufacturing resources
2) Precedence relationship of the operations of jobs
3) Multiple objectives for evaluating schedules
The schedules generated by the program will be presented by telling the planner the
start time, and expected end time for each of the operations in the problem set. And
also the quality of the schedules would be told by having the “scores” of each of the
schedules shown.
And last but not least, the performance of this program is critical. The time required to
generate a good solution would be investigated and considered as a main factor of the
practicality of the program. Performance statistic would be taken for various
combinations of parameters to be used by the algorithm.
As the performance issue is very crucial in the practical environment, it would be
another main issue to be investigated in this project.
-5-
1.3 Description of the Problem
In this project, one of the common production shop floor scheduling problems is to be
solved. Let us have a number of main job orders. Under each main job order, there are
several sub-job orders. The sub-job orders have precedence relationship between each
other, just like a tree structure, in which the sub-job orders are to produce the
components of the final product, like that of a Bill of Materials. The following
diagram tries to illustrate the structure.
Main Job - Product
Sub-Job A – for
Sub-Job B – for
Component A
Sub-Job A1 – for
Component A1
Component B
Sub-Job A2 – for
Component A2
Sub-Job B1 – for
Component B1
Sub-Job B2 – for
Sub-Job B3 – for
Component B2
Component B3
For each sub-job order, there are several Operations to go through to completely
produce the component. Each operation occupies a manufacturing resource (e.g.
machine, assembly line), which it is usually regarded as a Work Center in most ERP
systems.
For each operation, there is “Setup Time” and “Run Time”. Setup Time is the fixed
time to start the operation at that Work Center, and Run Time is the time needed to
complete one item. For example, the setup time is 0.5 day and the run time is 0.1 day
per item unit for an operation, if the quantity to be produced is 20, the total operation
time will then be equal to 2.5 days.
-6-
For each Work Center, there is one capacity constraint, i.e. a upper bound of
availability, for example, which can be the number of machines in a period of time
(e.g. per day or per week).
The problem is that now a manufacturer with the above conditions, receives a number
of main job orders. The main job order records the quantity of product required, the
latest delivery date, and the penalty cost of late delivery.
The task of the system is to generate schedule which should satisfy the capacity
constraint of all Work Centers used, and minimize the penalty cost if the schedule
cannot meet the delivery schedule of all the main job orders. Recommended schedules
would be provided by the system, accompanied with the “score” (performance
measures) for each of them. The calculation of the “score” is dependent on the
emphasis of the planner in evaluating a schedule. Composite scoring can be used for
multiple objectives, and weighting of each of them can be adjusted. Make span, idle
period of resources, Work-In-Progress level will be used as the performance measures
in the system of this project.
-7-
2
Related Works
2.1 Commercial Product
One of the commercial scheduling applications is to be investigated below. It is
Preactor and it has been integrated with many commercial ERP systems.
In this commercial FCS software, two approaches are provided to construct a schedule.
The first is named as algorithmic and the second as simulation-based.
Algorithmic sequencing is a simple method for schedule construction. The
algorithmic sequencer selects a job and then puts each operation for that job on the
planning board. It repeats this process until all jobs (and therefore, all operations)
have been loaded. Each operation is loaded on its specified resource at the first
available time slot that satisfies the constraints for that operation.
Although there are a number of very simple heuristic rules that can be used to select
the order for loading the jobs on the planning board (for examples, to sort the jobs by
a priority value that has been assigned to each job, earliest due date, earliest release
date, and smallest remaining slack time….), none of these rules are optimal in a
mathematical sense. Each rule represents a different strategy and focus in planning the
jobs individually. For example, the due date-related rules (earliest due date, least
remaining slack) focus on reducing the number of late jobs, whereas the
priority-based rule strives to complete the most important jobs as soon as possible.
But in practice, a planner is required to take into all these rules in consideration in the
same time as a whole.
In contrast to the algorithmic sequencer, the simulation-based sequencer selects and
loads an operation at a time. By loading individual operations rather than entire jobs,
the simulation-based sequencer has finer control over the way the operations are
loaded onto the planning board. This operation-at-a-time loading is the key to the
added flexibility in the schedule generation using the simulation-based sequencer.
Whichever of two sequencing algorithms described above, they required the planner
to construct schedules by “trial and error”, attempting different jobs dispatching /
sorting rules, or even moving the operations forward or backward manually. It is
because there are often multiple objectives to be satisfied before a final schedule can
be made.
-8-
These are not what actually the planners expect from a scheduling tool, because they
are working in a highly demanding customer-driven market environment. They expect
a tool which can provide them feasible, “good” schedules, taking into consideration of
factors of multiple objectives, with minimal manual participation.
In this project, the main evaluation method for the program is by comparing the its
results with schedules generated by this commercial product.
-9-
2.2 Academic Research Works
Determining an efficient schedule for the general shop problem has been the subject
of research for more than 50 years. And there were numerous papers, researches done
on this topic. Job Shop Scheduling Problem is one of the most typical topics found.
The classical job shop problem assumes that each job had several operations and
exactly one machine (resource) can only perform each operation, and each operation
has a single predecessor. There are many variations of the job shop scheduling
problem, for examples, flow shop scheduling, multi-objective job shop scheduling,
dynamic job shop scheduling, multiple capacitated job shop scheduling… which fitted
different criteria or assumptions of the real life conditions into the original structure of
the job shop problem. And the original aim of solving the job shop scheduling
problem was to find a feasible schedule.
From another point of view, some later researches regard the problem as Optimization
problem. It is because it is often impossible to obtain feasible solution or there could
be more than one feasible solutions. So it is expected that a computer program can
give out an optimal or near optimal (good) solution with some pre-set criteria or
objectives.
The sections below will try to summarize the related work for the two classifications
described above.
Critical Path Method
Critical Path Method is a traditional method came from Operation Research (OR). It
provides the resource-unconstrained schedule for a set of precedence-constrained
activities with deterministic durations. It gives the shortest possible make span
assuming infinite resources. Although useful for obtaining a rough idea of the
difficulty of executing a plan, the critical path method does not consider temporal or
resource constraints.
Linear and Integer Programming
Linear Programming is one of the most famous optimization techniques introduced
independently by Kantarowitsch in 1939 and by Dantzig in 1949. It is applicable in
decision situations where quantities (variables) can take any real values only restricted
- 10 -
by linear (in-) equalities, e.g. for representing capacity constraints. In case the model
solely consists of integer variables, it is called Integer Programming. If the model
contains both real and integer variables, Mixed Integer Programming model is given.
Although linear programming is very efficient for solving linear programs, problems
arise if the objective or constraints are not linear functions. In some cases, non-linear
functions may be approximated by piecewise linear functions, and linear
programming is still used; however, this is often an inefficient representation of the
problem, and a very limited number of functions may be represented this way. These
formulations may cause explosively large matrices that are solved very slowly. For
example, logical constraints usually require at least two linear constraints to be
represented correctly, so a large number of logical constraints creates a huge linear
program. This is a common difficulty in scheduling and sequencing problems.
Bounded Enumeration
Many solution methods search a decision tree generated from the precedence relations
in the plan. The root of the tree corresponds to the first task, and the second level of
the tree is the set of tasks that can be scheduled once the first task has been scheduled,
and so on. The final tree thus represents a precedence feasible set of task sequences.
The search consists of traversing the tree until the best root-to-leaf path is found.
Enumerative methods are typically bounded using heuristics in order to reduce the
size of the tree.
It is easy to see how the tree grows quickly with the number of activities. Depending
on the precedence relations, each new task can add many branches to the tree.
Although pruning algorithm can be used for trimming the tree branches, it requires a
new set of heuristics for the scheduling step if the types of constraints are changing.
According to some researchers (Sprecher and Drexl), enumerative methods cannot
solve large problems; the tree is simply too big. And they still require special
heuristics to accommodate variations in resource constraint formulations.
Scheduling Heuristics
Scheduling heuristics operate on a set of tasks and determine when each task should
be executed. The scheduler enforces constraint satisfaction by assigning a task to a
resource ( or a resource to a task ) at a time when the resource is available and for the
task can be executed. (This is similar to the Algorithmic sequencing described in the
- 11 -
Introduction section.)
Sequencing Heuristics
Sequencing heuristics determine the order in which the tasks will be scheduled. These
heuristics are often used in combination with decision trees to determine which part of
the tree to search or to avoid. Actually it can be regarded as a variation of scheduling
heuristics.
Constraint Programming
Constraint Programming represents a relatively new technique for computing feasible
(and optimal) solutions to combinatorial decision problems like those typically arising
in scheduling and routing. In the mid 80’, it was developed as a computer science
technique by combining concepts of Artificial Intelligence with new programming
languages. In the meantime, it has received considerable attention in practice as well
as in the Operation Research community, in particular, since it has successfully been
included into well-known commercial software systems (e.g. ILOG).
Constraint Programming does not reply on mathematical optimization problems but
on constraint satisfaction problems which, basically, consist of variables, domains as
well as constraints. For each variable, an associated domain defines a set of feasible
values which need not necessarily be real or integral. The variables are related to each
other by constraints describing restrictions that have to be observed by feasible
solutions. In general, constraints need not be simple expressions, in particular, they
need not be linear inequalities or equations as common in mixed integer programming.
The corresponding constraint satisfaction problem is to assign a value to each variable
of its domain such that each constraint is satisfied. Obviously, a Constraint
Satisfaction Problem differs from a classical optimization problem by not considering
an objective function. That is, solving a Constraint Satisfaction Problem aims at
finding feasible solutions to a real-world problem rather than an optimal one.
However, a possible objective function can be represented within Constraint
Satisfaction Problem by particular constraints and optimized by solving several
Constraint Satisfaction Problems consecutively.
Among the major advantages of Constraint Programming are the ease of application
and the flexibility to add new constraints to existing problems. This is due to the rich
set of possible constraint types and to the search algorithms employed being rather
- 12 -
general. A disadvantage may be the rather poor performance with respect to solution
quality and computation time. For a constraint programming approach to be
competitive to modern Operation Research methods such as highly developed branch
and bound procedures or meta-heuristics (e.g. Genetic Algorithms), the constraints of
the problem to be solved should be rather restrictive, like this is (for example) true in
production scheduling in case of tight due dates.
Simulated Annealing
Simulated Annealing approaches require a schedule representation as well as a
neighborhood operator for moving from the current solution to a candidate solution.
Annealing methods allow jumps to worse solutions and thus often avoid local
sub-optimal solutions.
Tabu search
A tabu search is a meta-heuristic that guides local heuristic search procedures to
explore the solution space beyond local optimality. It was introduced by Glover (86)
specifically for combinatorial problems. And it was used by some researchers (e.g.
Taillard 90’, Nowicki 96’) to tackle flow shop scheduling problem.
Genetic Algorithms (Evolutionary Algorithms)
Genetic Algorithms (GA) were initially developed by Holland and its associates at the
University of Michigan and the first systematic but rather technical treatment was
published in Holland (1975).
GA has become increasingly popular as a means for solving such optimization
problems heuristically, that is, for determining near-optimal solutions within
reasonable time. One of the main reasons for this popularity is the relative ease of
programming at least a simple genetic algorithm. Furthermore, many researchers have
observed empirically that already basic versions of GA will give very acceptable
results without excessively fine tuning them for the problem on hand. (Research has
been done to investigate the performance of GA on scheduling problems, reference [6])
Finally, since GA work on a representation (coding) of a problem, it is possible to
adapt existing procedures to modified problem versions quite easily or to write one
general computer program for solving many different problems.
- 13 -
As mentioned in the previous section, most scheduling problems in the real life
manufacturing environment have been proven to be NP-hard, that is, the
computational time requirements grows exponentially as a function of the problem
size. (For n jobs and m machines in the general job shop scheduling problem, there
will be n!m feasible solutions.) And GA is well known as working better with a large
population of solutions.
One of the earliest suggested uses of genetic algorithms for scheduling was made by
Lawrence Davis. In his paper (85), Davis noted the attractiveness of using a stochastic
search method due to the size of the search space and suggested an indirect
representation in which the genetic algorithm operated on a list which was then
decoded to form the actual schedule.
2.3 Conclusion
From the papers and researches found for the topic of production scheduling, one can
find that each of the above techniques has its own advantage over the others in
different area of problems.
After consulting the supervisor of the writer for this project, Dr. Andy Chun, Genetic
Algorithm is used as the fundamental methodology to solve the problem described in
the section 1.3. The writer do hope that this choice can broaden the space for further
development of this system because of the favorable trend of GA application in the
scheduling field.
- 14 -
3
Conceptual Background
3.1 Introduction of GA
Nature has a robust way of evolving successful organisms. The organisms that are
ill-suited for an environment die off, whereas the ones that are fit live to reproduce.
Offspring are similar to their parents, so each new generation has organisms that are
similar to the fit members of the previous generation. If the environment changes
slowly, the species can gradually evolve along with it, but a sudden change in the
environment is likely to wipe out a species. Occasionally, random mutations occur,
and although most of these mean a quick death for the mutated individual, some
mutations lead to new successful species. Darwin’s evolution theory is just trying to
state out this concept.
Genetic Algorithms (GA) starts with a set of one or more individuals and applies
selection and reproduction operators to “evolve” an individual that is successful, as
measured by a Fitness Function. There can be several choices for what the individuals
are.
GA simply searches directly in the space of individuals, with the goal of finding one
that maximizes the Fitness Function. The search is parallel because each individual in
the population can be seen as a separate search. And the key question is how to
allocate the searching resources. Clearly, we should spend most of our time on the
most promising individual. But we are taking the risk of getting stuck on a local
maximum if we ignore the low-scoring ones.
Before we can apply GA to a problem, we need to answer the following questions :
z What is the fitness (objective) function ?
z How is an individual represented ?
z How are individuals selected ?
z How do individuals reproduce ?
Fitness Function – it usually depends problem, but generally speaking, it is a
function that takes an individual as input and returns a real number as output.
Representation – in some classic GA approach, an individual is represented as a
string over a finite alphabet. Each element of the string is called a gene.
- 15 -
Selection Strategy – usually randomized, with the probability of selection
proportional to fitness. In other words, if individual A scores twice as high as B on the
fitness function, then A is twice as likely to be selected for reproduction than is B.
Usually selection is done with replacement, so that a very fit individual will get to
reproduce several times.
Reproduction – which is accomplished by cross-over and mutation. All the
individuals that have been selected for reproduction are randomly paired. For each
pair, a cross-over point is randomly chosen. And each gene can be altered by random
mutation to a different value, with small independent probability.
If the GA has been designed well (actually this is an art), the population will converge
to an optimal solution to the problem. Convergence is the progression towards
increasing uniformity. A gene is said to be converged when 95% of the population
share the same value. The population is said to be converged when all of the genes
have converged.
But unfortunately it is important to note that GA are stochastic iterative processes and
they are not guaranteed to converge. Therefore, a termination condition may be
needed to specify. It can be a fixed maximal number of generations or the attainment
of an acceptable fitness level. That is the reason why it is noted that “good” solution
will be obtained by using GA, but not optimal solution.
NOTE
In this project, some of the detailed GA processes, e.g. selection, reproduction, will
not be investigated. Standard GA methods from the GA engine provided are used, e.g.
crossover method, mutation method…
- 16 -
4
System Analysis
4.1 Basic System Requirements
The system is required to provide an interface for the user to input the following
information.
-
quantities, latest delivery dates, and penalty costs about the main job orders
the relationship between the main job orders and their corresponding sub-job
orders
the operations sequence of each of the job orders, both main and sub jobs
-
the Work Center used by each operation
the setup time and the run time of each operation on the Work Center
the capacity constraint of each Work Center.
And the system is required to transform the above information into formats for GA to
generate solution described previously.
After running GA, the program is required to transform the output of GA to user
understandable format :
-
start time and end time of each operation of sub-job orders
“scores” of the schedules
Diagram is used to illustrate the system functions as below.
Parameters for GA
Basic Info.
Work Center info..
Main/sub job info.
Operation info.
Planner
Start time / End time of operations
Scores of suggested schedules
- 17 -
Results
AI
Scheduling
system
4.2 Assumptions
In real life situation, there are a lot of factors required to be included in the scheduling
considerations. It would need a long period of time of development to cater for all of
them in the system. To limit the scope of the project and make sure the project will be
completed on time, there are several assumptions made for the problem. They are
listed as below :
-
one operation can be executed on one resource only, no ‘parallel’ run on more than
one resource will be considered ;
-
each operation once started must be performed to completion (no pre-emptive
priorities);
no rework operation will be considered;
the capacity constraint of each resource is static over time, that is, not vary with
-
time;
there is only one capacity constraint for each Work Center, no secondary
constraint will be considered;
there is only one sequence of operations in a job, no alternative sequence will be
considered;
the sequence of the operations is linear;
no alternative resource for operation, that is, each operation can be defined to
occupy a particular resource only;
all operations can be started at any time, that is, there is no limitation of the start
time of any of the operations;
operation can start only after its predecessors finish; there is no overlapping of
operations in the schedule;
-
there is no fix pre-defined slack time allowed between operations;
setup time for each operation is fix no matter what is the sequence of operations;
all resources operate on the same time basis, e.g. 8 hours per day, or 24 hours per
day;
-
no holiday or down time of resources will be taken into consideration, it is
assumed that the resources will be available continuously ;
all operations are allocated again at each scheduling process, no previous schedule
information will be considered.
-
- 18 -
4.3 Detailed Data Flow
Data Flow Diagrams are used to show the information flow as below :
Basic Info.
1.0 Process
Planner
Validated data
Basic
Info.
Basic Information
Validated data
2.0 Process
Planner
inputted
Weightings
All Basic Info.
info.
for GA scores
Planner
3.0 Run
Parameters for GA run
Scheduling
engine
Schedules &
running log
Results
Schedules &
running log
4.0 Convert to
user readable
Planner
format
Results in Gantt
Chart / Table format
- 19 -
DFD 1.0 Basic Information Data Flow :
1.1 Process
Item Info.
Item Info.
Validated data
1.2 Process
Work Center
Work Center
Info.
Info.
Validated data
Planner
Basic Information
Operation Info.
1.3 Process
Operation
Info.
Job Orders Info.
Validated data
Validated data
1.4 Process
Job Orders
Info.
- 20 -
DFD 1.1
Item Info. Data Flow :
1.1.1 Verify
& Add Item
Info.
New Item Info.
New Item Info.
Item No.
Item No.
1.1.2 Search
and /or
and /or
& List Item
Description
Description
Info.
Basic Info. (Item Master)
Planner
Updated Item Info.
Verified Updated Item Info.
1.1.3 Verify
and Update
Item Info.
Item No. to be deleted
Item No. to be deleted
1.1.4 Delete
Item Info.
- 21 -
DFD 1.2 Work Center Information Data Flow :
1.2.1 Verify
& Add Work
Center Info.
New WC Info.
New WC Info.
WC code
WC code
1.2.2 Search
and /or
and /or
& List Item
Description
Description
Info.
Basic Info. (WC Master)
Planner
Updated WC Info.
Verified Updated WC Info.
1.2.3 Verify
and Update
WC Info.
WC code to be deleted
WC code to be deleted
1.2.4 Delete
Item Info.
- 22 -
DFD 1.3 Operation Information Data Flow :
1.3.1 Verify
& Add Oper.
Info.
New Oper. Info.
New Oper. Info.
Oper code
Oper code
1.3.2 Search
and /or
and /or
& List Oper.
Description
Description
Info.
Basic Info. (Oper. Master)
Planner
Updated Oper. Info.
Verified Updated Oper. Info.
1.3.3 Verify
and Update
Oper. Info.
Oper. No. to be deleted
Oper. No. to be deleted
1.3.4 Delete
Oper. Info.
- 23 -
DFD 1.4 Job Order Information Data Flow :
1.4.1 Verify
& Add Job
Info.
New Job Info.
New Job Info.
Job No. and
Job No. and
1.4.2 Search
/or
/or
& List Job
Description
Description
Info.
Basic Info. (Job Master)
Planner
Updated Job Info.
Verified Updated Job Info.
1.4.3 Verify
and Update
Job Info.
Job No. to be deleted
Job No. to be deleted
1.4.4 Delete
Job Info.
Relationship of Jobs
Job Nos. to be related
1.4.5 Set
relations of
Jobs
- 24 -
DFD 3.0 Run Scheduling Engine
Basic Information
Data in GA representation
Jobs, Job relations,
Converted Data
Work Center Info.
Converted Data
3.1 Convert Basic
3.2 Feed into
Info. to format
Data and required
for Genetic
parameters, and
Representation
run GA engine
GA parameters
Planner
Execution Log
Result in GA
representation
Log file
3.3 Convert result
to understandable
/ meaningful
format
Result in
meaningful format
Result
- 25 -
Entity Relationship Diagram
Description
Item
Item No
Operation
Code
Quantity
Delay Cost
Description
Due Date
Job No.
Job Order
Seq. No.
Operation
Has
Storage Cost
Setup Time
Done
in
Run Time
Capacity
Consumption
Factor
Precedence
Related
Work Center
Precedence Job Order No.
Description
Critical
Capacity
- 26 -
Over Capacity Cost
4.4 Genetic Representation
Before starting any further analysis or design work, it is essential to design and define
the meaning or representation of the gene of a chromosome used in the GA. The
writer has spent a period of time to find out and study various representation design.
Explained in detail in the reference [7], for any genetic algorithm, the representation
should be a minimal, complete expression of a solution to the problem. A minimal
representation contains only the information needed to represent a solution to the
problem. A complete representation contains enough information to represent any
solution to the problem. If a representation contains more information than is needed
to uniquely identify solutions to the problem, the search space will be larger than
necessary.
Whenever possible, the representation should not be able to represent infeasible
solutions. If a chromosome can represent an infeasible solution, care must be taken in
the objective function to give partial credit to the chromosome for its “good” genetic
material while sufficiently penalizing it for being infeasible. In general, it is much
more desirable to design a representation that can only represent feasible solutions so
that the objective function measures only optimality, not feasibility. A representation
that includes infeasible increases the size of the search space and thus makes the
search more difficult.
And the following sections try to explain different methods found.
- 27 -
(1) By Dispatching Priority of Operations
As from reference [2], the chromosome is partitioned into equally sized blocks of
genes which is named as subchrome. One subchrome is used to encode a preference
list for each resource. Within a subchrome a list of operation / job preferences
(dispatch rules) is encoded, for the resource the subchrome relates to. Dispatch rules
allow the program to choose the next operation / job to be processed for resource that
becomes free, from any number of operations / jobs that are waiting to be processed in
the input buffer of resource. Reading a subchrome from left to right gives us the
operation / job to be chosen with the highest priority through to the lowest. For
example, the chromosome for a four resource, four operation problem would be :
1320 0123
1023 3210
If we consider the third subchrome 1023, we have the operation choice preference list
for the third resource. This means that if operations / jobs ids 0, 1, and 2 have stacked
up in the input buffer of the third resource, then when the third resource is ready to
process a new operation / job, the program should choose operation / job id 1 to be
processed next as it has the highest priority of the waiting operations / jobs.
This design of gene representation will require a simulation process after which the
timing details (i.e. the start time, end time of each operation / job) can be found.
This method leads to redundancy of gene representation. If there are n resources and
m operations / jobs, there will be n x m genes. But actually the program do not need to
know every priority of operation / job (even some has been allocated). This is
undesirable because the performance of GA processing will become longer. When the
input pool of data is large, the performance degrade would be significant.
- 28 -
(2) By Sequence of Job No.
As from reference [9], for a n-job and m-operation scheduling problem, a
chromosome with a string containing n x m genes will be constructed. Each gene is
interpreted as the first unscheduled operation of the job specified by the job number at
the matrix of jobs and operations. The first unscheduled operation belonging to the
job at each position in order is scheduled on the designated resource at the earliest
time it can be started.
For example, following is a typical chromosome for the 3x3 scheduling problem in
matrix table a :
3
2 3 1 2
1 2 1 3
Table a :
Job No. Operation 1 Operation 2 Operation 3
1
(M1,t1)
(M2,t2)
(M3,t3)
2
(M2,t4)
(M3,t5)
(M1,t6)
3
(M1,t7)
(M3,t8)
(M2,t9)
where Mn represent the Resource used, and tn represent the time duration required.
Schedule thus represented :
M3
J3
M2
J2
M1
J3
J2
J1
J1
J1
J3
J2
Time
Again, this method will also lead to redundancy of representation. Or if we modify it
by limiting the number of genes to the number of operations, the problem may be
solved.
- 29 -
(3) By sequence of Job No. in subchrome of resource
This method is described in reference [8]. This is actually a combination of the
methods described above. A chromosome is divided into subchromes and each
subchrome represents a resource. Within the subchrome, it is a sequence of Job /
Operation No., instead of priority of Job / Operation.
Basically this method has similar drawback as described in the previous methods.
(4) By “relative” time duration
This is a method described in reference [7]. A single chromosome contains an array of
numbers. Each number is associated with an operation and indicates the period of
time from the latest finish of all the operation’s predecessors to the start of the
operation. The times are measured relative to other operations, not to an absolute
reference. As a result, precedence feasibility is assured for every schedule.
For example, the chromosome is like :
T1 T2 T3 T4 T5 T6 T7
where Tn are the “relative” time
T4
T5
Oper 4
Oper 5
T7
T1
T2
Oper 1
Oper 7
T3
Op2
Oper 3
Time
Using this method, the length of a chromosome is the number of operations in the
problem, and thus the redundancy problem will not be found here.
- 30 -
(5) Genetic Representation used in this project
Quite obviously as described in the previous sections, the method of “relative” time
should be the most appropriate one to be applied in the project. It is because it not
only satisfies all the criteria described in the introduction paragraph of this section –
Genetic Representation, and also it is readier to makes room for the further
development of the application to cater for other requirements, such as consideration
of alternative operating modes (e.g. alternative resources). It is because each gene, by
this method, represents an operation, and in most case the alternativeness bases on an
operation, not resource. So then one can build on this gene representation with other
corresponding representation, to every operation (gene) in the problem set.
However, in this project, a simple necessary modification is made to the method of
“relative” time duration. Each chromosome is built up by a number of
sub-chromosomes. Each sub-chromosome represents a Main Job in our problem. And
so each gene will associate with an operation under a Main Job, that is, the operations
of all the sub-jobs will be regarded also under a Main Job. The operations of all
sub-jobs (of a main job) will be gathered under one sub-chromosome with the
non-arbitrary order.
Let us have an example to illustrate, say, we have 2 main jobs and the tree
representation of their relationship with their own sub-jobs as follow :
Main Job A
Main Job B
1) Oper. A1
2) Oper. A2
1) Oper. B1
Sub-Job A1
Sub-Job A2
Main Job B1
1) Oper A11
2) Oper A12
1) Oper. A21
1) Oper. B11
2) Oper. B12
Then the chromosome will have 8 genes (equal to total number of operations), and
each gene will store the “relative” time for a particular operation. The following order
- 31 -
will be the order of operations assigned to the chromosome.
A11 A12 A21 A1 A2 B11 B12
B1
The first gene now will represent the operation A11 in the example. Note that the
sequence of the operation is not arbitrary. The operation should have all its precedent
operations already been assigned a gene representation. We shall discuss it in detail in
the Section 5.4 – Process Specification.
(6) Comparison
Below the writer try to summarize the characteristics of the methods described in this
section for genetic representation.
Method
(1) Dispatching
priority
(2) Job
Sequence
(3) Job
sequence in
resource
subchrome
(4) “Relative”
time
(5) modified
“relative” time
Completeness Uniqueness Non-Redundancy Feasibility included
Y
N
N
N
Y
N
N
N
Y
N
N
N
Y
Y
Y
Y
Y
Y
Y
Y
As a short conclusion, the genetic algorithm operates on the structure of the
chromosome without considering what the chromosome means in the schedule space.
As a result, the constraints are coupled to the search algorithm only through the
genetic operators, that is, “initialization”, “crossover”, and “mutation”, and the
objective measures are completely decoupled from the search algorithm. The
following section will discuss the objective (fitness) functions used in this project in
detail.
- 32 -
4.5 Fitness Functions Analysis
Apart from the finalization of Genetic Representation, the design of Fitness Functions
is very critical as well, because this would greatly affect the database structure design.
The writer would like to spend a section to discuss the reasons behind these functions
as below.
In this program, 5 fitness functions are used to evaluate the quality of the schedules
generated from the chromosomes in the population pool :
(1) Over-Capacity of Work Centers
(2)
(3)
(4)
(5)
Over-Due of Main Job Orders
Make Span of all Job Orders
Idle period of Critical Work Center(s)
Work-In-Progress (WIP) level of components, or degree of Just-In-Time (JIT)
The total or final score of a chromosome will then be the sum of the values of
multiplying each of the score with their corresponding weightings. And the smaller
the total score, the better the schedule a chromosome represents.
(1) Over-Capacity of Work Centers
As from the definition of the objective of this project, capacity consideration is the
first rule to be considered. Jobs should be assigned and scheduled on the
individual resource under the capacity constraint. In the analysis of real life
situation, however, we always find there may be no strict constraint of capacity of
some resources. For example, in order to complete the operation to meet the order
due date, overtime work will be arranged. In other words, capacity constraint can
be broken at a cost.
In order to provide this kind of flexibility, a field “Over Capacity Cost” (OT_Cost
in table WC) is assigned to the Work Center Master such that the planner can take
into account of the possibility of Over-Capacity. Of course, if the capacity of a
resource is strictly restricted, the value of the field should be set to a value as large
as allowed, say, 9999999, so that no over-capacity allocation arrangement will be
scheduled on this resource.
- 33 -
(2) Over-Due of Main Job Orders
It will be meaningless if there is no constraint of meeting the delivery date of an
order during the scheduling process. Same as the capacity constraint, on-time
delivery or due-date constraint should be a primary consideration. Also the same
as the Over-Capacity issue, it is possible that an order can be delivered after the
pre-set delivery date, at a cost !
A popular example in the real life is that the goods can be delivered by air or
express to the end customer, instead of shipping or other cheaper transportation
means, if the production cannot meet the due date. Or even worse, there may be
term stated on the sales contract that a penalty cost will be charged for the delay.
Therefore, in the design of this fitness function, a field “Delay Cost” (DelayCost
in table JO) is implemented on each Main Job Order. It is the basis for the penalty
cost per time unit (Time Unit will be discussed in the next section).
With the consideration of both “Delay Cost” and “Over-Capacity Cost”, the
scheduling engine can make a trade-off “decision” in order to minimize the total
cost, which should be a reasonable basis for the scheduling problem in the real
life.
(3) Make Span of all Job Orders
Make Span is a very common criteria to be considered in the Job Shop Scheduling
Problem described in academic papers. The objective of using this criteria is to
minimize total period of time occupying the resources by the jobs. It would avoid
the scattering of jobs over the planning board, specially in the case of only a few
jobs exist in the scheduling problem. In this project, it is also taken into account.
(4) Idle period of Critical Work Center(s)
In the real life scheduling problem, there is / are always bottlenecked Work
Center(s). They are usually special processing machinery, e.g. Surface Mounted
Technology (SMT) machine in the electronic industry, CNC machine center in the
metal processing industry. As they are usually very expansive, it is not possible for
a manufacturer to purchase too many of them and they become the bottleneck of
the whole manufacturing process.
- 34 -
Therefore, a special scheduling technique or criteria will be used for those critical
Work Centers. In the situation that there are too many jobs (operations) to be
scheduled on those bottlenecked Work Center, the scheduling engine need to only
consider Over-Capacity and Over-Due criteria, as described above. However, in
the case that there are idle periods of the Work Center, the planner should “crowd”
as far as possible all the jobs (operations) together and make room(s) as large as
possible on the planning board so that later jobs can be assigned easier onto those
bottleneck Work Centers. This is desirable because once a schedule is confirmed
and released to the production floor, less change should be made as far as possible
in the next scheduling result compared to the released one. The following
diagrams try to illustrate the idea :
Scattered schedule – not desirable
Bottleneck
(Critical)
Work Center
Time
Diagram 4.5a
Crowded schedule – Desirable
Bottleneck
(Critical)
Work Center
Time
Diagram 4.5b
In this project, a flag “Critical” is implemented for each Work Center such that the
described technique will be applied to them. And the fitness function will count on
the number of idle periods, the less it is, the better score will be assigned. In the
- 35 -
above example, the number of idle period of diagram(4.5a) is 4, while that of
diagram (4.5b) is 2.
Apart from above, the desire of minimizing “slack time” between operations in a
work center can also be handled by using this fitness function.
(5) Work-In-Progress (WIP) level of components, or degree of Just-In-Time (JIT)
It is also a popular idea in nowadays manufacturing concept that the components
should be supplied “Just-In-Time” to its next process or even Product delivery.
The main purpose is to minimize the level of Work-In-Progress stock in the shop
floor.
To include this concept into the scheduling process, a field “Storage Cost” per
Time Unit (StorageCost in table JO_Oper) is implemented which will be used to
calculated the total cost of storing the WIP after each operation. The scheduling
engine will count it in the evaluation scores.
- 36 -
4.6 Other special considerations
To fit the system requirements into the GA engine, and also to provide
user-friendly features, there are 5 more special issues to be discussed and
determined before the actual start of the design and implementation work. The 5
issues are :
(1)
(2)
(3)
(4)
Time Unit definition
Maximum Allowed values of “Relative” time
GA termination criteria
Other GA issues
(5) 3 Best Results record
(6) Logging for schedule run
(1) Time Unit Definition
As the GA engine used in this project do not accept real number as the gene value,
integer value is used. However, to provide the flexibility of setting the time
gratuity of the schedule, that is by week, by day, by hour, or even by minute, the
concept of “Time Unit” is introduced. Basically, all the time related variables used
in the program will base on Time Unit. And the conversion of the values of the
variables to the actual date and time will make use of the field “Time Unit per
Day” (TimeUday in table Parameter) which stores the number of Time Unit in a
day. For example, it should be set as 24 if the time gratuity is in hour and full day
running is assumed, or it should be 8 if only 8 hours-day work is assumed.
The schedule results, i.e. the start time and end time of operations, not only be
represented by date, but also in proportion of a day. That proportion value is
calculated by using “Time Unit per day” as the basis.
(2) Maximum Allowed values of “Relative” time
As an essential parameter supplied to the GA engine, the maximum integer value
to be randomly generated at the initialization stage (the very beginning stage of
generating the first pool of chromosome for the GA) to the gene is to be
determined first. In the genetic representation used in this project, this max. value
is actually the max. allowed “relative” time duration to be considered.
- 37 -
This value could be defaulted as the maximum due time (in Time Unit) of Main
Job Order in the problem set. However, the writer think that it would be more
flexible to allow the user to set this value manually before starting the scheduling
process. It is because it will reach the “optimal” or “sub-optimal” results in a
shorter processing duration if this value is set as an “appropriate” smaller value,
and this is practical in the case that the relative time between operations needed to
be limited in a certain range (somehow similar to the JIT concept), or the
scheduling engine is required to consider a lot of jobs / operations and they are
usually crowded together.
Of course, there will be drawbacks of setting too small this value. “Optimal”
result may not be obtained because the “relative” time is limited in a certain range.
So it must be very careful to set this value. Generally speaking, if not so many
jobs are in the problem set or the range of scheduling period is long, this value
should be set around the due time of the Main Job with maximum due date.
(3) GA termination criteria
Termination criteria is also to be defined before executing the scheduling process.
In this project, fix number of generations will be used. Therefore, “Number of AI
scheduling cycles” is allowed to be set before the execution. It will be the number
of cycles that the GA engine runs on and ends. Of course, the larger the value it is,
the longer the engine will run, but the better result could be obtained.
Please refer to the screen capture (1) in the Appendix section 10.4 for the
discussion above.
(4) Other GA issues
Apart from the two parameters for GA discussed, the writer also paid attention to
the following parameters used in GA computation :
-
mutation probability
population size
mating pool size
crossover probability
However, the writer think that these parameters should not be set by general user
because the outcome of wrongly assigning values to those parameters is not
- 38 -
guessable by the writer. Therefore, they are hard-coded in the program.
On the other hand, the writer has tried to do a small evaluation test against different
combinations of the values of those parameters. The result and conclusion are
discussed in section 6.4.
(5) 3-Best Results Record
As discussed in the introduction of application of GA in scheduling problem, it
should not be expected that an optimal solution can be obtained. Near-optimal or
“good” solution is more realistic. And moreover, we have 5 types of fitness
functions used in this program, and there may be case that total scores of different
resulted schedule can be the same, but the individual score can be different.
Therefore, the program is designed to keep 3 best results (least score) after the
scheduling process. One can view the breakdown of the scores of individual fitness
function for each of the 3 best results, and choose the one more suitable to apply
practically.
To keep the 3 results, 3 sets of fields are included in the tables storing the results in
the database, they can be found in table Parameter and GeneInfo. (Details will be
discussed in the next section.) Please refer to Appendix 10.4 (2) for the system
screen.
(6) Logging for schedule run
Performance is also one of the issues to be reviewed at the end of the project. Time
taken to generate a good schedule is needed to be logged down so that the
performance can be compared. At the same time, the parameters used in the
execution are also logged down, e.g. “number of operations” considered in the
process, the values of weightings…. And if there is any exception found, the
problem will also be logged down. Text file is used to keep the log in the project.
Please refer to Appendix 10.4 (3) for the system screen.
- 39 -
5
System Design
5.1 Structured Charts
Structured Charts are used in the design stage of the program development.
Important Structured Charts are shown below :
AI Scheduling
System
GA schedule
results
Validated
Basic Info.
Validated Basic
Info. &
Parameters
Validated
Parameter
Process Basic
Information
Process GA
Parameters
GA schedule
results
Execute GA
scheduling
Process Basic
Information
Validated
Job Order
Info.
Validated
Item Info.
Validated
Operation
Info.
Validated Work
Center Info.
Process Item
Data
Convert GA
results
Process Work
Center Data
- 40 -
Process
Operation Data
Process Job
Orders Data
Validated
Job Orders
Info.
Process Job
Orders Data
Validated
Main Job
Basic Info.
Validated Main
Job operation
Info.
Validated
Main Job
Basic Info.
Validated Sub-job
Operation Info.
Validated
Sub-job
Basic Info.
Validated
Main Job
& Sub-job
Basic Info.
Process Main
Process Main
Process
Process
Job Order
Basic Data
Job Operation
Data
Sub-Job Basic
Data
Sub-Job
Operation Data
The diagram below is a template for Basic Information processing, it is basically the
same for Item Data, Work Center Data, Operation Data and Job Order Data.
Validated
Item Info.
Process Item
Data
New Item
Info.
Updated
Item Info.
Existing Item
Info.
Add new
record
Search existing
record
- 41 -
Modify
existing record
Delete existing
record
Validated Basic
Info. &
Parameters
GA schedule
results
Execute GA
engine
Validated Basic
Info. &
Parameters
Converted
format
Converted
format
Convert Basic
Info. &
Parameter to
GA schedule
results
Schedule
result in
GA format
Schedule
result in
GA format
Feed the converted
format and start
GA calculation
GA acceptable
format
Convert the
result from GA
calculation to
meaningful
format
As a remark, “GA acceptable format” just simply means the Gene Representation
discussed in the corresponding section previously. And the “meaningful” format
means the Start Time and End Time of each operation. Note that the Start Time and
End Time will be converted to user acceptable format – Start Date and End Date by
the module – Convert GA Results.
For more detail about the design of these core parts of AI Scheduling system – Data
Conversion, Execute GA process and Convert GA Results, the writer will have a
detailed discussion on them in the section 5.3 – Process Specifications.
- 42 -
5.2 Database Design
Basically from the ER diagram shown in section 4.3, the skeleton of the database
structure can be built. In addition with data used in GA computation, the whole
database can then be built. The detailed database full listing is included in the
Appendix section. And a brief introduction of the tables designed is given below.
Table name
Main Functions
Basic Information
JO
To store the user input information about Job Orders.
WC
To store the basic information about Work Centers used in the
system.
Item
To store the basic information about Item to be processed in the
manufacturing operation.
Oper_WC
To store the information about Operation.
JO_Oper
To store the Operations (Routing) required to complete the Job
Order.
Parameter
To store the parameters used in the GA scheduling, and the
scores breakdown of the best 3 results.
Users
To store the login user information.
Tables used in GA calculation
GeneGAInfo
(Temporary DataSet)
To store the basic information of each gene used in the GA
evaluator, and store the temporary data (StartTime and EndTime)
used in the GA calculation.
GeneInfo
To store initially the gene information from the conversion of
user input data into gene representation (relation of gene with
Job Order and Operation), and also keep the final result of the
GA to facilitate output to user interface (i.e. Start Date and End
Date)
MainJO
(Temporary DataSet)
To store temporarily the result of GA evaluator for the
comparison of end time and due time for the Main Job Order.
- 43 -
5.3 Process Specifications
As mentioned above, the writer will try to list the detailed process specifications
used for the 3 core functions of the GA scheduling process in this section. It
should be highlighted here that the GA engine used in this project is provided by
the writer’s supervisor, Dr. Andy Chun. What the writer need to do is to convert
the basic information into the format of Gene Representation discussed and
modify (override) the evaluation function used in calculating the score for the
chromosome, feed and start the GA computation, and finally convert back the
gene information to a schedule. In short, the 3 functions are :
(1) Gene Converter (RunSchedule.vb)
(2) Evaluator (StartGA.vb)
(3) Result Assigner (Converter) (AssignResult.vb)
(1) Gene Converter
Basic Concept
— To assign the operation of jobs onto the genes of the chromosome, make
—
—
sure that the operation of jobs of a main job is always assigned before
those operations nearer to the root in the tree of operation of jobs of Main
Job. “Stack” method is used.
Each main job is represented by a sub-chromosome.
All sub-chromosomes will be catenated to form the whole chromosome
with no marking gene is used to separate the sub-chromosome.
Check Data (in Database) validity
1) Check table WC if it is empty;
2) Check table JO if it is empty;
3) Check table JO_Oper if it is empty;
4) Check table Oper_WC if it is empty;
If any of the above table has no record, message to alert the user that :
“No Data of
???? ! Please check first and start the Scheduling again.”
Where ???? depends on which kind of data is missed,
WC – Work Center
JO – Job Order
JO_Oper – Operation
Oper_WC – Operation / Work Center relations
- 44 -
Increment the Log Number of Scheduling Execution
Update the field “Log_no” in table Parameter by 1
Create DataSet and get data from Database
1) Create Data Tables for :
-
GeneGAInfo
-
GeneInfo
-
WC
-
JO
-
JO_Oper
-
Oper_WC
2) Fill the data tables from the database tables correspondingly
Calculate and store the number of WCs (WC_No)
1) start from 0, assign for each record in table WC to WC_No with increment of
Using Stack to convert the tree of Jobs to Genes
Spec. Detail
Add one more field – EXPLODED (Boolean) [default as False] – to the datatable
of JO, which is used to record whether the JO has been exploded to find its
successors in the stack.
1) Clean up the datatable GeneGAInfo, GeneInfo and MainJO.
For each ACTIVE (Active = 1) main job in JO, perform all the following steps :
1) Select from table JO all the sub-jobs of the same main job to form a temp
collection (e.g. ABC);
2) Create a STACK.
3) Find the record of Root – the Final Product – PredJO_No = 0 (or JO_No =
MainJO_No), and get its value of JO_No; PUSH it to the Stack.
4) If there is more than one record found, write to the log file “Main Job XXX is
not properly relating its sub-job !”, and exit this loop, to another Main Job.
5) If EXPLODED is True, jump to step (8).
6) Select the records from ABC where PredJO_No = JO_No found in (3);
7) If found record exist, Push all of them to the Stack, and set the value of
EXPLODED of the Root (or original JO) to True.
8) If not found any record as from (6), Pop from the stack, and execute
- 45 -
ASSIGN [another method to assign the values to tables GeneGAInfo and
GeneInfo and MainJO] to pass the information of that JO for assignment.
9) If Stack empty, exit the loop.
10) If not empty, get the JO_No value of the topest item from the Stack, and
pass it back to step (5) above, that is, Loop back to step (5).
11) Add a record to table MainJO, with information :
Field Name
Value
MainJO_No
DueTime
Accu_EndTime
Overdue_Cost
StorageCost
Current MainJO_No
{ DueDate (in JO) - StartDate (input by user before executing
the AI Scheduling)} * TimeUday (in table Parameter)
DelayCost (in JO)
StorageCost (in GeneGAInfo where MainJO_No = this
MainJO_No and SucGene = 0 )
ASSIGN method :
Obtain from calling object the following information –
-
JO_No (this)
GeneCount is used to store the number of Gene exist in the chromosome,
initialized as zero at the very beginning.
1) Select from JO_Oper where JO_No = past into JO_No order by
OperSeq_No in Ascending order;
2) For each record from (1),
3) Add record to GeneInfo, with information :
Field Name Value
Gene_No
JO_No
MainJO_No
OperSeq_No
OperCode
WC_Code
StartDate
EndDate
GeneCount + 1
JO_No past in
MainJO_No in table JO where JO_No is the past in
OperSeq_No (this)
OperCode in the table JO_Oper where JO_No is the past in
and OperSeq_No = this OperSeq_No
WC_No in table JO_Oper where JO_No = past-in, and
OperSeq_No= this
-
4) Add record GeneGAInfo, with information :
Field Name Value
Gene_No
PredGene /
SucGene
GeneCount + 1
1) if this JO_No is the ending leaf of the tree, i.e., there is no
record found in table JO where PredJO_No = this JO_No,
2) further from (1), and if it is the first Operation of this
JO_No, i.e., smallest OperSeq_No among the operations
of this Job, then assign PredGene = 0;
3) from (2), if not the first Operation, then PredGene =
- 46 -
GeneCount [i.e. its previous gene];
4) and further from (3), locate at the record in GeneGAInfo
where Gene_No = GeneCount, and assign its
SucGene=GeneCount+1;
5) from (1), if this JO_No is not the ending leaf, and if it is the
first Operation of this JO_No,
6) from (5), and if there is more than one son (i.e. more than
one record in table JO where PredJO_No = this JO_No),
then assign PredGene = -1;
7) and from (6), find all the records in the JOIN table of
GeneGAInfo & GeneInfo & JO where PredJO_No = this
JO_No and largest OperSeq_No within each set of same
JO_No in GeneInfo, then assign SucGene = GeneCount
+1;
8) from (6), if there is only one son, then assign PredGene =
GeneCount;
9) and from (8), locate at the record in GeneGAInfo where
Gene_No = GeneCount, and assign its SucGene =
GeneCount + 1;
10) Assign this record SucGene =0.
MainJO_No MainJO_No in table JO where JO_No is the past in
WC_No
WC_No in table WC where WC_Code = WC_Code in
JO_Oper, and OperSeq_No = OperSeq_No of this Gene
(GeneInfo)
StartTime
EndTime
OperTime
{Qty (in JO where JO_No = JO_No past-in) * RunTime (in
JO_Oper where JO_No = JO_No past-in and OperSeq_No =
OperSeq_No of this Gene (GeneInfo))} + SetupTime (in
JO_Oper where JO_No = JO_No past-in and OperSeq_No =
OperSeq_No of this Gene (GeneInfo)
StorageCost StorageCost in table JO_Oper where JO_No = JO_No past-in
and OperSeq_No = OperSeq_No of this Gene (GeneInfo).
CapConsume CapacityCFactor in table JO_Oper where JO_No = JO_No
past-in and OperSeq_No = OperSeq_No of this Gene
(GeneInfo)
5) GeneCount +=1
6) Loop back to (2)
Call the GA_Core to start the GA calculation
- 47 -
(2) Evaluator
1) Get data to DataSet from DB for table :
GeneGAInfo,
MainJO (get DueTime, OverdueCost, store AccuEndtime),
WC (get Capacity Limits)
z Check the DataSet are not empty such that the calculation will not be invalid.
2) Get parameters from other programs :
objective weights (wt?),
3) Define parameters used internally :
-
Score of Chromosome (Score) to be past back and initialized as zero,
WC occupation array (WC[(WC_No, TimeRange)]) all initialized with
value=zero,
-
WC_No = DataSet.Tables(WC).Rows.Count and TimeRange = Greatest
DueTime (MaxDueTime) + 10*TimeUday ,
-
Total Make Span variables ( MinTime, MaxTime) in Time Unit initialized with
zero,
-
Number of Idle Periods (NumIdle) initialized as zero
-
Flag identifying Continuity of Occupation of Work Center (Cont) initialized as
False
-
Over Capacity Score variable (OverCapS) initialized as zero
-
Over Due Score variable (OverDueS) initialized as zero
-
Make Span Score variable (MakeSpanS) initialized as zero
-
Just-In-Time Score variable (JITS) initialized as zero
-
Total Score variable (TotalS) initialized as zero
4) Starting from the first gene of the chromosome to the last gene,
-
calculate the End Time (EndTime) :
if PredGene = 0, StartTime=Gene Value and EndTime=StartTime+OperTime
else if PredGene = -1 (means multiple predecessor), sort out from
GeneGAInfo that SucGene = Gene_No and find the one which has greatest
EndTime, then StartTime= EndTime of the found gene + Gene Value and
EndTime = StartTime + OperTime; JITS=EndTime of the found gene
((greatest EndTime) – EndTime of other genes)*StorageCost of the gene.
else find the EndTime of gene with Gene_No = PredGene, then StartTime =
EndTime of the found gene + Gene Value and EndTime = StartTime +
- 48 -
OperTime
-
Update MainJO :
if AccuEndTime < EndTime, then AccuEndtime = EndTime
where MainJO.MainJO_No = GeneGAInfo.MainJO_No
-
Update Capacity consumed by WC (WC[]) :
If
EndTime > TimeRange, reDim WC[] array and TimeRange = EndTime, then
For y=StartTime to EndTime, Update WC[WC_No,y] = WC[WC_No,y] +
GeneGAInfo.CapConsume
-
If StartTime < MinTime, MinTime = StartTime.
-
If EndTime > MaxTime, MaxTime = EndTime.
5) Calculate the scores of the chromosome :
-
Over Capacity : For x = 1 to WC.Rows.Count and for y = 1 to TimeRange, if
WC[x,y] – WC.Capacity > 0, OverCapS = OverCapS +
OTCost*(WC[x,y]-Capacity)
-
Main JO Over Due : For all records in MainJO, check if MainJO.AccuEndTime
> MainJO.DueTime, then OverDueS = OverDueS + OverDueCost *
(MainJO.AccuEndTime – MainJO.DueTime)
Else (MainJO.AccuEndTime < MainJO.DueTime) , JITS =
(MainJO.AccuEndTime – MainJO.DueTime) * StorageCost
-
Make Span : MakeSpanS = MaxTime – MinTime
-
Number of Idle Periods :
For critical Work Center(s),
Initialize Cont = No
For x = 1 to TimeRange,
if WC(WC_No,x) = 0
if Cont=No, then NumIdle = NumIdle+1 and Cont=Yes endif
else if WC(Wc_No,x) <> 0, then Cont = No
-
Calculate the Final Score : Final Score = OverCapS * WT_OC + OverDueS *
WT_OD + MakeSpanS * WT_MS + NumIdle*WT_ID + JITS*WT_JIT
- 49 -
(2) Result Assigner (Converter)
1) Connect to DataTable : GeneInfo
z Check the DataSet are not empty such that the calculation will not be invalid.
2) Get parameters from table Parameter :
objective weights (wt_??)
3) Define parameters used internally :
-
Score of Chromosome (Score) to be past back and initialized as zero,
WC occupation array (WC[(WC_No, TimeRange)]) all initialized with
value=zero,
-
WC_No = DataSet.Tables(WC).Rows.Count and TimeRange = Greatest
DueTime (MaxDueTime) + 10*TimeUday ,
-
Total Make Span variables ( MinTime, MaxTime) in Time Unit initialized with
zero,
-
Number of Idle Periods (NumIdle) initialized as zero
-
Flag identifying Continuity of Occupation of Work Center (Cont) initialized as
False
-
Over Capacity Score variable (OverCapS) initialized as zero
-
Over Due Score variable (OverDueS) initialized as zero
-
Make Span Score variable (MakeSpanS) initialized as zero
-
Just-In-Time Score variable (JITS) initialized as zero
-
Total Score variable (TotalS) initialized as zero
4) Starting from the first gene of the chromosome to the last gene,
-
calculate the End Time (EndTime) :
if PredGene = 0, StartTime=Gene Value and EndTime=StartTime+OperTime
else if PredGene = -1 (means multiple predecessor), sort out from
GeneGAInfo that SucGene = Gene_No and find the one which has greatest
EndTime, then StartTime= EndTime of the found gene + Gene Value and
EndTime = StartTime + OperTime; JITS=EndTime of the found gene
((greatest EndTime) – EndTime of other genes)*StorageCost of the gene.
else find the EndTime of gene with Gene_No = PredGene, then StartTime =
EndTime of the found gene + Gene Value and EndTime = StartTime +
OperTime
-
Convert the StartTime and EndTime to Date
-
Save the calculated StartDate and EndDate into GeneInfo
- 50 -
-
Update MainJO :
if AccuEndTime < EndTime, then AccuEndtime = EndTime
where MainJO.MainJO_No = GeneGAInfo.MainJO_No
-
Update Capacity consumed by WC (WC[]) :
If
EndTime > TimeRange, reDim WC[] array and TimeRange = EndTime, then
For y=StartTime to EndTime, Update WC[WC_No,y] = WC[WC_No,y] +
GeneGAInfo.CapConsume
-
If StartTime < MinTime, MinTime = StartTime.
-
If EndTime > MaxTime, MaxTime = EndTime.
5) Calculate the scores of the chromosome :
-
Over Capacity : For x = 1 to WC.Rows.Count and for y = 1 to TimeRange, if
WC[x,y] – WC.Capacity > 0, OverCapS = OverCapS +
OTCost*(WC[x,y]-Capacity)
-
Main JO Over Due : For all records in MainJO, check if MainJO.AccuEndTime
> MainJO.DueTime, then OverDueS = OverDueS + OverDueCost *
(MainJO.AccuEndTime – MainJO.DueTime)
Else (MainJO.AccuEndTime < MainJO.DueTime) , JITS =
(MainJO.AccuEndTime – MainJO.DueTime) * StorageCost
-
Make Span : MakeSpanS = MaxTime – MinTime
-
Number of Idle Periods :
For critical Work Center(s),
Initialize Cont = No
For x = 1 to TimeRange,
if WC(WC_No,x) = 0
if Cont=No, then NumIdle = NumIdle+1 and Cont=Yes endif
else if WC(Wc_No,x) <> 0, then Cont = No
-
Calculate the Final Score : Final Score = OverCapS * WT_OC + OverDueS *
WT_OD + MakeSpanS * WT_MS + NumIdle*WT_ID + JITS*WT_JIT
6) Save the scores into the DataTable : Parameter
7) Update the database tables of Parameter and GeneInfo.
8) Write to Log File for case :
-
those Main JO which DueTime is negative;
- 51 -
5.4 Interfaces Design
It is relatively simple in the design of interfaces flow of this program. Let us
illustrate the flow by diagram below :
First, a login interface is provided to allow the user input the ID and password.
ID : _______
Password : ________
Then a main menu is seen on which one can choose which sub-function is to be
called.
Sub-function 1
Sub-function 2
Sub-function 3
…..
For those sub-functions for Basic Information manipulation, a list of existing records
is to be shown, and searching function is provided, as well as an “ADD record”
function.
Add record
Record 1
Record 2
Record 3
……
Delete Button
Searching function
After selecting the record to be managed or to add new record, the detail information
screen is displayed, allowing the user to manipulate the information by using buttons
provided.
“Edit” Button
Detail info. 1 : _________
Detail info. 2 : _________
Detail info. 3 : _________
……
- 52 -
“Cancel” Button
The “Edit” Button is to tell the program the input or update process of data is finished
and confirmed, while the “Cancel” Button is to abort the process and back to previous
screen or menu.
For the relatively complicated Job orders input, the screen layout is designed as :
Edit and Delete
Operation Buttons
Operation of
the Parent Job
Parent Job Details
Add Operation
Button
Cancel
Button
List of
Sub-jobs
Edit Parent
Job Button
Add Sub-Job
Button
For execution function (e.g. AI schedule processing), the execution interface will be
displayed once it is chosen on the main menu, allowing the use input essential
information before the execution.
Parameter 1 :__
Parameter 2 :__
Start & Cancel
execution button
…
Finally, if the work in the system is finished, the user can properly logout the system,
and the original login screen will be shown again.
ID : _______
Password : ________
Apart from the general flow described above, the writer would like to highlight three
special interfaces used in the system. The main reason for these special interfaces is to
- 53 -
facilitate the user to acquire the information in a graphical mode. They are :
(1) Tree structure display of Job orders relationship and ;
(2) Gantt Chart display of schedule result.
(3) Calendar type of Date entries
(1) Tree Structure
Main job –
|__Sub-Job –
|
|__Sub-Job
|
|__Sub-Job
|
|
|__Sub-Job—
|__Sub-Job
|__Sub-Job
|__Sub-Job
|__Sub-Job
(2) Gantt Chart
Work
Centers
or Jobs
Time
(3) Calendar
Year
Sun. Mon.
1
2
Month
Tue.
3
Wed.
Thur. Fri.
….
- 54 -
Sat.
6
Implementation
6.1 Technical consideration
Because there already provided libraries (functions) to be used for basic GA
computation, that is, the basic GA engine is ready. In considering programming
language used in the project, 3 commonly used languages can be chosen, as the
libraries of GA mentioned can be called by them. They are Java, C# and VB.Net. And
for the sack of easier pick-up, VB.Net is selected, because the writer did not familiar
with any one of them before the project started.
Another important issue to be determined before start programming is that the system
should be Web-based or Windows-based. As the global trend is going toward the side
of Web-based application, the writer decided to have this system be put on the Web.
ASP.NET is used then in order to make it happen, accompanied with the use of
VB.NET.
For the data storage issue, Microsoft SQL server is used as the database engine in this
project. The main reason is that it is widely used in SME of Hong Kong. And it can
provide some basic database management facilities, e.g. security, data integrity,
user-friendly interface (as the writer is familiar with the management of MS SQL
server).
And more important, it is claimed in the technical document by Microsoft that using
SQL server connection, instead of other database engines, together with VB.NET
would have better performance. Actually the database adapter used in VB.NET for
SQL server is special and different from other database connection adapter.
Other database engines are not considered. For examples, Microsoft Access has
limitation in database size and fields definition. Oracle may be a little bit too
complicate and not so popular in Hong Kong SME.
- 55 -
6.2 Program Structure
Three tier system structure is used in the program implementation. They are
respectively :
- Presentation layer
- Business Logic layer (Application layer)
- Database Access layer
Presentation Layer
The Presentation layer is a Web layer, provides access for clients to the
application in a browser.
Business Logic Layer
The Business Logic layer, contains the implementation of the various
business rules and logic.
Data Access Layer
The Data Access layer provides data services to the Business Logic layer ,
and access the data from data source..
Presentation
Business
Data Access
Data Source
The main advantage of using this multi-tier architecture is that the application would
be more portable and flexible. Just modify the database name and password in the file
“web.config”, the application can be connected to another SQL server. And as the
Business Logic layer is basically separated from other layers, any modification of the
scheduling process logic can be flexibly done without great change in other layers.
The maintainability of the program is thus also more favorable.
- 56 -
6.3 Special programming issues highlight
In this section, the writer is going to discuss some special programming issues
during the program coding stage in this project. They are :
- Use of DataSet
- Graphical Representation of Tree structure for Job relation
- Graphical Gantt Chart Representation of Schedule
-
Searching features
Use of DataSet
In the programs of GA Evaluator (StartGA.vb) and GA Results Assigner
(AssignResult.vb), they need to frequently acquire information from the database
and write back temporary calculation results to the database in every cycle of
calculating scores for each chromosome in the population pool. If every times the
programs have to build the database connection and transfer data, this would
greatly decrease the performance of the program, as we know that system I/O
(access to hard disk) is usually the bottleneck of program execution.
In studying VB.NET, the writer found that the language provides a solution to
this issue – DataSet. The DataSet object is central to supporting disconnected,
distributed data scenarios with ADO.NET. The DataSet is a memory-resident
representation of data that provides a consistent relational programming model
regardless of the data source. In other words, the programs need to access the
memory (RAM), instead of the hard disk, in every access to the database data. It
is now only required to load the related tables once from the hard disk at the
beginning of the program and write the updated data back to the hard disk at the
end of the program.
Graphical Representation of Tree structure for Jobs relation
As mentioned in the System Design section, to provide a user-friendly
representation, a graphical representation of Tree view is done. It is actually
achieved by using VB.NET to write a recursive program. It begins with the
shared Sub() ShowJO, and it call the shared function ShowChildJO ,and keep
call ShowChildJO till no more sub-Job. These are included in JobOrders.vb file
in BusinessLogic folder. The screen capture below demonstrates the result.
- 57 -
Graphical Gantt Chart Representation of Schedule
Apart from presenting the schedule in table format, Gantt Chart view is also
provided by the system. It is achieved by calculating the width and position of
bars representing the jobs to html format, using VB.NET.
Two special features are implemented here :
(1) Gantt Chart by Work Center / Job Orders
(2) Color highlight for all operations of sub-jobs under a specified
Main Job
The screen captures in the following pages try to illustrate the features.
Searching Feature
In all the ‘first’ screens for going into Basic Information Management functions
(e.g. Item Data), a searching feature is provided by the system. It is useful when
the number of records increases to significant amount, such that the user cannot
view all the records in one screen. Two searching criteria are provided – the key
code or number and its description. The screen capture on the following pages
demonstrates this feature in the system :
- 58 -
6.4 GA parameters settings
As mentioned in section 4.6.(4), the writer has performed a small-scaled experiment
on the quality of the results of schedule with the GA parameters settings. The
experiment was done by executing the scheduling program with the same set of Job
orders, execution cycle, maximum allowed ‘relative’ time, and weightings of scores,
but varying the combination of values of the parameters : mutation probability,
population size, mating pool size, crossover probability.
The experiment result is summarized below :
Population
Size
Mating
Crossover
Pool Size Prob.
100
80
0.7
100
80
0.8
100
90
0.7
50
45
0.7
50
40
0.6
50
40
0.7
50
40
0.8
40
36
0.7
40
32
0.7
40
28
0.7
60
54
0.7
60
54
0.7
60
48
0.7
25
20
0.7
No. of Cycles = 300
No. of job operations = 14
Max. allowed ‘relative’ time = 150
Mutation OverDue OverCap JIT
Prob.
Cost
Cost
Cost
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
100
90
130
50
290
80
200
70
40
30
170
300
50
280
418
434
386
306
413
364
394
543
237
307
846
754
409
679
Best
Total
Score
5330
5386
5305
3707
7174
4587
6083
6278
2917
3518
10305
10689
4740
9733
It should be admitted that the experiment was quite small in scale and may not reflect
the real picture, but for those cases which gave extreme results, e.g. total score above
10,000 and below 4,000 , the writer has repeated the testing and took the average
values. So, the table of results still has its value of reference in the project.
Highlighted in the table the combination (40, 32, 0.7, 0.1), it gave the lowest total
score (2917), meaning that its result has best quality among the combination tested in
the experiment. And it is used by the writer in the program for the evaluation part of
the project.
- 59 -
7
System Evaluation
7.1 Evaluation Plan
It is really not easy to evaluate an application system because it can be graded from
different criteria or different points of view, e.g. accuracy, user-friendliness,
performance, functionality, flexibility, extensibility, maintainability….. And even
worse is that some of the criteria is subjective in nature, e.g. functionality and
user-friendliness.
Therefore, the writer would limit the evaluation criteria to those listed below, not
hoping to include all, but put effort on what the writer thinks most important.
(1) Feasibility of result
(2) Quality of result, in terms of Over-Due Time and Operation Slack Time
(3) Repeatability of result generation / Performance of the scheduling engine
(4) Time required to obtain quality result
The criteria are used because the objective of the project is to generate a production
schedule for a set of jobs / operations on a set of manufacturing resources, and they
are usually what a real world planner doubts about a scheduling software.
To have a bench mark reference, a commercial scheduling system – Preactor is used
(its evaluation version 9.0). The 2 theories of scheduling of this package have been
introduced in the section 2.1 already. And the writer will use its “algorithmic
sequencing” method – a more popular method (because it is much more economic and
affordable to the SME of Hong Kong) – in the comparison with the program of this
project.
For the sample data used in the evaluation, five main job orders, with 14 operations
are used, from MJ-01 to MJ-05. The details about them is listed on the next page :
- 60 -
Level
Job No.
Main
Job No. Item No.
Main Job
Due Date
0
MJ-01
MJ-01
Product-01
10
2003/1/11 MJ-01
OP03
WC03
3
1
.1
SJ-01
MJ-01
COMPONENT-01
10
MJ-01
OP02
WC02
2
2
..2
SJ-011
MJ-01
COMPONENT-02
10
SJ-01
OP01
WC01
3
5
.1
SJ-02
MJ-01
COMPONENT-03
10
MJ-01
OP04
WC04
3
3
..2
SJ-021
MJ-01
COMPONENT-05
10
SJ-02
OP05
WC05
1
1
..2
SJ-022
MJ-01
COMPONENT-04
20
SJ-02
OP06
WC06
2
2
0
MJ-02
MJ-02
Product-02
10
2003/1/9 MJ-02
OP05
WC05
2
2
.1
SJ-02-1
MJ-02
COMPONENT-04
10
MJ-02
OP06
WC06
3
2
0
MJ-03
MJ-03
Product-03
10
2003/1/4 MJ-03
OP03
WC03
1
1
.1
SJ-03-1
MJ-03
COMPONENT-05
10
MJ-03
OP04
WC04
1
1
0
MJ-04
MJ-04
Product A
10
2003/1/6 MJ-04
OP03
WC03
1
1
.1
SJ-04-1
MJ-04
COMPONENT-04
10
MJ-04
OP04
WC04
1
1
0
MJ-05
MJ-05
Product A
10
2003/1/15 MJ-05
OP03
WC03
1
1
.1
SJ-05-1
MJ-05
COMPONENT-04
10
MJ-05
OP04
WC04
1
1
Quantity
Time Unit per day = 10 or 10 hours per day
Schedule Start Date = 1st of Jan
- 61 -
Precessor
Work Setup
Operation Center Time
Run
Time
7.2 Evaluation Results Analysis
(1) Feasibility
A sub-set of the sample job orders is used in this part because it will be too difficult to
observe the result if too many operations are considered. In this part, only two main
job orders are considered, MJ-01 and MJ-02, they have totally 8 operations.
The result generated by the AI scheduling system (this project) and that generated by
Preactor (using backward scheduling & prioritize by order Due Date) can be seen in
the following pages.
Table of comparison of results :
Criteria
Number of operations scheduled
Number of Over-Due Main Job
Number of Over-Capacity
AI scheduling
8
Nil
Nil
Preactor
6
Nil
Nil
It is very obvious that the outcome from Preactor is not feasible because there are still
2 operations not been allocated. The reason for that is Preactor, under the algorithm
sequencing method, allocate all the operations of the MJ-02 (with earlier Due Date)
first, which occupies the Work Center WC05 and WC06. When MJ-01 is scheduled,
the operations of sub-jobs SJ-021 and SJ-022 which are also going to use the Work
Center WC05 and WC06 respectively have to be allocated with start date beyond the
schedule start date (1st Jan). This violates the Preactor’s scheduling process, so the
two operations are not allocated.
By the AI Scheduling system, one can note that the engine can start the operations
SJ-021 and SJ-022 earlier and make room for the operations of MJ-02, such that the
due date of both main jobs can be met and no infeasible (operation started before the
schedule date) solution will be generated.
In short, compared with Preactor, the AI Scheduling system is more likely giving
feasible solution, just thinking that the case will be worse if the example is made more
complicate with more operations.
As a special remark here, we can make use another more advance mode (APS mode)
of Preactor to generate a schedule for MJ-01 and MJ-02. But the result is still not
satisfactory :
- 62 -
Criteria
Number of operations scheduled
Number of Over-Due Main Job
Number of Over-Capacity
AI scheduling
8
Nil
Nil
Preactor
8
1
Nil
This time all operations are allocated, but with the main Job MJ-01 Over-Due ! See
the screen capture follows.
- 63 -
(2) Quality of Result
In order to avoid any further infeasible solution generated by Preactor, making the
comparison become meaningless, the APS mode is used in this section.
Main Job
Orders
Over-Due Time (in day)
Slack Time between operations
by Work Center (in day)
AI scheduling
Preactor
System
AI scheduling
System
Preactor
0.1
7.6
11.7
9.34
0
7.6
9.6
5.34
0
7.6
11.7
14.41
0
7.6
0.6
1.07
0
0
-
-
MJ-01,03,04,05
0
0
8.9
5.53
MJ-01,03,04
0
0
7.1
8.03
MJ-01,03
0
0
11.1
10.6
Average
0.0125
3.8
9.87
7.76
MJ-01 to
MJ-05
MJ-01 to
MJ-04
MJ-01 to
MJ-03
MJ-01 to
MJ-02
MJ-01
Although the sample size is not large, the result does clearly show the difference.
Over-Due performance is much better by using AI Scheduling system (304%), while
for the Slack Time performance , Preactor performs better (78%).
- 64 -
(3) Repeatability
It is also important that same result should be generated by a scheduling system every
time it is executed with the same set of input, because this will give confidence to the
user that the result will not vary time from time and the system is reliable. The writer
has performed an simple experiment on the AI Scheduling System, by executing the
scheduling process repeatedly with different values of GA cycles. And only Main Job
MJ-01 is used. The following table shows the result of the experiment.
No. of
Cycles
300
400
800
Execution
Total Scores
duration (sec.) (Result 1)
48
130
49
274
48
200
49
129
64
109
63
193
65
88
64
211
127
88
129
109
128
109
127
88
Total Scores
(Result 2)
150
284
220
149
109
213
108
231
109
129
129
108
Total Scores Range of Total
(Result 3) Scores (Result 1)
160
294
145
230
150
129
213
123
109
231
109
129
21
129
109
Actually, comparison of the total scores of various executions is an indirect way to
estimate the result repeatability of scheduling engine. It is clear from the above result
that the more the number of cycles the engine runs, the smaller the range will be
obtained, i.e. it will become more repeatable.
On this issue, Preactor performs far better. It is because it is basically a rule-based
scheduler. The operations are allocated by exactly the same rules each time. There
will be no different result generated by Preactor no matter how many times the set of
jobs are repeatedly scheduled.
It can be concluded that “repeatability” is a major drawback of using AI Scheduling
engine. The only resort would be using longer execution time, which can be deduced
from the analysis result above. It is easy to understand as GA itself requires the stage
of convergence of results, as described in the section of introduction of GA.
- 65 -
(4) Time required
Below summarizes the time taken to generate the results in (2) above, by the AI
Scheduling engine :
Main Job
Orders
MJ-01 to
MJ-05
MJ-01 to
MJ-04
MJ-01 to
MJ-03
MJ-01 to
MJ-02
MJ-01
Average
Time
taken
(sec.)
181
169
156
142
122
154
As a conclusion from the result, the engine only took about 2 - 3 minutes to generate
an acceptable result (as discussed in (2) above). The time performance of the system
is acceptable. But of course, compared with Preactor, it is much longer, as Preactor
only took a second to generate the results. In this sense, Preactor performs better than
the GA engine.
- 66 -
8
Conclusion
8.1 About the Project Aims
In fact, at the end of the project, a workable scheduling program has been produced,
using an academic methodology – Genetic Algorithms – as the core engine. Although
the discussion in the last section has shown that the program (or GA) has drawbacks
like lack of repeatability and comparatively worse time performance, it performs its
power of generating feasible schedule and higher quality results, it did show its
“intelligence”.
Capacity constraint and jobs precedence relationship have been proven to be
successfully considered by the GA engine. There is basically no violation of them in
nearly all the examples quoted in this report. Meanwhile, the program provides the
flexibility of releasing the capacity constraint (lower the “Delay Cost” of the Main
Job), the trade-off is the “Over-Capacity Cost” of the related Work Center.
In addition, other objective functions can be designed to guide the GA engine to
generate a practically sensible schedule. The example in this project is the
Just-In-Time criteria which leads to a result of less Work-In-Progress level. The other
example is the “Number of Idle period” of Critical Work Center. It is basically coming
from one of the popular production management concept – Theory of Constraint
(TOC), which stresses that a critical work center must be scheduled with jobs such
that its utilization rate can be as high as possible.
To conclude, GA has proved itself a promising algorithm to successfully solve the
jobs shop scheduling problem. Actually, the writer has read some papers [18,19] about
the practical use of GA (or Evolutionary Algorithms) in the real world environment.
One [18] claimed that the scheduling system should be integrated with Plant Data
Acquisition system so that the update of the schedule can be promptly spread out to
all the Work Centers concerned. This would then greatly improve the possibility of
the commercialization of GA (EA) use in scheduling field.
Another interesting sociological issue was suggested [19] that the key is to give
confidence to the company management by generating schedules “similar” to those
produced by hand at the company. This can be done by adjusting the values of the
parameters used by GA. At the end, an “intelligent” system is required to prove its
reliability and stability to the commercial world.
- 67 -
8.2 Further Developments
Rooms for further developments of this project are so many that it cannot be listed
completely. The writer just tries to summarize those are important below.
(1) Alternative Work Centers
This is very useful in the real world environment. An operation is now limited to be
done on a pre-defined resource. However, it is always case that the operation can also
be done on another resource, but with different conditions, e.g. different setup time
and run time. If this issue is considered, the software should be able to suggest a more
practical schedule, with the suggestion of which Work Center the operation should be
placed on.
(2) Materials consideration
Now in this project, only the production resources constraints are considered, however,
the supply of materials is not taken into account. In real world, an operation cannot be
started if the required materials have not been received and ready to use. Purchasing
activity is needed to be considered at the same time.
(3) Order splitting
There would be case that in order to meet the deadline of delivery, more than one
resources will be used for a job in parallel. This may shorten the whole Make Span of
an order but may induce cost.
(4) Setup time saving
It can consider the sequence of jobs / operations on a resource so that there is the
possibility of saving the setup time. This may happen if the jobs / operations are very
similar in nature, or even exactly the same.
(5) Operations locking
Facility should be provided such that some of the operations released in the last
schedule can be kept and locked. It is necessary because it is not possible or economic
to stop those running operations. And usually scheduling is a continuous process
- 68 -
which need to take into consideration of last released schedule.
(6) Resource working calendar
There is an assumption that the schedule is on a continuous calendar in this project, i.e.
no holiday or resource down time. A working calendar for each of the resources
should be considered.
(7) Secondary Capacity Constraint of Resources
More than one Capacity Constraint can be considered, e.g. tooling availability, labor
availability…, for a Work Center in the scheduling process.
(8) Reports or Documents printout
Resource Utilization Report, Detailed Job Order Schedule List,… should be provided
also by the system.
- 69 -
8.3 What has been learnt !
This project has provided the writer a chance to realize how Artificial Intelligence be
used to solve a practical problem, and its power and limitations. Modeling of the
problem is the most difficult part, which affect very much the outcome of the project.
Besides, through actually coding by VB.NET, the writer totally understand the
benefits of using Object-Oriented approach to construct a program. (The writer has
written procedural programs quite a long time ago.) Although the initial design stage
may be longer, the development time will be saved much, as OOP has the concept of
inheritance.
More than that, in this project, the writer has done the planning well for the
programming. A detailed process specification was prepared before actual coding.
This made the programming smoother than expected.
At the end, the writer would like to thank again for the advice and assistance given by
Dr. Andy Chun during the period of the development of the project.
Thank you !
- 70 -
9
References
1) Stuart Russell, Peter Norvig. Artificial Intelligence – A Modern Approach
2) Practical Handbook of Genetic Algorithms Vol. 1
3) Preactor User’s Guide. The CIMulation Centre Ltd. 1998
4) Hartmut Stadtler, Chrisoph Kilger. Supply Chain Management and Advanced
Planning
5) Andy Chun Hon Wai. Introduction to GA Programming
6) Emma Hart, Peter Ross. A systematic investigation of GA performance on jobshop
scheduling problems.
7) Matthaw Bartschi Wall. A Genetic Algorithm for Resource-Constrained
Scheduling, 1996
8) Shigenobu, Isao, Masayuki. An efficient Genetic Algorithm for Job Shop
Scheduling Problems
9) Y. Song, JG. Hughes, N. Azarmi, C.Voudouris. A Genetic Algorithm with an
incomplete representation for the Job Shop Scheduling Problems
10) Philip Husbands. Genetic Algorithms for Scheduling
11) Y.Li, KF. Man, KS. Tang, S.Kwong and WH. Ip. Genetic Algorithm to production
planning and scheduling problems for manufacturing systems
12) Burhaneddin Sandikci. Genetic Algorithms
13) SG. Ponnambalam, V.Ramkumar and N.Jawahar. A multi-objective genetic
algorithm for job shop scheduling
14) Ilog Optimization Suite White Paper, 2001
15) PB. Nagendra and SK. Das. Finite Capacity scheduling method for MRP with lot
size restrictions, 2001
16) U.Al-Turki, C. Fedjki and A.Andijani. Tabu search for a class of single machine
scheduling problems, 2001
17) Philip Husbands and Frank Mill. Scheduling with Genetic Algorithms
18) J.Kaschel, Tobias Teich, Bernd Zacher. Real-time dynamic shop floor scheduling
using Evolutionary Algorithms, 2000
19) Emma Hart, Peter Ross, Jeremy A.D Nelson. Scheduling Chicken Catching – An
Investigation into the Success of a Genetic Algorithm on a Real World Scheduling
Problem, 1999.
- 71 -
10
Appendix
10. 1 Project Plan
Period
Task Description
Milestone
July-Aug Learn the basic concept of GA
Aug
Prepare the Interim report
Aug
Confirm the project scope and project details
Sept
Pick up VB.NET programming language
Sept
Try to call / use the GA libraries with simple programs
Sept
Design and build the database structure for the system of the
project
Sept
Design the Interfaces and flow of the system
Oct
Build the interface to accept external data and put them into the
database
Oct
Confirmation of modeling the problem of the project into GA
Nov
Programming for the transformation of the external data to GA
parameters
Nov
Programming for the transformation of the outcome of GA to
user interface
Nov
Performance Analysis of the system
Dec
System Fine Tune
Dec
Prepare the Final report
Dec
Prepare for the representation
- 72 -
16-Aug-02
23-Aug-02
31-Aug-02
30-Sept-02
30-Sept-02
30-Sept-02
30-Sept-02
21-Oct-02
21-Oct-02
15-Nov-02
20-Nov-02
25-Nov-02
25-Dec-02
25-Dec-02
28-Dec-02
10. 2 Database Full Listing
Table : JO
To store the user input information about Job Orders.
Key Field Name
PK JO_No
MainJO_No
FK Item_No
Qty
DueDate
Active
Data Type
varchar
varchar
varchar
decimal
datetime
int
Length
12
12
20
9
8
4
DelayCost
decimal
9
PredJO_No
varchar
12
Null Default Description
N
Job Order Number
N
Related Main JO No.
N
Job Finished Item No.
N
Quantity
Y
Due Date of the Main JO
N
1
Active =1, Non-Active
=0
Y
Cost for delay per time
unit.
N
Predecessor JO No.
Table : JO_Oper
To store the Operations (Routing) required to complete the Job Order.
Key Field Name
PK JO_No
PK OperSeq_No
FK
FK
Data Type Length Null Default Description
varchar
12
N
Job Order No.
int
4
N
Sequence No. of
Operations to complete
the Job.
OperCode
varchar
6
N
Operation Code
WC_Code
varchar
6
N
Work Center Code to
be occupied by the
operation.
SetupTime
int
4
N
0
Setup Time in Time
Unit
RunTime
Int
4
N
Time (in Time Unit)
used to process one
unit of item.
StorageCost
Decimal 9
N
0
Storage Cost of the
Item per Time Unit
finished by this
operation
CapacityCFactor Decimal 9
N
1
Consumption Factor of
Capacity of the Work
Center for the
operation for whole
operation.
- 73 -
Table : Oper_WC
To store the information about Operation.
Key Field Name
PK OperCode
OperDes
Data Type
varchar
Varchar
PK
WC_Code
varchar
SetupTime
int
RunTime
Decimal
StorageCost
Decimal
CapacityCFactor Decimal
Length Null Default Description
6
N
Operation Code
30
Y
Operation
Description
6
N
Work Center Code to
be occupied by the
operation.
4
N
0
Setup Time in Time
Unit
9
N
Time (in Time Unit)
used to process one
unit of item.
9
N
0
Storage Cost of the
Item per Time Unit
finished by this
operation
9
N
1
Consumption Factor
of Capacity of the
Work Center for the
operation for whole
operation.
Table : WC
To store the basic information about Work Centers used in the system.
Key Field Name
PK WC_Code
WC_No
Data Type Length Null Default Description
varchar
6
N
Work Center Code
int
4
Y
Work Center
Number; used for
WC_Description varchar
30
Y
Description
OT_Cost
decimal
9
Y
Cost for Over-Time
(Over-loading) Cost
per Time Unit per
Capacity Unit.
Capacity
int
4
N
Capacity of the Work
Center per Time
Unit.
Critical
Varchar
1
N
0
Identify Critical
Work Center; If yes,
=1; if no, =0
- 74 -
Table : Item
To store the basic information about Item to be processed in the manufacturing
operation.
Key Field Name Data Type Length Null Default Description
PK Item_No
varchar
20
N
Item No.
ItemDes
varchar
50
Y
Item Description
Table : Parameter
To store the parameters used in the GA scheduling, and the scores breakdown of the
best 3 results.
Key Field Name Data Type Length Null Default Description
PK VKey
Int
4
N
Virual Primary Key for
DB update purpose only,
no actual meaning.
WT_OC
decimal
9
N
0
Weighting for Over
Capacity of Work Center
WT_OD
decimal
9
N
0
Weighting for Over Due
of Job Order.
WT_MS
decimal
9
N
0
Weighting for Make Span
of all Job Order.
WT_ID
decimal
9
N
0
Weighting for Number of
Idle Periods of Critical
Work Center.
WT_JIT
decimal
9
N
0
Weighting for Degree of
JIT of Operation
Arrangement.
TimeUday int
4
N
24
The basic conversion
factor of system Time
Unit per day.
TotalScore_1 decimal
9
N
Store the total score of
result 1.
TotalScore_2 decimal
9
N
Store the total score of
result 2.
TotalScore_3 decimal
9
N
Store the total score of
result 3.
OCScore_1 decimal
9
N
Store the Over-Capacity
score of result 1.
ODScore_1 decimal
9
N
Store the Over-Due score
for result 1
MS_1
decimal
9
N
Store the Make Span
score for result 1
IDScore_1
decimal
9
N
Store the Idle period
score of result 1
- 75 -
JITScore_1
decimal
9
N
Store the JIT score of
result 1
Store the Over-Capacity
score of result 2
Store the Over-Due score
for result 2
Store the Make Span
score for result 1
Store the Idle period
score of result 2
Store the JIT score of
result 2
Store the Over-Capacity
score of result 3
Store the Over-Due score
for result 3
Store the Make Span
score for result 1
Store the Idle period
score of result 3
Store the JIT score of
result 3
Scheduling Log Number
OCScore_2
decimal
9
N
ODScore_2
decimal
9
N
MS_2
decimal
9
N
IDScore_2
decimal
9
N
JITScore_2
decimal
9
N
OCScore_3
decimal
9
N
ODScore_3
decimal
9
N
MS_3
decimal
9
N
IDScore_3
decimal
9
N
JITScore_3
decimal
9
N
Log_No
Integer
4
Y
Data Type
nvarchar
nvarchar
nvarchar
Length
20
50
12
Null Default Description
N
User ID
N
User name
N
Password to login
Table : Users
Key Field Name
PK ID
Name
Password
Table : GeneGAInfo
(Temporary DataSet)
To store the basic information of each gene used in the GA evaluator.
Key Field Name
PK Gene_No
PredGene
SucGene
MainJO_No
WC_No
StartTime
Data Type
int
int
int
varchar
int
Length
4
4
4
12
4
Null Default
N
N
0
N
0
N
N
int
4
Y
- 76 -
0
Description
Gene ID
Predecessor gene id
Successor gene id
Main job belonged to
Work Center used by
the corresponding
operation
To be found by GA
Core.
EndTime
int
4
Y
0
OperTime
StorageCost
int
Decimal
4
9
Y
N
0
CapConsume Decimal
9
N
0
To be found by GA
Core.
Calculated
Storage Cost of the Item
per Time Unit. [from
Oper_WC Table]
Capacity Consumption
Ratio by this operation.
Table : GeneInfo
(Database Table)
To store initially the gene information from the conversion of user input data into
gene representation (relation of gene with Job Order and Operation), and also keep the
final result of the GA to facilitate output to user interface.
Key Field Name
PK Gene_No
JO_No
Data Type Length Null Default Description
int
4
N
Gene id
varchar 12
N
Job Order Number from
GeneConverter
MainJO_No varchar 12
N
Main Job Order number belonged
to, generated from GeneConverter
OperSeq_No int
4
N
Sequence No. of Operations to
complete the Job, generated from
GeneConverter.
OperCode
varchar 6
N
Operation Code, from
GeneConverter.
WC_Code
varchar 6
N
Work Center occupied, from
GeneConverter.
StartDate_1 datetime 8
Y
Result
EndDate_1 datetime 8
Y
Result
StartTime_1 Decimal 9
Y
Result
EndTime_1 Decimal 9
Y
Result
StartDate_2 datetime 8
Y
Result
EndDate_2 datetime 8
Y
Result
StartTime_2 Decimal 9
Y
Result
EndTime_2 Decimal 9
Y
Result
StartDate_3
EndDate_3
StartTime_3
EndTime_3
datetime
datetime
Decimal
Decimal
8
8
9
9
Y
Y
Y
Y
Result
Result
Result
Result
- 77 -
Table : MainJO
(Temporary DataSet)
To store temporarily the result of GA evaluator for the comparison of end time and
due time for the Main Job Order.
Key Field Name
PK MainJO_No
DueTime
Data Type Length Null Default Description
varchar
12
N
Main job no.
int
4
N
Main job due time
calculated
Accu_EndTime int
4
N
To store temporarily
the end time of the
main job
Overdue_Cost
decimal
9
N
To store the main job
overdue cost or
penalty cost
StorageCost
Decimal
9
N
Storage cost of
storing the Final
Product.
- 78 -
10.3 Installation Guide
The following is only a brief guideline of installation of this Web-Based application. It
assumes that the reader has fundamental knowledge of IIS and MS SQL server.
Pre-requisite
Following software must be successfully installed beforehand :
- Microsoft Windows 2000 or above
- Internet Information Services (IIS) has been setup
- Microsoft SQL server 7.0 or above
Installation steps
(1) Copy from the CD-R the folder “AISchedule” and files in the folder to the path :
Drive :\Inetpub\wwwroot
Disable the “Read Only” property of all the copied files
(2) Start MS SQL server Enterprise Manager and create a new database. Write down
the database name as it will be used in step (5) below.
(3) If you want to restore the sample data used in the evaluation part of this project,
you can restore the database directly (if so, the SQL server version must be 2000
or above) from the backup file named “AI_DB_Backup”, stored under the folder
Database.
(4) If you want to create a blank database, you can execute the sql script
“AI_Create_Tables” in SQL server Query Analyzer. The script file is also stored
under the folder Database.
(5) Edit the file (by Notepad maybe) web.config under the directory AISchedule just
copied, modify the corresponding information in Italic form below :
<appSettings>
<add key="ConnectionString" value="Data Source=localhost;
Initial Catalog= Database name ;
uid= Database User ID;
pwd= Database User Password"/>
</appSettings>
- 79 -
(6) Start the IIS Manager and locate at the sub-folder “AISchedule” under Default
Web Site folder, right click and choose to open the Property page. On the new
Windows come up, locate at the tab-page “Directory” and note the area
“Application Program Settings” at the lower part of the Windows. Click the
“Create” button and the field “Application name” will now be filled by
“AISchedule”. Click confirm to leave the Windows and close the IIS Manager.
(7) Carefully check the access right to the folder “AISchedule” and you may start
Internet Explorer and type “//localhost/aischedule” at the address field.
(8) The system login screen should be seen and the user ID will be defaulted “Admin”.
If you restore the sample data, you may now login with password “123”. If you
create a blank database, you can now create a new user for yourself by clicking at
the link “Create New User”.
(9) If you are using a blank database, and you have login the system. You should build
up your own set of data in the following sequence :
- Item Master
-
Work Center Master
Operation Master
Job Order Information
Parameter
(10) After then, you can try to execute the AI Scheduling process by inputting
necessary parameters.
- 80 -
10.5 Test Plan - Functional
Below is a part of the Testing Plan used.
Test Item
User Management
Create new user
User the newly created user to login the
system
Edit the user’s password and re-login
Try wrong password to login
User Logout link to logout the system
Item Master Management
Add new item with description
Add new item without entering Item No.
Add existing Item
Edit Item
Delete an existing Item
Search by Item No
Search by Description
Search by combination of Item No and
Description
To show all record
Expected Result
Pass Error Found
Add record to
Y
table : User
Successfully login Y
to the main menu
of the system
Successfully login Y
Login failure
Y
Successfully logout Y
Successfully added
to the table Item
Error message
prompted and not
allowed to write to
table
Error message
prompted and not
allowed to write to
table
Save change to the
table
Successfully
deleted from table
Show only records
of item satisfying
the searching
criteria
Show only records
of item satisfying
the searching
criteria
Show only records
of item satisfying
the searching
criteria
Show all existing
records
Work Center Management
Add new Work Center
Y
Y
Y
Y
Y
Y
Y
Y
Y
Successfully added Y
to the table : WC
Add new Work Center without Work Center Error prompted and Y
Code
no record is added
Add existing Work Center
Error prompted and Y
- 81 -
no record is added
Error prompted and Y
no record is added
Error prompted and Y
no record is added
Save change to the Y
table
Successfully
Y
deleted from table
Show only records Y
of Work Center
satisfying the
searching criteria
Show only records Y
of Work Center
satisfying the
searching criteria
Show only records Y
of Work Center
satisfying the
searching criteria
Show all existing Y
records
Add character to field “OT Cost”
Add character to field “Capacity”
Edit Work Center
Delete an existing Work Center
Search by Work Center Code
Search by Description
Search by combination of Work Center
Code and Description
To show all record
Operation Management
Add new Operation
Add new Operation without Operation
Code
Add new Operation without Work Center
Code
Add existing Operaiton & Work Center
combination
Add non-exist Operation & Work Center
combination, with existing Operation
Add character to field “Setup Timet”
Add character to field “Run Time”
Add character to field “Storage Cost”
Add character to field “CapacityCFactor”
Edit Operation
Delete an existing Operation
Search by Operation Code
Successfully added Y
to the table :
Oper_WC
Error prompted and Y
no record is added
Error prompted and Y
no record is added
Error prompted and Y
no record is added
Successfully added Y
(Combined Keys)
Error prompted and Y
no record is added
Error prompted and Y
no record is added
Error prompted and Y
no record is added
Error prompted and Y
no record is added
Save change to the Y
table
Successfully
Y
deleted from table
Show only records Y
of Operation
- 82 -
satisfying the
searching criteria
Search by Description
Show only records Y
of Operation
satisfying the
searching criteria
Search by combination of Operation Code Show only records Y
and Description
of Operation
satisfying the
searching criteria
To show all record
Show all existing Y
records
- 83 -
Download