simulation of genetic algorithm scheduling on extendsim...

5
Abstract—In the study of production scheduling problem, sometimes it is necessary to verify the result of the research by the simulation. ExtendSim, powerful system simulation software, can access code created in varieties of programing languages using its built-in APIs. However there is almost no relevant research literature in data interaction between ExtendSim and C#. This Paper presents a method that uses COM technology to complete it. At first, A COM interface is established on C#.Net platform. Then a simulation environment is founded in the ExtendSim. By calling the interface, ExtendSim achieves data interaction with C#.Net. What’s more, this paper verifies the feasibility and effectiveness of the technology through an instance that genetic algorithm solves production scheduling problem, which adds a new solution for the simulation of the production scheduling problem. Keywords—Production scheduling; COM technology; Genetic algorithm; ExtendSim; C#.Net I. INTRODUCTION N the last few decades, production scheduling has been a hot spot of the scholars’ research. It is proved theoretically that the problem of the scheduling is a NP-hard problem when its scale is very large. Genetic algorithm (GA) has been widely used in many fields in recent years because of its easy-to-use, strong robustness, approximate optimum and implicit parallelism. It also shows a great advantage in solving the production scheduling problem. In addition, the simulation of the research result can verify its correctness and rationality. So it is also indispensable to study the simulation technology. Nowadays lots of software can be used to simulate the production scheduling, such as ExtendSim, Flexsim, Em-Plan and Arena etc. But ExtendSim has many features which are ease of use, interactivity, module-level open-source, cost-effective and so on. It can be used in the field of manufacturing, logistics, finance, Manuscript received May, 2012. This work is supported by the National Science and Technology Major Project of the Ministry of Science and Technology of China under Grant 2011ZX02601-005. Zhang Shi Shan is with the Shenyang Institute of Automation, Chinese Academy of Sciences Shenyang, Nanta Street 114#, Shenyang, China 110016; and Graduate School of the Chinese Academy of Sciences, Beijing, China, 100049; (corresponding author to provide phone: 024-83601301; e-mail: [email protected]). Peng Hui, a master instructor, graduated from the department of the Dalian University of Technology, Dalian, Liaoning, China. He now works in the Shenyang institute of automation Chinese academic of science. (e-mail: [email protected]). Liu Chang, a doctorate recipient, is now with the Shenyang institute of automation Chinese academic of science. (e-mail: [email protected]). Yao Li Li is a PH.D in the Shenyang institute of automation Chinese academic of science. (e-mail: [email protected]). transportation, military and others, and support continuous modeling, discrete event modeling, discrete-rate modeling as well as 2D and 3D simulation. What’s more, it can achieve dynamic code join with Delphi, C++ Builder, Visual basic and Visual C++. When the C#.Net platform is widely used, it is necessary to provide a way to achieve data interaction between C#.Net and ExtendSim, which will make the simulation completed in more occasions. II. COM TECHNOLOGY The so-called COM (Component Object Model) is a standard to describe how to create a dynamic exchange component. Its main feature is to communicate between any two components (or between component and customer) follow this specification, without considering whether they are in the same operating environment or not, whether they use the same development language or not, whether they run on the same computer or not. The three basic concepts in COM are COM component, COM objects and COM interface. COM component can contain one or more COM components. In other words, COM component is the carrier of COM object. COM object is an instance of the COM class, is the entity of interaction between the client and the component. Every COM object contains one or more interfaces. COM interface is a data structure that contains a set of functions. Customers can call component function object through the data structure. The relationship among COM component, COM object and COM interface is shown in Fig. 1. According to the COM specification, COM object and COM interface must only be identified. Both use globally unique identifier (GUID) to identify. The object identifier is called the CLSID (Class Identifier). And the interface identifier is called the IID (Interface Identifier). When a customer uses a COM object, it creates a COM object at first by through the CLSID. Then it gets an interface pointer of the Simulation of Genetic Algorithm Scheduling on ExtendSim Based on COM Technology Zhang Shi Shan, Peng Hui, Liu Chang, Yao Li Li I Fig. 1 Relationship among COM component, COM object and COM interface Proceedings of 2012 International Conference on Modelling, Identification and Control, Wuhan, China, June 24-26, 2012 300

