# Dynamic Planning-assembly line Scheduling

Source: Internet
Author: User

Problem description:

It is the fastest way to identify manufacturing problems through factory assembly lines. There are two assembly lines. Each assembly line has n assembly stations numbered J = 0, 1 ,... , N-1. Assembly line I (I = 0 or 1), the Assembly time required on the assembly station s [I] [J] is recorded as a [I] [J]. A car chassis enters the factory, and then enters the assembly line I at E [I]. After passing through the J assembly station of a line, this chassis comes to any line (J
+ 1) assembly stations. If it remains on the same assembly line, there is no moving overhead; if it is moved to another line after the assembly station s [I] [J, it takes t [I] [J]. After leaving the nth assembly station of a line, the departure time for the finished car to exit assembly line I is X [I].

State transition equation:

CodeImplementation:

`// Dynamic planning, factory assembly line # include <iostream> using namespace STD; // E1, E2 is the input cost of two assembly lines x1, x2 is the output cost, a1 [I] is the time consumed by station I of the first production line, T1, t2 records the time consumed during the conversion of the two production lines // F1 [I] records the minimum time consumed by the first station in the first production line, l1 [I] records the time consumed by the first station in the first production line, the previous station is the number of stations on the production line (void fastway (INT E1, int E2, int * A1, int * A2, int X1, int, int X2, int * F1, int * F2, int * L1, int * L2, Int & L, int * T1, int * t2, int length) {F1 [1] = e1 + A1 [1]; F2 [1] = e2 + A2 [1]; int I; for (I = 2; I <length; I ++) {If (F1 [I-1] + A1 [I] <F2 [I-1] + A1 [I] + T2 [I-1]) {F1 [I] = F1 [I-1] + A1 [I]; L1 [I] = 1 ;} else {F1 [I] = F2 [I-1] + aa1 [I] + T2 [I-1]; L1 [I] = 2 ;} if (F2 [I-1] + A2 [I] <F1 [I-1] + A2 [I] + T1 [I-1]) {F2 [I] = F2 [I-1] + A2 [I]; L2 [I] = 2 ;} else {F2 [I] = F1 [I-1] + A2 [I] + T1 [I-1]; L2 [I] = 1 ;}} // use F1 [length] to store the shortest time if (F1 [length-1] + X1 <F2 [length-1] + x2) {F1 [length] = F1 [length-1] + x1; L = 1;} else {F1 [length] = F2 [length-1] + x2; L = 2 ;}/// the minimum output time and required route void printanswser (int * L1, int * L2, int L, int length, int * F1) {int I = L; cout <"the fast time is:" <F1 [Length + 1] <Endl; cout <"the station: "<length <" is on line: "<I <Endl; Int J; For (j = length; j> = 2; j --) {if (I = 1) {I = L1 [J];} else {I = L2 [J];} cout <"the station: "<J-1 <" is on line: "<I <Endl ;}int main () {int e1 = 2, E2 = 4, X1 = 3, x2 = 2; int A1 [8] = {, 9, 3, 4}; int A2 [8] = {, 7 }; int T1 [6] = {0, 2, 3, 1, 3, 4}; int T2 [6] = {0, 2, 2, 1}; int F1 [8], F2 [7], l1 [7], L2 [7], L; fastway (E1, E2, A1, A2, x1, x2, F1, F2, L1, L2, L, T1, T2, 7); printanswser (L1, L2, L, 6, F1); Return 0 ;}`

Running result:

Chapter 2 dynamic planning -- factory assembly line C ++ code implementation-http://blog.csdn.net/liuzhanchen1987/article/details/7831a723

Related Keywords:

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.