Running a Scenario Set

You may want to run a series of scenarios to incrementally assess the impact of a range of objectives on a range of variables. This is where a well documented, repeatable and deliberate "Structured Anlaysis" is recommended. For example, you may have a series of visual quality, growing stock, patching, volume, route budget, and access objectives. You may want to determine the effect of these objectives on harvest volumes, patching and costs. Batch scripts enable you to run the series without ongoing input from you. You may plan out your series of scenarios like this:

  1. Plan which targets will be tested in each scenario. For example:

    Figure 74. Possible Target Set for the Crowsnest Pass

    Targets set for three scenarios


  2. Code model components that correspond to each of your targets. This will be your "menu" or "common" set of targets from which you will choose a subset for each of your scenarios. Each of your targets will have a target name and a descriptive string that is used to document each target in the scenario output file. They will also belong to a "target category". This will limit more than one target from being selected within one category. In the following examples, we will explain two possible target categories for the Crowsnest Pass dataset. The following example is excerpted from the beanshell script c:\Program Files\Spatial Planning Systems\Patchworks\sample\analysis\common.bsh.

    Example 1. Defining a visual quality target in the common.bsh file

     
    useVQO = new TargetDescription("Ensure less than 20% of the area is
         less than free to grow in any VQO zone", "VQO") { 1
       void apply() {
          ArrayList list = new ArrayList(control.getTargetLabels());
          Collections.sort(list);
          for (int i=0; i≤listsize(); i++) {
      String label = list.get(i);
      if (label.startsWith("feature.VQO."))                2
         setActive(label, true, false, true);              3
          }
       }
    };
                                                 
    
    noVQO= new TargetDescription("No disturbance level control in VQO areas", "VQO")  {   4
      void apply() {
          ArrayList list = new ArrayList(control.getTargetLabels());
          Collections.sort(list);
          for (int i=0; i≤list.size(); i++) {
      String label = list.get(i);
      if (label.startsWith("feature.VQO.")) 
         setActive(label, false, false, true);                5
          }
       } 
    };
    
     

    1

    The name of the target is useVQO. When this function is called in your scenarios file, this target will be used. A descriptive string can be added followed by the target category. Only one target per category will be allowed.

    2

    The value of any target that starts with feature.VQO will be used as the visual quality target. This is equivalent to 20% of the area of each VQO area.

    3

    The setActive method sets the target as active, and sets it as a maximum target. The first "true" or "false" corresponds to setting the target on or off, the next two correspond to whether the target is minimum or maximum.

    4

    The name of the target is noVQO. When this function is called in your scenarios file, there will be no visual quality target.

    5

    The "true" from the previous target has now been changed to "false". Any target that begins with feature.VQO will turned off.


    Example 2. Defining a harvest volume target in the common.bsh file

    aspatialHarvest= new TargetDescription("Annual aspatial harvest targets:Conifer-100,000; Deciduous-4,000 m3", 
                                    "Harvest volume") { 1
    void apply() {
          setActive("product.Yield.managed.Conif", true, true, false);   2
          setTarget("product.Yield.managed.Conif", 100000, 100000);      3
          setMinWeight("product.Yield.managed.Conif", 1000);
          setActive("product.Yield.managed.Decid", true, true, false);  4 
          setTarget("product.Yield.managed.Decid", 4000, 4000);         5
          setMinWeight("product.Yield.managed.Decid", 1000);
       }
    };
    
    deliveredHarvest= new TargetDescription("Annual delivered wood harvest targets.  
                                      These targets specify the amount of volume delivered to each mill:
                                      Mill 1-Conifer-10,000m3 ;Mill 1-Deciduous-4,000m3 ;Mill 2-Conifer-90,000m3", 
                                      "Harvest volume") {
       apply() {
          setActive("product.Mill1.Conif", true, true, false);           6
          setTarget("product.Mill1.Conif", 10000, 10000);
          setMinWeight("product.Mill2.Conif", 10000);
          setActive("product.Mill1.Decid", true, true, false);
          setTarget("product.Mill1.Decid", 4000, 4000);
          setMinWeight("product.Mill1.Decid", 1000);
          setActive("product.Mill2.Conif", true, true, false);
          setTarget("product.Mill2.Conif", 90000, 90000);
          setMinWeight("product.Mill2.Conif", 1000);
       }
    };
    

    1

    The name of the target is aspatialHarvest. When this function is called in your scenarios file, this target will be used. A description string follows that may or may not contain html tags which will form a table in the scenario description .This is followed by the target category.

    2

    The product.Yield.managed.Conif target will be set as active and as a minimum.

    3

    The product.Yield.managed.Conif target will be set as 100,000 m3 per year.

    4

    The product.Yield.managed.Decid target will be set as active and as a minimum.

    5

    The product.Yield.managed.Decid target will be set as 4000 m3 per year.

    6

    For the second harvest volume target deliveredHarvest, the product.Mill1.Conif etc. accounts are used, so that targets on only wood going to a particular destination can be made.


  3. Once the common.bsh file has been set up, you are ready to set up the scenario set file that lists the targets that you have chosen for each scenario from the common file. This scenario file represents combinations of targets from the common.bsh file that are selected and combined into scenarios. The link between the two files is the target name. The relationship between the two files is illustrated below:

    Figure 75. Relationship between the common and scenario set beanshell files

    The link between the common and scenario set beanshell files is the target name.


    The following example explains a few of the scenarios from the C5_ScenarioSet.bsh found in the c:\Program Files\Spatial Planning Systems\Patchworks\sample\ analysis folder. When you examine this file, you will notice that the common.bsh is sourced at the beginning of the C5_ScenarioSet.bsh file.

    Example 3. A possible scenarios.bsh file

    
    
    s.addScenario("C5_Aspatial1",                                         1
                  "The aspatial1 run imposes an aspatial harvest 
                   target and a minimum growing stock objective.",
                  new TargetDescription[] {noVQO, 
                                           useConifGS,  
                                           noDisturbancePatch, 
                                           noHarvestPatches,              2
                                           aspatialHarvest,
                                           unlimitedRoadBudget,
                                           noCompartAccess}
                  );   
    
    
    s.addScenario("C5_Aspatial2",                                          
           "The aspatial2 run builds on aspatial1 and includes VQO 
            and harvest retrictions in several landscape units.",
           new TargetDescription[] {useVQO, 
                      useConifGS,  
                      noDisturbancePatch, 
                      noHarvestPatches,               
                      aspatialHarvest,
                      unlimitedRoadBudget,
                      useCompartAccess}
           );   
    
    
    s.addScenario("C5_Spatial1",                                          3 
           "The Spatial1 builds on Aspatial2, and adds broad patch 
            and generous road objectives.  Harvest targets are 
            applied towards specific mill destinations.",
           new Target Description[] {useVQO, 
                       useConifGS,  
                       useBroadDisturbancePatch, 
                       useHarvestPatches,            4 
                       deliveredHarvest,
                       highRoadBudget,
                       useCompartAccess}
           );   
    

    1

    The name of the scenario is C5_Aspatial1. When this scenario is selected from the pop-up menu, (see Figure 77, “The Patchworks console and the Set batch processing option windows”) this scenario will run. A string containing a description of the scenario that will display in the report index can be added here.

    2

    There are 7 targets listed for this scenario. There is no visual quality target, there are no patching targets, wood can be delivered to any mill, there is unlimited budget for roading, and no deferred harvest in special compartments.

    3

    The name of the scenario is C5_Spatial1. When this is selected from the pop-up menu, (see Figure 77, “The Patchworks console and the Set batch processing option windows”), this scenario will run.

    4

    There are 7 targets listed for this scenario. There are visual quality targets, controls on both harvest and disturbance patches, a road budget, deferred harvest in special compartments and harvest targets are applied towards specified mill destinations.


  4. Source the scenario file from the Patchworks console to run the series of scenarios.

    Figure 76. Sourcing the Scenario Set from the Patchworks console


  5. When the pop-up window shows up, simply check off the boxes of the scenarios you would like to run and wait for the results. Here we checked off the first two aspatial runs and the first spatial run corresponding to: Example 3, “A possible scenarios.bsh file”:

    Figure 77. The Patchworks console and the Set batch processing option windows


If you look in your black command processor window, you will see the scheduler going through the iterations necessary to find an optimal solution for the first scenario set. When the scheduler has found it, it will save the scenario, and continue with the second and third scenario set.