Upload: others

Post on 20-Apr-2020

24 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Simulation of Genetic Algorithm Scheduling on ExtendSim ...ir.sia.ac.cn/bitstream/173321/10119/2/Simulation of genetic algorith… · ExtendSim, the upgraded version of Extend 6,

Abstract—In the study of production scheduling problem, sometimes it is necessary to verify the result of the research by the simulation. ExtendSim, powerful system simulation software, can access code created in varieties of programing languages using its built-in APIs. However there is almost no relevant research literature in data interaction between ExtendSim and C#. This Paper presents a method that uses COM technology to complete it. At first, A COM interface is established on C#.Net platform. Then a simulation environment is founded in the ExtendSim. By calling the interface, ExtendSim achieves data interaction with C#.Net. What’s more, this paper verifies the feasibility and effectiveness of the technology through an instance that genetic algorithm solves production scheduling problem, which adds a new solution for the simulation of the production scheduling problem.

Keywords—Production scheduling; COM technology; Genetic algorithm; ExtendSim; C#.Net

I. INTRODUCTION

N the last few decades, production scheduling has been a hot spot of the scholars’ research. It is proved theoretically

that the problem of the scheduling is a NP-hard problem when its scale is very large. Genetic algorithm (GA) has been widely used in many fields in recent years because of its easy-to-use, strong robustness, approximate optimum and implicit parallelism. It also shows a great advantage in solving the production scheduling problem.

In addition, the simulation of the research result can verify its correctness and rationality. So it is also indispensable to study the simulation technology. Nowadays lots of software can be used to simulate the production scheduling, such as ExtendSim, Flexsim, Em-Plan and Arena etc. But ExtendSim has many features which are ease of use, interactivity, module-level open-source, cost-effective and so on. It can be used in the field of manufacturing, logistics, finance,

Manuscript received May, 2012. This work is supported by the National

Science and Technology Major Project of the Ministry of Science and Technology of China under Grant 2011ZX02601-005.

Zhang Shi Shan is with the Shenyang Institute of Automation, Chinese Academy of Sciences Shenyang, Nanta Street 114#, Shenyang, China 110016; and Graduate School of the Chinese Academy of Sciences, Beijing, China, 100049; (corresponding author to provide phone: 024-83601301; e-mail: [email protected]).

Peng Hui, a master instructor, graduated from the department of the Dalian University of Technology, Dalian, Liaoning, China. He now works in the Shenyang institute of automation Chinese academic of science. (e-mail: [email protected]).

Liu Chang, a doctorate recipient, is now with the Shenyang institute of automation Chinese academic of science. (e-mail: [email protected]).

Yao Li Li is a PH.D in the Shenyang institute of automation Chinese academic of science. (e-mail: [email protected]).

transportation, military and others, and support continuous modeling, discrete event modeling, discrete-rate modeling as well as 2D and 3D simulation. What’s more, it can achieve dynamic code join with Delphi, C++ Builder, Visual basic and Visual C++. When the C#.Net platform is widely used, it is necessary to provide a way to achieve data interaction between C#.Net and ExtendSim, which will make the simulation completed in more occasions.

II. COM TECHNOLOGY

The so-called COM (Component Object Model) is a standard to describe how to create a dynamic exchange component. Its main feature is to communicate between any two components (or between component and customer) follow this specification, without considering whether they are in the same operating environment or not, whether they use the same development language or not, whether they run on the same computer or not.

