Optimizing Assortment Selection
Overview
Optimization refers to a field of applied mathematics that utilizes mathematical techniques and algorithms to find the most optimal solution to a given equation. Given a scenario where there are budget constraints and space constraints, a set of items needs to be chosen to be placed on the shelves for sale. Working within these constraints, a maximum profit is desired. In this tutorial, we will be addressing this assortment problem and proceed to find out which subset of items will make the most profit within the given constraints.
📋 RequirementsInfor AI Security Roles:
Assortment Files download |
Download Assortment Files
Tutorial
1
Navigate
Navigate to the Artificial Intelligence section of the Infor CloudSuite.
Navigate to the 'Datasets' section option under the 'Data Collection' tab on the lefthand menu.
2
Add datasets
Add the datasets included in the download
- Import data from 'BudgetLimit.csv', 'SelectionProblem.csv', and 'SpaceLimit.csv' as three distinct datasets.
- For each imported file, provide the following details and save the dataset:
- Name: A unique identifier referring to the current file's dataset.
- File: The current file to upload and import.
- Delimiter: The character or symbol used to separate individual fields (columns) within the dataset file.
Save after creating each dataset. You don't have to wait for the data to be loaded before moving to create the next dataset.
Note: In a shared training/testing environment, it is recoomended to add your initials to all the variable names to find your content more easily, for example XX_Budget_Limit.
3
Create group
Navigate to the 'Groups' option under the 'Data Collection' tab.
Add a data group, select all three files for the group, and assign a name. We used Profit_Optimization.
4
Create quest
- Navigate to the ‘Quests’ section. Open the 'Optimization' option in the left-hand menu. The 'Quests' feature is where we will build the model.
- Click 'Add New Quest' and provide the following details:
Name: A unique identifier for the optimization model. In this case, name the model "Profit_Optimization".
Set Data Collection: Select the data group created earlier. In this case, select 'Profit_Optimization' (or the name you chose).
Quest Design Notes:
In the center of the ‘Quests Design’ page, there are tiles at the bottom of the screen that help deal with the process of building an optimization model. You can drag and drop each option to the center of the page and within their respective columns. Be sure to click the ‘Save’ button at the top when finished with added activities. In this tutorial, the ‘Prepare Data‘ tile is not used.
- Prepare Data: Allows you to perform data preparation tasks that are specific to the model, which include data cleaning, handling missing values, scaling variables, and encoding categorical variables.
- Setup Model: Enables you to define a mathematical representation of the optimization problem and you are able to define a goal for the optimization problem or define any constraints.
- Optimize Model: Triggers the optimization process and the model is solved using optimization algorithms and techniques to find the best solution that also satisfy the given conditions.
- Results: Provides you with the output and insights from the optimization process, such as the optimal values of the objective function, decision variables, satisfied and unsatisfied constraints, and additional analysis.
5
Setting up the model
Drag and drop the 'Setup Model' tile into its designated column.
Provide the naming information: "Profit Optimization".
Fill in the Sets/Indices & Constant section:
- 'Space_Limit' → 's'
- 'Item_Details' → 'i'
- 'Budget_Limit' → 'b'
Click 'Save'.
6
Create decision variables
- Click on the 'Decision Variables' tab.
- Click the '+' button to add a new decision variable:
- Name: "ItemSelected"
- Variable: "x"
- Dimension: 1
- Index: "i" (representing items in the assortment)
- Domain: "Binary" (Yes/No selection for an item)
- Click 'Save'.
7
Set up constraints
Move to the Constraints tab. This section represents the logical conditions that the solution to the optimization problem must satisfy. In this case, the constraints are the budget limit and the amount of space that is available to use. So, add these constraints by clicking on the ‘+’ button and provide the following information.
Name: A unique identifier referring to the constraint.
- Budget to represent our maximum budget constraint.
- Space to represent our space availability constraint.
Dimension: Refers to the dimensionality of the constraint.
- The dimension for ‘Budget‘ is 1.
- The dimension for ‘Space‘ is 1
Index: Refers to the set or range of values that the constraint can take.
- The index variable name for ‘Budget‘ is ‘b‘.
- The index variable name for ‘Space‘ is ‘s‘
Condition: An optional field that allows for more complex logical filtering. We will not be defining a condition in this tutorial. For more information, refer to the product’s documentation.
Function Declaration: The mathematical expression that defines the constraint. You can use the expression builder to help build this mathematical expression by providing the appropriate parameters. Click on the pencil to provide the following information and be sure to click the ‘Save’ button when finished.
You can copy the following functions for Budget and Space constraints, or use the ‘Expression Builder’. When using the ‘Expression Builder’, note that the SUM is called Sigma under the ‘Insert Function’ list. Pay close attention to right order of items in your function. Note! Your naming might differ from the example.
- For ‘Budget‘, the function declaration is the ‘sigma function‘ for the sets/indices ‘i‘ & ‘b‘ of the decision variable representation ‘x‘ and has these parameters: ‘Item_Details.COST‘ and ‘Budget_Limit.BUDGET_LIMIT‘. This expression translates to the sum of the costs of corresponding selected items in the assortment cannot exceed or must be less than or equal to the allocated budget.
- Budget Constraint:
SUM<i>{x[i] * Item_Details.COST[i]} <= Budget_Limit.BUDGET_LIMIT[b] - For ‘Space‘, the function declaration is the ‘sigma function‘ for the sets/indices ‘i‘ & ‘s‘ of the decision variable representation ‘x‘ and has these parameters: ‘Item_Details.SPACE‘ and ‘Space_Limit.SPACE_LIMIT‘. This expression translates to the sum of the available spaces of corresponding selected items in the assortment cannot exceed or must be less than or equal to the space available.
- Space Constraint:
SUM<i>{x[i] * Item_Details.SPACE[i]} <= Space_Limit.SPACE_LIMIT[s]
Click ‘Save’.
Constraint Function Explained
Here’s a brief explanation of the equation used for the constraints:
SUM<i>{x[i] * Item_Details.COST[i]} <= Budget_Limit.BUDGET_LIMIT[b]
- SUM<i>
This is your sigma function — it says: “Add up the stuff for every item i you’re looking at.“
- x[i]
This is like a switch for each item:
x[i] = 1 means you picked that product.
x[i] = 0 means you didn’t pick it.
- ItemDetails.COST[i]
This is the cost of each item i. So if item 1 costs $5, then Item_Details.COST[1] = 5.
- Multiplication: x[i] * Item_Details.COST[i]
If you didn’t select an item (x[i] = 0), its cost is 0 in the sum. If you did select it (x[i] = 1), its cost is added.
- The sum (Σ)
When you do SUM<i>, you add up all the selected items’ costs.
- <= Budget_Limit.BUDGET_LIMIT[b]
This says: "The total cost from the sum must be less than or equal to the budget limit for budget b."
8
Set up objectives
Move to the Objectives tab where we set our goal. This section represents a mathematical equation that maximizes or minimizes a numeric value to solve the optimization problem. Click on the ‘+’ button to add a new objective function and provide the following information. Be sure to click the ‘Save’ button when finished.
- Name: A unique identifier referring to the objective, which will be named, ‘Revenue‘.
- Sense: Specifies the direction of the goal, whether to maximize or minimize the value of the objective. In this case, select ‘MAXIMIZE‘ from the drop-down menu.
- Function declaration: The mathematical expression that defines the objective. You can use the expression builder to help build this mathematical expression by providing the appropriate parameters. Click on the pencil to provide the following information and be sure to click the ‘Save’ button when finished. In this case, the function declaration is the ‘sigma function‘ for the sets/indices ‘i‘ of the decision variable representation ‘x‘ and has the parameter ‘Item_Details.POTENTIAL_REVENUE‘. This translates to the sum of each selected item in the assortment should reach its maximum potential.
- Objective function:
SUM<i>{x[i]*Item_Details.POTENTIAL_REVENUE[i]}
9
Optimize model
Return to the quest layout, and add an Optimize Model block to the workflow. Provide the following information and be sure to save your work when finished:
Name: A unique identifier referring to the optimize model object, which we will name ‘Optimize CBC‘.
Solver: Refers to the optimization algorithm or solver that will be used to find the optimal solution for the model. In this case, we will stick with the default, ‘CBC‘ (Coin-Or Branch and Cut), which is an open-source linear program (LP) and mixed-integer program (MIP) solver. This solver is intended to be used primarily as a callable library to create customized branch-and-cut solvers. Refer to the ‘Solvers Reference‘ section under ‘Optimization‘ for more information about the different solvers.
Model/Custom Algorithm: Refers to the optimization model that we are currently using, which will be ‘Profit Optimization‘ in this tutorial.
Iterations: An optional field that refers to the limit the number of iterations that will be used. This is helpful to use for large or time-consuming tasks. Endpoint Schema: Refers to the all the components that are going to be included in the JSON message.
- Parameters Selected: Select all the parameters from the selection list on the left.
- Constants Selected: Select all the constants from the selection list on the left.
- When finished with selections, click on the ‘Run’ button and ‘Save’ button within the ‘Endpoint Schema’ window.
10
Compare solvers (optional)
Drag and drop another ‘Optimize Model‘ tile as we utilize another solver, so that we can make comparisons. Be sure to save your work when finished.
Name: ‘Optimize Bonmin‘
Solver: Select ‘BONMIN‘ from the drop-down menu. BONMIN is an open-source C++ code for solving linear (LP), non-linear, and general mixed integer nonlinear programming (MINLP) problems.
Model/Custom Algorithm: ‘Profit Optimization‘.
Endpoint Schema: Refers to the all the components that are going to be included in the JSON message.
- Parameters Selected: Select all the parameters from the selection list on the left.
- Constants Selected: Select all the constants from the selection list on the left.
- When finished with selections, click on the ‘Run’ button and ‘Save’ button within the ‘Endpoint Schema’ window.
11
Run Quest
Save your current progress and run the quest by clicking on the play button.
The ‘Results‘ tile will provide insights about the model’s performance when the optimizer run is complete. We can see the max Revenue is 5128, and that it took the CBC solver only 61 iterations to the get to the solution, while Bonmin needed 410 iterations.
12
Take the Quest to production
We can then deploy the best performing solver, which is the ‘CBC‘ solver in our case as it had less iterations, a faster runtime, and was able to identify the same maximum profit than ‘BONMIN’. Select the solver of choice and click on the ‘Production Quest’ button.
When prompted to select the type of production quest to deploy, select ‘Realtime Production‘ and click on the ‘Create Production Quest’ button.
13
Next step
An Endpoint is an exposed access point to a deployed model. The Endpoint has a defined input structure and details what can be expected for output. When it is sent data, the optimization logic runs in the background and reports back the optimal result
Once the CBC model has been put to Production, go to the ‘Realtime Production’ tab and then to the ‘Optimize Model’ step.
Click on Endpoint Schema. Choose all variables/constants and click Run on Runtime Input Schema.
SAVE and then click ‘Deploy Endpoint’. The Quest is now ready to be run with data. Once you run the Production model. Your Endpoint will be visible in the ‘Optimization/Endpoints’ where you can select an endpoint from the list to activate, deactivate, or delete. You must deactivate an endpoint before you can delete it. Additionally, you can select an endpoint and update the description.
What made this section unhelpful for you?
On this page
- Optimizing Assortment Selection