Difference between revisions of "Example 3: Beer Distribution with Limited Routes"
Jhernandez3 (talk | contribs) |
Jhernandez3 (talk | contribs) |
||
Line 11: | Line 11: | ||
===Setting Up the Model=== | ===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. | + | 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. | In this section, we start with the model from Example 2, detailing changes only. | ||
− | ''Create a Route Index'' | + | '''Create a Route Index''' |
− | First, we create an index of approved routes. These are specific combinations of Brewery and Market. | + | First, we create an index of approved routes. These are specific combinations of '''Brewery''' and '''Market.''' |
<nowiki>Index Route := | <nowiki>Index Route := | ||
Line 32: | Line 32: | ||
'''Edit the Intrinsic Indexes list''' | '''Edit the Intrinsic Indexes list''' | ||
− | Make sure to also edit the Intrinsic Indexes list. Remove Brewery and Market, and add Route to the list. | + | Make sure to also edit the Intrinsic Indexes list. Remove '''Brewery''' and '''Market''', and add '''Route''' to the list. |
+ | <code>Variable Shipment_Quantity := Array(Route, 1) | ||
+ | Shipment_Quantity attribute Intrinsic Indexes := [Route]</code> | ||
+ | '''Redefine 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. | |
− | |||
− | |||
− | |||
− | |||
− | 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. | ||
<nowiki>Variable Distance := | <nowiki>Variable Distance := | ||
Table(Route)(1.8,2.2,0.1,0.3,1.2,0.6,1.2,0.2,0.5,0.8) </nowiki> | Table(Route)(1.8,2.2,0.1,0.3,1.2,0.6,1.2,0.2,0.5,0.8) </nowiki> | ||
<footer> Optimization Characteristics / {{PAGENAME}} / Key Concepts: The Airline NLP Example</footer> | <footer> Optimization Characteristics / {{PAGENAME}} / Key Concepts: The Airline NLP Example</footer> |
Revision as of 06:39, 18 November 2015
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.
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]
Redefine 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