The three basic concepts in COM are COM component, COM objects and COM interface. COM component can contain one or more COM components. In other words, COM component is the carrier of COM object. COM object is an instance of the COM class, is the entity of interaction between the client and the component. Every COM object contains one or more interfaces. COM interface is a data structure that contains a set of functions. Customers can call component function object through the data structure. The relationship among COM component, COM object and COM interface is shown in Fig. 1.

According to the COM specification, COM object and

COM interface must only be identified. Both use globally unique identifier (GUID) to identify. The object identifier is called the CLSID (Class Identifier). And the interface identifier is called the IID (Interface Identifier). When a customer uses a COM object, it creates a COM object at first by through the CLSID. Then it gets an interface pointer of the

Simulation of Genetic Algorithm Scheduling on ExtendSim Based on COM Technology

Zhang Shi Shan, Peng Hui, Liu Chang, Yao Li Li

I

Fig. 1 Relationship among COM component, COM object and COM

interface

Proceedings of 2012 International Conference on Modelling, Identification and Control, Wuhan, China, June 24-26, 2012

300

Page 2: Simulation of Genetic Algorithm Scheduling on ExtendSim ...ir.sia.ac.cn/bitstream/173321/10119/2/Simulation of genetic algorith… · ExtendSim, the upgraded version of Extend 6,

COM object by the IID. The interface pointer points to the implementation of the interface code that contains the interface methods and properties. Finally the client calls the services provided by the COM object through the interface pointer.

III. GENETIC ALGORITHM

A. Principle

Genetic algorithm (GA) is an adaptive global optimization probabilistic search method that is formed by simulating genetic and evolutionary process of creatures in natural environment. According to the phenomenon of selection, crossover and gene mutation occurred in the process of natural evolution, firstly it reserves a set of candidate solutions in each iteration, and selects the better individuals from solution set in terms of a given indicator, then produces a new generation of candidate solution group by using genetic operators (selection, crossover and mutation) to combine these individuals. Repeat this process until to meet certain convergence indicators. The principle of the genetic algorithm is shown in Fig. 2.

B. Basic procedure

Step 1: Determine the encoding method of the problem. Step 2: Determine the fitness function. Step 3: Select the parameters of the algorithm. Usually

includes population size, crossover probability, mutation probability, number of iterations etc.

Step 4: Design the algorithm. Usually includes initialization, coding, selection, crossover, mutation, decoding and replacement operations etc.

Step 5: Determine the termination condition of the algorithm.

C. Feature and application

The genetic algorithm provides a generic framework for solving complex optimization problems. It doesn’t depend on the specific area of the problem. Because of its easy-to-use, strong robustness, approximate optimum and implicit parallelism, it is widely used in many fields. For example, optimization of the function, combinatorial optimization,

production scheduling, automatic control, robotics, image processing, artificial life, machine learning and so on.

IV. EXTENDSIM

ExtendSim, the upgraded version of Extend 6, is an easy-to-use, yet extremely powerful, tool for simulating processes. It is developed by Imagine That Company in US, and now has over 13,000 users in the world. Currently its customers include the world’s famous enterprise and educational institutions, such as IBM, Procter & Gamble, General Electric, Motorola, Citigroup and Harvard Business School etc.

ExtendSim has the following basic functions: Input modeling, running the situation model, data analysis and so on. By ExtendSim, Users can dynamically model continuous, discrete event, discrete rate, agent-based, linear, non-linear, and mixed-mode systems. And it offers modular modeling capabilities. Not only the basic module that the software provides and also the module that users create by themselves can be used to build the model. Besides, the ExtendSim contains a simulation engine based on message sending, which make the modeling more flexible and the running more rapidly. ExtendSim use 2D and realistic 3D animation for modeling and displaying of simulation. What’s more, ExtendSim provides specialized data fitting function to assist users in processing and analyzing a variety of input data.

Overall, ExtendSim inherited the general characteristics of the contemporary simulation software: reusable modeling modular, terminal user interface development tool, flexible mechanism for customizable reports and plotters, many methods integrated with other application systems. In addition, it also has many unique advantages to make the modeler focus on the building process and quickly create the model easy to understand. Example as follows:

