Step 7: Define the objective function
The objective function in your optimization model is structured like the expression on one side of a constraint. It’s a collection of summands that sum up multiplicands. The sense of the objective function states whether the objective function is going to be maximized or minimized - so whether it will find the highest or lowest possible value of the objective.
As with a constraint, the multiplicands in a summand can be:
A constant that you’ve defined in your optimization model.
A decision variable that you’ve defined in your optimization model.
A table composed of columns from one of the data sources in your optimization model.
Your summands can specify summation indexes, and you can filter the values in those columns. Usually the summands for an objective function are one or more decision variables, and related parameters such as a cost or revenue calculation based on your data sources.
Here’s how to define the objective function in the Optimization Engine UI:
Go to the section Objective Function on the Optimization Engine page.
In Sense, choose whether the objective function is going to be minimized or maximized.
In Summands, click Add Summands to add each summand, and give the summand a name. You can duplicate and edit a summand by clicking its context menu (the three vertical dots). You can also rename or delete a summand from the context menu.
If you want to create the sum over one or more indices for this summand, click Add Summation Index, and enter the name of a column from your data source. If the column has numeric values, you can enter a filter rule for it under Filter Rule to include only the matching records (if you don’t, all records are considered). A column that you choose as a summation index must be referenced somewhere in the multiplicands you’re going to use for this sum.
Click Add Multiplicands to add each multiplicand for this summand, and give the multiplicand a name. You can duplicate, rename, or delete a multiplicand by clicking its context menu (the three vertical dots). Select the type of multiplicand (constant, decision variable, or table), then fill in the additional information depending on the type:
Constant - Enter the name of a constant that you’ve defined in your optimization model. (Go back to the Constants section if you need to add one.)
Variable - Enter the name of a decision variable that you’ve defined in your optimization model. (Go back to the Decision Variables section if you need to add one.)
Table - Enter the name of a data source that you’ve defined in your optimization model. (Go back to the Data Sources section if you need to add one.) Enter the name of the column that contains the values for the multiplicand. Then click Add Index Mapping and add each column in the data source that’s used as a summation index in this summand.
Next step: Step 8: Run the optimization model