Dynamic Planning-assembly line Scheduling

Source: Internet
Author: User

I. Problem Description

The assembly line scheduling problem is as follows:

The colonel automobile company produces cars in factories with two assembly lines. After a chassis enters each assembly line, different components are installed on the chassis of each Assembly station, the finished car leaves the end of the assembly line. As shown in 1.


Figure 1 assembly line

There are n assembly stations on each assembly line, numbered j = 1, 2 ,..., n. Represent the J assembly station of assembly line I (I is 1 or 2) As S (I, j ). The J stations S (1, J) of assembly line 1 and J stations S (2, j) of Assembly Line 2 perform the same functions. However, these assembly stations are built at different times and adopt different technologies. Therefore, the time required for completing the Assembly on each station is different, this is true even for the assembly stations at the same position on the two assembly lines. The assembly time required for each assembly station is recorded as a (I, j), and the time required for the chassis to enter assembly line I is E (I ), the time required to exit assembly line I is X (I ). Under normal circumstances, the time taken to move the chassis from the previous station of an assembly line to the next station can be ignored, but occasionally, the unfinished chassis will be moved from one station in one assembly line to the next stop in another assembly line, for example, in case of an emergency order. Assume that the time it takes to move from assembly line I to another assembly line through the chassis of assembly station S (I, j) is T (I, j ), the problem now is that you need to determine which stations are selected in assembly line 1 and which stations are selected in assembly line 2 to minimize the total time the car passes through the factory.

Ii. Problem Analysis

First look at this problem, the simplest solution is to traverse the process to obtain the minimum time. However, it should be seen that when the number of sites n is large, the n route of 2 needs to be traversed, and the efficiency is low. Is there a more efficient solution?

To facilitate problem analysis, we create a simple mathematical model for this problem. Assume that the Shortest total time of assembly station J is F (J), and the assembly line selected through the shortest route of assembly station J is R (j) (R (j) the total time of the vehicle passing through the factory is f = f (n) + x (R (n), where X (R (n )) the time required to leave the Assembly Line r (n. Now, the key problem is to calculate F (N) and R (n ). An automobile passes the n-1 assembly station through the n route. If F (n-1) and R (n-1) are calculated, F (n) is F (n-1) add the shortest time from the n-1 assembly station to the N assembly station. Knowing R (n-1), it is very easy to calculate the shortest time from the n-1 assembly station to the N assembly station. Remember! R (j) is another assembly line, you only need to find a (R (n-1), N) and (! R (n-1), n) + T (r (n-1 ),
N-1.

Based on the above analysis, we can conclude that:

F (n) = f (n-1) + min (A (R (n-1), n), (! R (n-1), n) + T (r (n-1), n-1 ))

R (n) = R (n-1) If a (R (n-1), n) <= (! R (n-1), n) + T (r (n-1), n-1)

! R (n-1) If a (R (n-1), n)> (! R (n-1), n) + T (r (n-1), n-1)

Generally, we can conclude that:

F (1) = min (E1 + a (1, 1), E2 + a (2, 1 ))

R (1) = 1 If E1 + a (1, 1) <= e2 + a (2, 1)

2 If E1 + a (1, 1)> E2 + a (2, 1)

F (j) = f (J-1) + min (A (R (J-1), n), (! R (J-1), n) + T (r (J-1), J-1) Where 2 = <j <= N

R (j) = R (J-1) If a (R (J-1), j) <= (! R (J-1), j) + T (r (J-1), J-1)

! R (J-1) If a (R (J-1), j)> (! R (J-1), j) + T (r (J-1), J-1)

With the above recursive formula, we can use the bottom-up method to calculate the shortest time and specific route of the vehicle passing through the factory.

3. Program Implementation

The following is my program for solving assembly line scheduling:

# Include <iostream> # include <vector> using namespace STD; double F (INT stationno, Int & lineno, const vector <double> & duaration1, const vector <double> & duaration2, const vector <double> & line1to2, const vector <double> & line2to1, const double & in1, const double & in2); int main () {// by default, the time consumed for entry and exit is 1, and the time required for transfer is also 1. The time required for each station in each assembly line is shown in the following two arrays, the correct scheduling sequence should be: 2, 1, 2, and the total time should be 10 double dtemp1 [] = {2, 1, 6}; double dtemp2 [] = {1, 3, 4}; size_t size = sizeof (dtemp1)/sizeof (double); vector <double> duaration1 (dtemp1, dtemp2 + size ), // The time required for each station in the first assembly line duaration2 (dtemp2, dtemp2 + size), // the time required for each station in the Second Assembly Line line1to2 (2, 1 ), // The time required to move from the first assembly line to the second assembly line, which is assumed to be 1line2to1 (2, 1); // The time required to move from the second assembly line to the first assembly line, assume that all values are 1 double in1 = 1.0, in2 = 1.0, out1 = 1.0, and out2 = 1.0; // the start time and end time are 1int lineno = 0; // which assembly line does the last get out of double totaltime = f (size-1, Lineno, duaration1, duaration2, line1to2, line2to1, in1, in2); If (lineno = 1) totaltime + = out1; elsetotaltime + = out2; cout <"Total time" <totaltime <Endl; return 0;} double F (INT stationno, Int & lineno, const vector <double> & duaration1, const vector <double> & duaration2, const vector <double> & line1to2, const vector <double> & line2to1, const double & in1, const double & in2) {If (stationno = 0) {do Uble time = 0.0; double time1 = in1 + duaration1.at (0); double time2 = in2 + duaration2.at (0); time = (time1 <= time2 )? Time1: time2; lineno = (time1 <= time2 )? 1: 2; cout <"station" <stationno + 1 <"produced at line" <lineno <Endl; return time ;} double previoustime = f (stationno-1, lineno, duaration1, duaration2, line1to2, line2to1, in1, in2); // F (n-1) time spent double stationnotime = 0.0; // time required for this site if (lineno = 1) // previous jobs are completed in the first assembly line {stationnotime = duaration1.at (stationno); double toline2time = duaration2.at (stationno) + line1to2. at (stationno-1); If (stationnotime> toline2time) {stationnotime = toline2time; lineno = 2 ;}} else if (lineno = 2) // previous jobs are completed in the Second Assembly Line {stationnotime = duaration2.at (stationno); double toline1time = duaration1.at (stationno) + line2to1. at (stationno-1); If (stationnotime> toline1time) {stationnotime = toline1time; lineno = 1 ;}} cout <"station" <stationno + 1 <"produced at line" <lineno <Endl; double totaltime = stationnotime + previoustime; return totaltime ;}

Result:

station 1 produced at line 2station 2 produced at line 1station 3 produced at line 2Total time 10

The result is correct.

This article is reproduced from: http://www.cnblogs.com/hujian/archive/2012/03/14/2379565.html, and is slightly modified.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.