(1) Interactive. ExtendSim parameters and model logic can be changed rather than having to wait until the situation ends even during a model run. When users modify the parameters, it supports seeing the situation of operation in a timely manner.

(2) Scalable. ExtendSim can be used to create enterprise models containing thousands of modules because of its unlimited hierarchical structure.

(3) Open source. ExtendSim block components are open source to modification and enhancement. As long as understanding C language, users can rewrite all the modules, logic and animation, rather than limited to the module and algorithm that the software provides.

(4) Well connected. ExtendSim has an integrated relational database and supports COM/ActiveX and ODBC.

(5) Visually Transparent. Block icons convey the structure and behavior of the model at a glance. In ExtendSim, both the flow of items and the flow of values are graphically represented. This unique mapping of visual meanings into their equivalent icons promotes quick understanding of a model to anyone viewing it.

Fig. 2 Principle of the genetic algorithm

Proceedings of 2012 International Conference on Modelling, Identification and Control, Wuhan, China, June 24-26, 2012

301

Page 3: Simulation of Genetic Algorithm Scheduling on ExtendSim ...ir.sia.ac.cn/bitstream/173321/10119/2/Simulation of genetic algorith… · ExtendSim, the upgraded version of Extend 6,

V. SIMULATION

A. Problem assumption

This paper assumes a problem to minimize the completion time of parallel multi-machine scheduling. The mathematic model is described as Fig. 3.

There are n independent jobs each other which will be

processed from machine 1 to machine m. Every job has a certain processing time, and can be processed by any of m machines. Find an effective scheduling, i.e., to determine the number of the job on each machine, so that completing all jobs takes the shortest time.

Assume that t(j) express the processing time of job j. In order to make it simple to solve the problem, this paper presents a generalized processing time that is defined as x(i,j)t(j), which i∈{1,…,m }. Clearly, if x(i,j) = 1, then the job j is processed on the machine i; if x(i,j) = 0, then the job j isn’t processed on the machine i. Because the objective function is the completion time of all jobs, the total time on machine i is irrelevant to the job processing sequence. So we can assume that each machine processes jobs according to the ascending order of the natural number. In fact, every job only can be processed on one machine, so the matrix X composed of x(i,j) has the following properties:

(1) All of the elements are 0 or 1. (2) There is one and only one element in each column is 1. (3) The sum of the number of the element 1 is n.

B. Experiment data

A parallel multi-machine scheduling problem with 7 jobs and 3 machines is presented to verify this technology. Their processing data is shown in Table 1.

Table 1 Processing data of 7×3 parallel multi-machine scheduling

Jobs j 1 2 3 4 5 6 7

Processing time t(j)

6 6 4 4 4 3 3

C. Design of the GA

(1) The objective function of GA The objective function of GA can be written as:

1 2min min{max[ , ,... ,... ]}ms i mG T T T T

In the above function,

1( , ) ( ), (1, 2,..., )

n

i jT x i j t j i m

which is the completion time of each machine;

1 2max[ , ,... ,... ]ms i mG T T T T

which is the completion time of all jobs. (2) The flow diagram of the genetic algorithm scheduling The flow diagram of the genetic algorithm scheduling is

depicted in Fig. 4.

This paper adopts the natural coding to reduce the

workload of decoding. The chromosome is expressed as k1, k2,…, kj, …, kn, kj∈{1,…,m }, and kj is a natural number whose values can be repeated. Roulette wheel selection is used to select the best individuals in the population. The crossover operation uses the manners of intermediate recombination. And the mutation operation adopts the real number variation. Preset the maximum number of the breeding generations as the terminal condition.

(3) Setting on the .Net Platform Due to the use of COM technology, it is necessary to make

the appropriate settings on the .Net platform when writing the genetic algorithm source code in C #. As follows:

