# Alteryx Designer

## Optimization Tool: Entering a Model Manually

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   1) Identify the Objective 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.     2) Identify the Constraints 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.   3) Identify Bounds and Types   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.     4) Reviewing the Results 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!

## Tool Mastery | Optimization

First added to Alteryx Designer in version 10.6, the Optimization Tool is a member of the Prescriptive Tools (included with the Predictive Tools installation) and allows you to solve optimization problems. Mathematical Optimization is the selection of the best possible option(s), given a set of alternatives and a selection criterion. In this Tool Mastery, we will review the inputs, configuration, and outputs of the Optimization Tool.

## R Plugin Compatibility

With the release of 10.6 came awesome new features, and an upgrade in the underlying R version (from 3.1.3 code named "Smooth Sidewalk," to 3.2.3 code named "Wooden Christmas-Tree").  Using the incompatible R version will cause errors in your R macros.     Simply make sure that your Predictive Tools download is the version compatible with your Alteryx Designer version:     Users on 10.5 should continue to use the R3.1.3 version.   When using Alteryx and Microsoft Revolution R Enterprise, a separate predictive tools install is required (in green). For details, see the Alteryx and Revolution Analytics Integration Guide.   And remember to use the non-Admin Predictive version with non-Admin versions of Alteryx Designer.   To install Predictive Tools for Alteryx 10.0, go to Previous Releases. For Alteryx 9.5, within Designer, go to Help > Install Predictive Tools.    Happy Alteryx-ing!