This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Debating whether or not to upgrade to the latest version of Alteryx Designer?
LEARN MOREon 10-24-2016 11:30 AM - edited Tuesday by SydneyF
Sometimes, we don’t rely on an entire dataset to create an optimized solution. Sometimes, it can be as simple as solving a basic question. Consider the following problem that uses the optimization tool:
There is a clothing manufacturer has 750 sq. feet of cotton textile and 1,000 sq. feet of polyester. Every pair of pants needs 1 sq. feet of cotton and 2 sq. feet of polyester. Every jacket needs 1.5 sq. feet of cotton and 1 square feet of polyester. Due to manufacturing restrictions, no more than 400 jackets can be produced in a day, and a minimum of 200 pairs of pants are required to be manufactured. The price of the pants is fixed at $50 and the jacket, $40.
What is the number of pants and jackets that the manufacturer must give to the stores so that these items obtain a maximum sale?
Our job as analysts is to first identify 3 basic groupings to identify our optimization:
1) What our decision variables are and what our objective is
2) Any constraints with respect to decision variables
3) Any bounds and types (continuous, binary, integer) to consider for our decision variables
First, the decision we need to make is the number of pants and jackets the manufacturer should manufacture. Thus, the number of pants to make and the number of jackets to make are our decision variables. Let’s name our decision variables:
x=number of pants
y=number of jackets
Based on our problem above, we have to identify what our objective is – in this case we want to be able to maximize revenue. Revenue is nothing more than a function of the number of pant/shirts sold at their respective pricing. Therefore, our objective appears as:
Maximize Revenue = 50x + 40y
In the tool configuration, select the input mode "Enter the model manually," and based on the fact that we are looking to maximize profit, be sure to turn on the Maximize Objective toggle. Next, specify the variable list and select “+”. Now that we have an objective already sorted out, enter the objective using the same variables that we just specified.
Sometimes a table is a great way to sort out what constraints may look like. Below, I have created a matrix which will help me identify and rules that may alter my objective.
Pants(x) | Jackets(y) | Availability | |
Cotton | 1 sq. feet | 1.5 sq. feet | 750 sq. feet |
Polyester | 2 sq. feet | 1 sq. feet | 1000 sq. feet |
Based on this table, I can create my constraints. For the first row, I know that whatever number of jackets and pants I produce, I have the manufacturing constraint of only 750 sq. feet of cotton. This 750 sq. feet can be used for any number of jackets and pants, but I do know that they take different amounts of cotton to manufacture. Thus, I’ll specify the amount of cotton used as x+1.5y<=750. Similar logic for polyester will result in my second constraint of 2x+y<=1000.
Enter the constraints x+1.5y<=750 and 2x+y<=1000 into the constraints tab of the configuration window.
*The solver in R requires all variables to be on the left hand side of the equality/inequality sign. Although the mathematical equivalent of x+1.5y<=750 could be 1.5y<=750-x, it will fail with the error: R.exe exit code (3221225512) indicated an error.
Finally, we need to identify the bounds – namely, manufacturing limits. By default, we know that we cannot negatively manufacture pants or jackets, so the lower boundaries should be 0. However, there was a requirement that at least 200 pairs of pants needed to be manufactured per day, so we will say that X needs to be greater than 200 with no upper boundary limit. Conversely, we have jackets with an upper limit of 400/day. The range of manufacturing jackets could be anywhere from 0 to 400!
Bounds: 200<=x<=+inf and 0<=y<=400
Enter the limits into the bounds & types tab in the configuration pane and run the tool.
In the “S” (static) output, you can view the objective outcome and the values used for each variable to achieve the maximized objective. In this case, we can see that based on the material we have a manufacturing limits, we can have as much $28,750 in sales if we use the existing resources to manufacture 375 pairs of pants and 250 jackets. Also, feel free to view you interactive results that return from the "I" output!
Happy optimizing!