① Create a C# class library project on .Net platform; ② Open the project properties and click “Application” tab.

Then click on the “Assembly Information” button, and tick the check box of the “Make assembly COM visible”;

③ Click the “Generate” tab, and tick the check box of “Register for COM Interoperability”;

Fig. 3 Mathematic model of the parallel multi-machine scheduling

Fig. 4 Flow diagram of genetic algorithm scheduling

Proceedings of 2012 International Conference on Modelling, Identification and Control, Wuhan, China, June 24-26, 2012

302

Page 4: Simulation of Genetic Algorithm Scheduling on ExtendSim ...ir.sia.ac.cn/bitstream/173321/10119/2/Simulation of genetic algorith… · ExtendSim, the upgraded version of Extend 6,

④ Click on the “signature” tab, and tick the check box of the "Sign the assembly”. Then create a new snk formats key file; ⑤ Open the .cs format file, and writes the genetic

algorithm codes with the interface. In addition, the most important is to add the GUID contained 32 hexadecimal before the Necessary output function and the interface.

D. Creating the simulation model

Parallel multi-machine scheduling simulation model of 7 jobs and 3 machines is shown in Fig. 5.

In the figure 3, the “Create” module produces 7 items at time 0 in accordance with the “Create Items by Schedule” approach. The “Data Source Create” creates two 1×1 arrays to control the row and column of the Excel when writing data

to Excel, and the “Data Init” module initialize these arrays. The “Executive” block controls and does event scheduling for discrete event models, using the default configuration. “Equation(1)” is used to read the processing time (ProcessTime) and the processing path (WhichMachine) optimized by GA from Excel. “Equation(2)”, “Equation(3)”, “Equation(4)”, “Equation(5)”, “Equation(6)” and “Equation(7)” write the processing information of every workpiece to Excel (including workpiece type, workpiece processing equipment, begin time and end time of the workpiece on the device). The “Select Item Out” module selects processing path through the WhichMachine property. And the delay of the three “Activity” modules chooses the ProcessTime property. Other modules use the default configuration.

In addition, the “Schedule-GA” blocks that is developed by author is used to achieve dynamic connection with the genetic algorithm source code written in C# by COM technology, and call the function in source code. These functions is mainly completed in the “on initsim{}” function, which is achieved at the beginning of the simulation.

ExtendSim can use the COM technology as follows: 1 //Declare constants and static variables here. 2 long DLL_ObjectHandle, schedule_GA_dispID;

3 constant DLL_GUID_CON is "{××××××××-××××-××××-××××-××××××××××××}"; 4 // Initialize any simulation variables.

5 on initsim 6 {

7 integer result[7]; 8 DLL_ObjectHandle =

OLECreateObject(DLL_GUID_CON); 9 schedule_GA_dispID =

OLEDispatchGetDispID(DLL_ObjectHandle, "Schedule_GA");

10 OLEDispatchInvoke(DLL_ObjectHandle, schedule_GA_dispID);

11 OLEArrayResult(result);

… …… … } Note: The DLL_GUID_CON in line 3 is a GUID contained

32 hexadecimal. It must be identical to the GUID of the output in the GA source code. Besides the results of GA is exported by a one-dimensional array “result”. Finally the result need to output into Excel.

VI. RESULT ANALYSIS

When the number of GA iteration is 50, population size is 20, crossover rate is 0.75, mutation rate is 0.6, and a random simulation result is shown in Table 2.

Executiv e

start Create

WhichMachine

Select Item Out

y =f (x)

Equition(1)

R L

Queue

y =f (x)

Equation(2)

R L

Queue

R L

Queue

D F

Activ ity

y =f (x)

Equation(3)

y =f (x)

Equation(4) D FActiv ity

y =f (x)

Equation(5)

y =f (x)

Equation(6) D F

Activ ity

y =f (x)

Equation(7)

Select Item In

7

Exit

