In fact, this is a standard modeling problem for shoes that have learned mathematical models, and there is nothing new.
The reason why I pulled this item out is mainly because I was very happy in computing (when I was playing something similar, but today I was computing, there is an inexpressive sense of satisfaction, which is a kind of leisure and entertainment.
In addition, I know that integer planning is the time for graduate students. Just about a year ago, I had stayed at Nitto Denko for a short period of time. In fact, I encountered a very similar situation.
Nitto Denko has a sharding plant in Songjiang. The original standard-width products imported from Japan are cut according to the customer's order requirements. Each order will have various width specifications and quantity requirements.
I remember that I was responsible for receiving orders, confirming various details with the customer, then confirming the inventory status with the warehouse, and then sending a cut instruction to the slitting factory by email and phone, after the order is completed, confirm the order with the customer,
After the seal is signed, fax will be sent back to the customer.
Before sending an instruction to the warehouse and the slitting factory, the type and quantity of required materials were calculated using a fixed formula with a proportional coefficient. for example, if the width of all products required by the customer is
If the value is 99, multiply the order by a proportional coefficient greater than 1, or call it magic number. The universal proportional coefficient, such as 1.13, is basically the required quantity. however, sometimes this formula will fail.
I have no idea how to solve this problem, because I am not a mathematical genius. However, after learning the "optimization principle, I found that the problem should be solved in this way.
It is precisely for this reason that I have always had a special liking for the Nonlinear Integer planning. Even if it seems that I am not using it now, I still want to take out lingo and write code again, run it easily.
Copying examples is very easy. Therefore, the following is a copy.
The length of the Standard steel pipe is 19 m. The customer's order requires 50 4 m long steel pipes, 13 5 m long steel pipes, and 9 7 m long steel pipes, 22 9 m long steel pipes.
How can we arrange to cut the minimum scrap? How to arrange the minimum m Standard steel pipe for cutting?
Now let's answer the question according to the standard answer.
Assume five different cutting modes, each of which uses standard steel tubes x1, x2, X3, X4, and X5
Assuming that each original steel pipe can obtain the type j required by the customer through the cutting mode I (j = 1, 2, 4, 4, 4 m, 5 m, 7 m, 9 m) the number of steel pipes is rij;
The minimum size of the Standard steel pipe means min = X1 + X2 + X3 + X4 + X5;
Minimum scrap, which means the sum of the remaining materials not greater than 3 is the least: min = 19*(X1 + X2 + X3 + X4 + X5) -4*(R11 * X1 + R21 * X2 + R31 * X3 + r41 * X4 + R51 * X5) -5*(R12 * X1 + R22 * X2 + R32 * X3 + r42 * X4)-7 * (similar)-9 * (similar)
The linear target function is easy to calculate, even if it is the first one,
Model:
Sets:
VOC/1 .. 4/: length, number;
Cut/1 .. 5/: X;
Pattern (VOC, cut): R;
Endsets
Data:
Length = 4 5 7 9;
Number = 50 13 9 22;
Origin = 19;
Enddata
Min = @ sum (cut (I): X (I ));
@ For (VOC (I): @ sum (cut (j): X (j) * R (I, j)> Number (I ));
@ For (cut (j): @ sum (VOC (I): length (I) * R (I, j) <origin );
@ For (cut (j): @ sum (VOC (I): length (I) * R (I, j)> origin-@ min (VOC (I ): length (I) + 1 );
@ Sum (cut (I): X (I) <@ size (VOC) + @ sum (VOC (j): @ floor (number (j) /@ floor (origin/length (j ))));
@ Sum (cut (I): X (I)> @ floor (@ sum (VOC (I): length (I) * Number (I)/origin );! The simplest arithmetic mean of the next session;
@ For (VOC (I): @ sum (cut (j): X (j) * R (I, j)> Number (I ));! The length of each type is no less than the number required by the customer;
@ For (cut (I): @ gin (X (I )));
@ For (pattern (I, j): @ gin (R (I, j )));
End
Find one local optimal solution. There should be more such solutions.
Local optimal solution found.
Objective value: 29.00000 requires 29 original materials
Objective bound: 29.00000
Infeasibilities: 0.000000
Extended solver steps: 3975
Total solver iterations: 131959
Model class: pinlp
Total variables: 25
Nonlinear variables: 25
Integer Variables: 25
Total constraints: 21
Nonlinear Constraints: 8
Total nonzeros: 135
Nonlinear nonzeros: 80
Variable value CED cost
Origin 19.00000 0.000000
Length (1) 4.000000 0.000000
Length (2) 5.000000 0.000000
Length (3) 7.000000 0.000000
Length (4) 9.000000 0.000000
Number (1) 50.00000 0.000000
Number (2) 13.00000 0.000000
Number (3) 9.000000 0.000000
Number (4) 22.00000 0.000000
X (1) 9.000000 1.000000
X (2) 11.00000 1.000000
X (3) 0.000000 1.000000
X (4) 2.000000 1.000000
X (5) 7.000000 1.000000
R (1, 1) 3.000000 0.000000 1st cutting mode 3 with a length of 4
R (1, 2) 0.000000 0.000000 2nd cutting modes, 4 N/
R (1, 3) 1.000000 0.000000 3rd cutting modes, 1 with a length of 4
R (1, 4) 1.000000 0.000000 4th cutting modes, 1 with a length of 4
R (1, 5) 3.000000 0.000000 5th cutting modes, 3 with a length of 4
R (2, 1) 0.000000 0.000000 1st kinds of cutting mode with a length of 5 NO
R (2, 2) 0.000000 0.000000 2nd cutting modes, with a length of 5
R (2, 3) 0.000000 0.000000 3rd cutting modes, with a length of 5
R (2, 4) 3.000000 0.000000 4th cutting modes, 3 with a length of 5
R (2, 5) 1.000000 0.000000 5th cutting modes, one with a length of 5
R (3, 1) 1.000000 0.000000 1st cutting mode 1 with a length of 7
R (3, 2) 0.000000 0.000000 2nd cutting modes, with a length of 7
R (3, 3) 2.000000 0.000000 3rd cutting modes, 2 with a length of 7
R (3, 4) 0.000000 0.000000 4th cutting modes, with a length of 7
R (3, 5) 0.000000 0.000000 5th cutting modes, with a length of 7
R (4, 1) 0.000000 0.000000 1st middle cutting mode, no length of 9
R (4, 2) 2.000000 0.000000 2nd cutting modes, 2 with a length of 9
R (4, 3) 0.000000 0.000000 3rd cutting modes, no length of 9
R (4, 4) 0.000000 0.000000 4th cutting modes, no length of 9
R (4, 5) 0.000000 0.000000 5th cutting modes, no length of 9
Row slack or surplus dual price
1 1 29.00000-1.000000
2 0.000000 0.000000
3 0.000000 0.000000
4 0.000000 0.000000
5 0.000000 0.000000
6 0.000000 0.000000
7 1.000000 0.000000
8 1.000000 0.000000
9 0.000000 0.000000
10 2.000000 0.000000
11 3.000000 0.000000
12 2.000000 0.000000
13 2.000000 0.000000
14 3.000000 0.000000
15 1.000000 0.000000
16 6.000000 0.000000
17 2.000000 0.000000
18 0.000000 0.000000
19 0.000000 0.000000
20 0.000000 0.000000
21 0.000000 0.000000