Example 3: Beer Distribution with Limited Routes
The restriction of possible routes can be cumbersome in some optimizing environments. As this example will show, in Analytica, it is a simple matter of changing the dimension of the decision array.
Example 3: Beer Distribution with Limited Routes
Model Description
In the previous examples, we allowed all five Breweries to ship to all four Markets, presenting 20 possible routes. In this example, we confine the shipments to 10 chosen routes and disallow the rest.
Setting Up the Model
To explore and follow this example in Analytica, run the Beer Distribution LP 3.ana model in the Optimizer Examples folder.
In this section, we start with the model from Example 2, detailing changes only.
Create a Route Index
First, we create an index of approved routes. These are specific combinations of Brewery and Market.
Index Route := ['Fairfield North','Fairfield South','Fairfield West', 'Fort Collins North','Fort Collins South', 'Jacksonvile East', 'Merrimack North','Merrimack East', 'St Louis North','St Louis East']
Redefine the Decision input array
In previous examples, we defined the Decision input as a two-dimensional array. In this example we redefine it to be a one-dimensional array along the index of approved routes. Once again, we can insert a dummy value of 1 for the non-optimized quantities since they are not used anywhere else in the model.
Edit the Intrinsic Indexes list
Make sure to also edit the Intrinsic Indexes list. Remove Brewery and Market, and add Route to the list.
Variable Shipment_Quantity := Array(Route, 1) Shipment_Quantity attribute Intrinsic Indexes := [Route]
Re-define the Objective and its inputs
The Objective representing Total Distribution Cost should now sum over the Route index instead of Brewery and Market.
Objective Total_Dist_Cost := Sum(Shipment_Quantity * Dist_per_case, Route)
All inputs to Total Distribution Cost should be also dimensioned by Route. We redefine the Distance array using corresponding values from the original table.
Variable Distance := Table(Route)(1.8,2.2,0.1,0.3,1.2,0.6,1.2,0.2,0.5,0.8)
Enable comment auto-refresher