This example is, um, let's name the paper company, so suppose we have that black paper and let's
assume the lens of these big paper is one meter and we want to create, um, and we want to cut these
big paper into a smaller, smaller pieces.
And you can see these are the requirements.
So, uh, piece X has a weight of five and P's, um, Y has rates of seven pieces that it has and the
width of um nine and they have the same length of the black one.
OK, so the question is, how should I, uh, cut the paper in order to minimize the number of big papers
I have to use.
For example, let me give you an example.
If I want to, uh, cut this paper into, uh, and create some X, uh, piece, it means that each paper
can give me four pieces of, uh, X.
Yeah.
And also it can give me two pieces of these red ones or two of these yellow ones.
OK, and there are some, uh, parts are lost.
Yeah.
So how should I do that in a way that the amount, the number of big papers that I'm using is minimized.
OK.
So, um, definitely I have to choose the binary variables.
OK, so.
I want to know, and for each piece of paper, let's call it, I, um, how many eggs I can extract,
how many women I can extract, how many that I can extract, for example, one X, one Y, which will
be twelve.
I can't do any more, um, Z because then the bits of the paper is not big enough.
OK.
Or what else I could do.
I could say five and two pieces of read.
It will be nineteen.
Yeah it's less than twenty.
OK, so five X plus seven Y plus nine Z.
I should be less than um you I yeah.
So um it's better to write it down.
It's.
OK, this example is called the paper company, suppose a paper company should cut its raw papers,
which you can see them as the black and big papers.
Uh, into the color ones and the size of each color paper is known and also the black one as well,
and I want to know, um, how should we optimally cut these big black papers into the color ones?
OK, so let me give you an example.
If I only need the.
Um, x kind of size, it means that each black paper can give me four of these, um, green ones or
two of these, uh, red ones or one green and two red.
Yeah.
Or two yellow ones.
OK, so the weights of the paper should be always, um, taken into account.
So we want to minimize the number of big papers I'm going to cut and for each given paper how many X
and Y and Z I can extract.
So uh five X plus seven Y plus nine Z, less than uh twenty yuan and, and X and Y and Z are telling
me the required number of each uh piece.
OK.
As you can guess, I have to define them as binary variables.
OK, so let me show you the code.
So here I import the required packages I defined as a concrete model.
And also you can see here that you is a binary variable and X and, um, Y and Z are, let's say, um,
um, integer and non-negative integer variables.
OK, so, um, first rule five X plus seven Y plus nine Z, less than equal to twenty you Y.
And the next rule is specify how many of X is required.
So let's assume that an X is ten and Y is 12 and Z is five.
You could define them as.
Some parameters, it would be much, much better and professional, but that's fine and the objective
function is summation of I multiplied by you, I, I could uh, amidst I multiplication here, but I
will show you why I put it here.
And also the, um, solver.
I'm going to use this because it's linear programming and the results are found here and everything
is calculated here.
So for example, by this answer I know that there are ten big papers are needed.
The first one is giving me one X and to Y, the second one the same.
The third one is only using three for X and so on and so on.
OK, um, let me run the code from the beginning.
I show you the results again.
OK, this party is executed.
Now the program is running the optimization part.
But one question is here that, um, how many big papers I should consider for my optimization, because
initially before solving the problem, I don't know how many papers are needed.
So I define, um, a big number at the beginning.
OK, so how can I determined that by looking at the number of required, um, X, Y and Z I can say.
And this is the maximum number of.
And big papers that might be needed.
OK, so, um, so at the end, I know that 10 papers are needed.
So let me check something else for you before I finish this example.
Before I remove this multiplication, what's will happen?
Guess what?
So I run it from the beginning.
So I'm waiting for the solver to finish the job.
So I just slightly modified the, um, objective function.
And I'm waiting for the soldier to finish.
OK, so have a look at the results.
This is exactly what I wanted to show you so you can see that is one three five seven, eight, nine,
10, 13, 14 and 15.
OK, so, um, the objective function is telling me there are 10 pages are needed exactly the same as
before.
But, um, it doesn't matter for the Solver that each page is being chosen.
So the page with a higher rank or lower rank.
I mean and they are not sequential.
You can see here one three five seven 15.
You see.
So but if you multiply it by I, it will give you a more kind of clean, um, solution.
OK, thank you very much.