Complex transportation modeling topologies

This section has shown the building blocks of the transportation modelling component. To the greatest degree possible these components have been fully generalized so that they may be arranged in a variety of configuration. For example, Patchworks transportation models have been built to model provincial level wood supplies representing a 21 million m3/year harvest over 39 supply areas, 60 mill destinations, and over a hundred thousand road segments. Although this is a large model, it solves in a reasonable amount of time and provides useful insights in to a complex management problem.

The lesson learned from building large and complex transportation models is that the input relationships between supply areas and demand points are best captured in regular data structures, with scripting used to build the account relationships. This is a much better approach than simply cutting and pasting a series of API calls to add accounts, as was shown in these simple examples. Cutting and pasting long repetitive blocks of code is tedious and highly prone to errors that are difficult to detect. Regular data structures are easier to review and modify, and errors in the scripting code can be debugged once (hopefully) and will continue to work reliably.

The script library contains the script_routeDefinition script, which is an example of a BeanShell scripted data structure that expresses supply zones, product categories, destination requirements and quotas. This script can be used as follows:

global.routeData = routeDefinition();  1

routeData.addRequirement("RyamChapleau", "SPF", "GCF", 75000); 2
routeData.addRequirement("RyamCochrane", "SPF", "GCF", 75000); 
routeData.addRequirement("RyamHearst", "SPF", "GCF", 21000); 
routeData.addRequirement("RyamKapuskasing", "SPF", "GCF", 765000); 
routeData.addRequirement("LecoursCalstock", "SPF",  "GCF", 7800);
routeData.addRequirement("RyamKapuskasing", "Ce", "GCF", 5000); 

routeData.addProductRequirement("ColumbiaHearst", "product.YieldProduct.Po.Veneer", "PoVeneer",  "GCF", 60300);
routeData.addProductRequirement("RockshieldCochrane", "product.YieldProduct.Po.Veneer", "PoVeneer",  "GCF", 5600);
routeData.addProductRequirement("GpEnglehart", "product.YieldProduct.Po.Other", "PoOther",  "GCF", 12000);

routeData.addUnutilized("Ce","GCF");  3

routeData.defineAccounts("'GCF'", 100);  4

The programming behind the data structure can be found in the scripts directory of the Patchwork installation folder (it is made up of about 350 lines of program code). The general steps to use this script are:


Call the constructor to create the data structure.


Call a method to add product requirements to the data structure.


Call a method to add unutilized accounts to the data structure.


Call a method to generate the accounts based on the data that has been gathered so far.

The script relies on a standardized format for product account names and may need customization to suit your environment, but it serves as a useful template for building your own tool.