Here you’ll learn how to use the ruler method for linear optimization.
Rule
The objective function can be found by summing the “price per unit” multiplied by the “number of units” for all the items you have. Then it looks like this:
$$Z(x,y)=Ax+By$$ |
where $A$ is the price of an item that has sold $x$ units and $B$ is the price of an item that has sold $y$ units.
You can swap $Z(x,y)$ with a constant, $K$. Solve the equation for $y$ so that you have a linear function you can move around:
$$\begin{array}{llll}\hfill Z(x,y)& =Ax+By\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill K& =Ax+By\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill K-Ax& =By\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill By& =K-Ax\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill y& =\frac{K}{B}-\frac{A}{B}x\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill y& =-\frac{A}{B}x+\frac{K}{B}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$$The only thing that matters here is the slope of the function, $-\frac{A}{B}$. The constant term changes all the time, because you change the value of $K$ to move the line outwards in the coordinate system.
Example 1
A factory that produces brands will make a shirt and a skirt for Tom Ford. Both pieces have to be made of cashmere and silk. To make a shirt, you need two lengths of cashmere and one length of silk. To make a skirt, you need one length of cashmere and three lengths of silk. The factory has 200 lengths of cashmere and 300 lengths of silk available. A shirt is sold for $\text{\$}\text{}295\text{}$, while a skirt is sold for $\text{\$}\text{}450\text{}$. How many shirts and skirts does the factory have to produce to maximize its income, and what is this income?
First, you set up the constraints described in the text as inequalities. Let $x$ be the number of shirts produced and $y$ be the number of skirts produced. The cashmere and the silk has to be distributed between the shirts and skirts. That gives you these inequalities:
The number of shirts you produce can be no shirts, or more. This means that
$$x\ge 0$$ |
The number of skirts you produce can be no skirts, or more. That gives you
$$y\ge 0$$ |
Now you must construct an inequality for the available cashmere. You need two lengths for a shirt, and one length for a skirt. The roll has a total of $200$ lengths. That results in
$$2x+y\le 200$$ |
Next, you make an inequality for the available silk. You need one length for a shirt and three lengths for a skirt. The roll has $300$ lengths of silk. That would be
$$x+3y\le 300$$ |
You end up with this system of inequalities:
$$\begin{array}{lll}\hfill x& \ge 0\phantom{\rule{2em}{0ex}}& \hfill \text{(1)}\phantom{\rule{0.33em}{0ex}}\\ \hfill y& \ge 0\phantom{\rule{2em}{0ex}}& \hfill \text{(2)}\phantom{\rule{0.33em}{0ex}}\\ \hfill 2x+y& \le 200\phantom{\rule{2em}{0ex}}& \hfill \text{(3)}\phantom{\rule{0.33em}{0ex}}\\ \hfill x+3y& \le 300\phantom{\rule{2em}{0ex}}& \hfill \text{(4)}\phantom{\rule{0.33em}{0ex}}\end{array}$$Now you need solve the inequalities with respect to $y$. First, inequality (3):
$$\begin{array}{llll}\hfill 2x+y& \le 200\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill y& \le 200-2x\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$$Inequality (4):
$$\begin{array}{llll}\hfill x+3y& \le 300\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill 3y& \le 300-x\phantom{\rule{1em}{0ex}}|\xf73\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill y& \le 100-\frac{1}{3}x\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$$You don’t have to do anything with the other two inequalities.
Graph the two inequalities in a coordinate system and mark the area where they overlap. You know that you only need the first quadrant because both $x$ and $y$ is greater than or equal to 0. That should give you this figure:
Find the optimal point using this figure. You know that it is one of the points within the marked area where the graphs intersect, or where the graphs intersect the axes.
When you use the ruler method, you have to find the expression for the objective function $Z(x,y)=Ax+By$. You know that a shirt costs $$295$ and that a skirt costs $$450$. Insert these prices for $A$ and $B$ in the expression and solve for $y$. Then you get
$$\begin{array}{llll}\hfill Z(x,y)& =295x+450y\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill K& =295x+450y\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill 450y& =K-295x\phantom{\rule{2em}{0ex}}|\xf7450\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill y& =\frac{K}{450}-\frac{295}{450}x\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill y& \approx -0.66x-\frac{K}{450}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$$Because the term with the constant term $K$ in it isn’t important when you push the line outwards in the first quadrant, you can choose any value for it that you want. It’s smart to begin by picking a value on the $y$-axis that lies within the marked area. In the figure below, the constant term has been chosen to be $80$. It looks like this:
You read off the coordinates of the point and find that $B=\phantom{\rule{-0.17em}{0ex}}\left(60,80\right)$. That means the factory should produce $60$ shirts and $80$ skirts in order to maximize their income.
You find the income of the factory at the optimal point by inserting the $x$-value and the $y$-value you found in Item 7 into the objective function. That means $x=60$ and $y=80$, and you get
$$Z(60,80)=295\cdot 60+450\cdot 80=53\phantom{\rule{0.17em}{0ex}}700$$ |
The factory earns $$53\phantom{\rule{0.17em}{0ex}}700$ by producing $60$ shirts and $80$ skirts. This is the optimal production, because it was the outermost point in the marked area that the line of the objective function intersected.