Data Source Create Data Init

Schedule

-GA

R L

Queue

Fig. 5 Parallel multi-machine scheduling simulation model of 7 workpieces and 3 machines

Proceedings of 2012 International Conference on Modelling, Identification and Control, Wuhan, China, June 24-26, 2012

303

Page 5: Simulation of Genetic Algorithm Scheduling on ExtendSim ...ir.sia.ac.cn/bitstream/173321/10119/2/Simulation of genetic algorith… · ExtendSim, the upgraded version of Extend 6,

Table 2 A random simulation result of the GA scheduling

Workpiece Begin Time

End Time

Machine

1 0 6 2 2 0 6 1 5 0 4 3 6 4 7 3 3 6 10 2 4 6 10 1 7 7 10 3

The Gantt chart shown in Fig. 6 is plotted according to the result of the GA scheduling, where x-coordinate represents the time and the y-coordinate represents the machine.

In order to verify the genetic algorithm, this paper give the

result of the LPT (Longest Processing Time) scheduling, as shown in Table 3, and the Gantt chart of the LPT scheduling, as shown in Fig.7.

Table 3 A random simulation result of the LPT scheduling

Workpiece Begin Time

End Time

Machine

1 0 6 1 2 0 6 2 3 0 4 3 4 4 8 3 5 6 10 1 6 6 9 2 7 8 11 3

From the Fig. 6 and the Fig.7, we can see that the complete

time of the GA scheduling and the LPT scheduling is 10 and 11 respectively. And the optimal solution is 10.

VII. CONCLUSION

The implementation of the data interaction between ExtendSim and C#.Net platform based on COM technology, combine the advantage of ExtendSim and C# language. The

example that GA solve parallel multi-machine scheduling problem verifies feasibility and effectiveness of this technology. This technology adds a new solution for the simulation of the production scheduling problem.

ACKNOWLEDGMENT

This work is supported by the National Science and Technology Major Project of the Ministry of Science and Technology of China under Grant 2011ZX02601-005.

REFERENCES [1] Dale Rogerson, “Inside COM”, Washington: Microsoft Press, Jan.

1997.

[2] Liu Min, Wu Chen, Jiang Xin Song, “Genetic algorithm method for identical parallel machine scheduling Problem”, System engineering -theory and practice, 1, pp. 14-17, Jan. 1998.

[3] Wang Lin, “Shop scheduling with genetic algorithm”, Beijing: Tsinghua university press, May. 2003.

[4] Guo Hai Dong, “A study and application of genetic algorithm applied to scheduling problem”, Zhejiang: Zhejiang university of technology, 2004.

[5] Xiong Rui, Wu Cheng, “The present situation and development trend of shop production scheduling”, Journal of Tsinghua university (sci & tech), vol. 38, no. 10, pp.55-60, Oct. 1998.

[6] Seok Jin Lim, Suk-Jae Jeong, Kyung Sup Kim, Myon Woong Park, Young Tae Sohn, and Hyung Min Rho. “Simulation and GA approach for process planning”, International Journal of applied science, Vol. 3, no. 3, pp.158-162, 2006.

[7] Jin Lan, Chang Jian E, “The analysis of supply chain’s bullwhip effect based on ExtendSim”, Machinery, No.12, pp. 72-74, 2010.

[8] Qin Tian Bao, Wang Yan Feng, “Application oriented simulation modeling and analysis with ExtendSim”, Beijing: Tsinghua university press, Jan. 2009.

[9] Xiaohui Zhao, Awei Zhang, Wei Sun, Jianfeng Liang, “An improved genetic algorithm for multiple-machine scheduling problem”, International conference on management and service science(MASS). 2009.

Fig. 6 Gantt chart of the GA scheduling result

Fig. 7 Gantt graph of the LPT scheduling

Proceedings of 2012 International Conference on Modelling, Identification and Control, Wuhan, China, June 24-26, 2012

304