public class Control extends Object
Target
s and AttributeStore
s
Modifier and Type | Method and Description |
---|---|
void |
addAccount(String group,
String attribute,
boolean sum,
String account)
Deprecated.
|
void |
addAccount(String group,
String attribute,
String account)
Add a summary account to the model.
|
void |
addAccount(String group,
String attribute,
String account,
double factor)
Add a summary account to the model.
|
void |
addAccount(String group,
String attribute,
String account,
double[] factors)
Add a summary account to the model.
|
void |
addEdgeElement(String account,
String attribute1,
String attribute2,
double factor)
Add an edge contrast specification to an edge target.
|
void |
addEdgeTarget(String account,
Topology topology)
Create an edge target, using the specified topology to determine
stand adjacency.
|
void |
addExclusiveAccount(String match,
String account)
Add an exclusive account to the model.
|
void |
addExclusiveDependent(String exclusive,
String choice,
String source,
String sink,
double factor)
Add an exclusive dependent account to the model.
|
void |
addExclusiveDependent(String exclusive,
String choice,
String source,
String sink,
double[] factors)
Add an exclusive dependent account to the model.
|
void |
addFlowRatioAccount(String account,
String input,
FlowSpec flowPeriods,
double ratioScale)
Add a flow ratio account to the model.
|
void |
addFlowRatioAccount(String account,
String input,
FlowSpec flowPeriods,
double ratioScale,
boolean annual)
Add a flow ratio account to the model.
|
void |
addFlowRatioAccount(String account,
String input,
int[] flowPeriods,
double ratioScale)
Add a flow ratio account to the model.
|
void |
addFlowRatioAccount(String account,
String input,
int[] flowPeriods,
double ratioScale,
boolean annual)
Add a flow ratio account to the model.
|
void |
addFlowRatioAccount(String account,
String input,
int flowPeriod,
boolean skipFirst)
Add a flow ratio account to the model.
|
void |
addFlowValueAccount(String account,
String input,
FlowSpec flowPeriods)
Add a flow value account to the model.
|
void |
addFlowValueAccount(String account,
String input,
int[] flowPeriods)
Add a flow value account to the model.
|
void |
addFlowValueAccount(String account,
String input,
int flowPeriod,
boolean skipFirst)
Add a flow value account to the model.
|
void |
addGroupDistributionAccount(String account,
String[] groupNames,
double[] groupTotals)
Create a new GroupDistibutionAccount.
|
void |
addGroupDistributionSubAccount(String groupAccount,
String subAccount,
double min,
double max)
Create a sub-account within a GroupDistributionAccount.
|
void |
addMetaAccount(String account,
String[] components,
double[] factors)
Add a meta account to the model.
|
void |
addMetaAccount(String account,
String[] components,
double[][] factors)
Add a meta account to the model.
|
void |
addNote(String details)
Add a note to the log file.
|
void |
addNote(String category,
String details)
Add a note to the log file.
|
void |
addPatchTarget(String criteria,
String label,
double min,
double max)
Add a patch target account to the model.
|
void |
addProgressListener(ObjectiveProgressReport listener) |
void |
addRatioAccount(String account,
String numerator,
String denominator)
Add a ratio account to the model.
|
void |
addRatioAccount(String account,
String numerator,
String denominator,
double ratioScale)
Add a ratio account to the model.
|
void |
addRouteBuildAccount(String route,
String account)
Add a route construction account to the model.
|
void |
addRouteBuildAccount(String route,
String account,
boolean sum)
Deprecated.
Use
addRouteBuildAccount(String, String, double) instead. |
void |
addRouteBuildAccount(String route,
String account,
double factor)
Add a route construction account to the model.
|
void |
addRouteBuildAccount(String route,
String account,
double[] factors)
Add a route construction account to the model.
|
void |
addRouteHaulAccount(String route,
String account)
Add a route hauling account to the model.
|
void |
addRouteHaulAccount(String route,
String account,
boolean sum)
Deprecated.
Use
addRouteHaulAccount(String, String, double) instead. |
void |
addRouteHaulAccount(String route,
String account,
double factor)
Add a route hauling account to the model.
|
void |
addRouteHaulAccount(String route,
String account,
double[] factors)
Add a route hauling account to the model.
|
void |
addRouteProductAccount(String route,
String account)
Add a route flow account to the model.
|
void |
addRouteProductAccount(String route,
String account,
boolean sum)
Deprecated.
Use
addRouteProductAccount(String, String, double) instead. |
void |
addRouteProductAccount(String route,
String account,
double factor)
Add a route flow account to the model.
|
void |
addRouteProductAccount(String route,
String account,
double[] factors)
Add a route flow account to the model.
|
void |
addRouteRebuildAccount(String route,
String account,
double factor)
Add a route reactivation account to the model.
|
void |
addRouteRebuildAccount(String route,
String account,
double[] factors)
Add a route reactivation account to the model.
|
void |
addRouteRepairAccount(String route,
String account)
Add a route maintenance account to the model.
|
void |
addRouteRepairAccount(String route,
String account,
boolean sum)
Deprecated.
Use
addRouteRepairAccount(String, String, double) instead. |
void |
addRouteRepairAccount(String route,
String account,
double factor)
Add a route maintenance account to the model.
|
void |
addRouteRepairAccount(String route,
String account,
double[] factors)
Add a route maintenance account to the model.
|
void |
addTabulateAccount(String account,
String input,
int[] tabulatePeriods)
Add a tabulate value account to the model.
|
void |
calculateGroups(String expression)
Assign groups as determined by evaluating an expression.
|
void |
cancelTreatments()
Cancel all of the treatments for all blocks in the forest.
|
void |
cancelTreatments(String label)
Cancel all of the treatments for the block with the given
label.
|
void |
cbmExport()
Display a wizard to collect parameters and run the CBM-CFS3 export
tool.
|
void |
cbmExport(String[] classifiers,
String histDist,
String lastDist,
String[] conSppList,
String[] hwdSppList,
String sppRegex,
int evalYear,
String output)
Export files that can be imported in to the CBM-CFS3 model.
|
void |
cbmExport(String[] classifiers,
String histDist,
String lastDist,
String conYield,
String hwdYield,
String conLeadSpp,
String hwdLeadSpp,
int evalYear,
String output)
Export files that can be imported in to the CBM-CFS3 model.
|
void |
close()
Release the structures that have been allocated for the simulation.
|
void |
duplicateAccount(String master,
String child,
double factor)
Dupliate the value of an account into another account.
|
void |
duplicateAccount(String master,
String child,
double[] factors)
Dupliate the value of an account into another account.
|
AccessTableModel |
getAccessTable()
Get a reference to the timing constraints table object.
|
Actions |
getActions()
Get a map containing actions that are known
to the model.
|
Set |
getAttributeLabels()
Get a set object containing all of the attribute labels that
have been loaded into the Patchworks model.
|
GeoRelationalStore |
getBlockTable()
Get a reference to the block table object.
|
Object |
getClientObject() |
ComparisonWriter |
getComparisonWriter() |
ConversionFactors |
getConversionFactors()
Get an object that contains the conversion factors
used in this model.
|
Vector<String> |
getDestinationNames()
Get a sorted list of route destination names
|
ArrayList<EventRecord> |
getEvents(String id,
String treatedManAreaExpr,
String treatedUnmanAreaExpr)
Return a list of event records for the given row.
|
Exclusive |
getExclusiveAccount(String name)
Get an exclusive account by name.
|
Vector<String> |
getExclusiveAccountNames()
Get a sorted list of exclusive account names
|
Report |
getExclusiveAssignmentReport(String filename,
String title,
String exclusive)
Get an exclusive assignment report.
|
Report |
getExclusiveLockReport(String filename,
String title,
String exclusive)
Get an exclusive lock report.
|
Set<String> |
getGroups()
Return a set of all of the defined groups labels.
|
long |
getIteration() |
static int |
getMaximumEntries()
Get the maximum number of management entries within a
stand.
|
Report |
getNetworkCostReport(String filename,
String title)
Get a network cost report.
|
GeoRelationalStore |
getNetworkTable()
Get the network table containing the route shapes as
well as cost and utilization data for every segment
for every destination.
|
double |
getObjectiveValue(boolean details)
Compute the current objective value.
|
Component |
getPerformanceChart()
Get a performance strip chart viewer.
|
ReportWriter |
getReportWriter() |
Report |
getRouteCostReport(String filename,
String title,
String destination)
Get a route cost report.
|
Report |
getRouteReport(String filename,
String title,
String destination)
Get a route report.
|
GeoRelationalStore |
getRouteTable(String label)
Get a route table for a specified route.
|
static Control |
getSharedInstance()
Get a reference to the Control object.
|
StandEventReport |
getStandEventReport(String filename,
String title,
String treatedManAreaExpr,
String treatedUnmanAreaExpr)
Create a Stand Dynamics report.
|
String[] |
getStrataColumns()
Get the names of the stratification columns
|
Target |
getTarget(String label)
Get a target by name.
|
Set<String> |
getTargetLabels()
Get a set of all target labels.
|
Collection<Target> |
getTargets()
Get all targets.
|
AttributeStore |
getTargetTable()
Get a reference to the target table.
|
Component |
getTargetView(String label)
Get a target viewer for a specified target.
|
Report |
getTimingConstraintsReport(String filename,
String title)
Get a timing constraints report.
|
ArrayList<String> |
getTreatmentNames() |
Component |
getTreatmentView(String label)
Get a treatment viewer for a specified block.
|
static void |
identifyPatches(GeoRelationalStore store,
Topology topology,
String label,
String reselect,
int period,
String output)
This method will identify patches within a spatial dataset.
|
void |
initialize(Task task)
Initialize the account values
|
void |
inputGroups(File file)
Load a group definition file.
|
void |
inputGroups(String filename)
Load a group definition file.
|
void |
inputRoute(String label,
String filename)
Input a saved route file.
|
Topology |
inputTopology(File file,
double distance)
Input a topology dataset related to the block dataset.
|
Topology |
inputTopology(String filename,
double distance) |
void |
interrupt()
Send a signal to interrupt the scheduler.
|
boolean |
isSuspended()
Determine if the scheduler is suspended
|
void |
loadAvailable(String filename)
Load a saved file in to initialize block availability data.
|
void |
loadExclusive(String exclusive,
String filename)
Load a saved file in to initialize exclusive account assignments.
|
void |
loadExclusiveLocks(String exclusive,
String filename)
Load a saved file in to initialize exclusive account locks.
|
void |
loadSchedule(String filename)
Load a saved file in to initialize the schedule of treatments.
|
void |
loadSchedule(String filename,
boolean cancelPrevious)
Load a saved file in to initialize the schedule of treatments.
|
void |
loadTargetStatus(String filename)
Load a saved file in to initialize target status data.
|
void |
loadTargetSummary(String filename)
Load a saved file in to initialize target summary data.
|
void |
makeDotFile(String filename) |
void |
makeDotFile(String filename,
int width,
int height,
boolean simplify) |
void |
outputRoute(String label,
String filename)
Save a route definition to a file.
|
void |
removeAccount(String group,
String account)
Remove a summary account from the model.
|
void |
removeProgressListener(ObjectiveProgressReport listener) |
void |
resume()
Resume the scheduler from a suspended state.
|
Topology |
reuseOrLoadTopology(String filename,
double distance,
GeoRelationalStore store,
String label)
Access a previously loaded topology file, or if not already loaded then
input a topology dataset for an arbitrary spatial dataset.
|
boolean |
setBlockAvailable(int row,
boolean[] values)
Set the available timings for all periods.
|
void |
setConversionFactors(String linearMapUnits,
String linearReportUnits,
double linearReportToMap,
String areaMapUnits,
String areaBlockUnits,
double areaBlockToMap)
Set up the conversion factors that describe the spatial units.
|
void |
setInitialValue(String label,
double value,
int period)
Set an initial value for an account.
|
static void |
setMaximumEntries(int entries)
Set the maximum number of consecutive treatments that
are allowed on any polygon.
|
void |
setPatchThreshold(String patch,
double threshold)
Set a threshold on the criteria used to allow blocks to
become a member of a patch.
|
void |
setRandomSeed(long seed)
Set the seed used by the random number generator within the scheduler.
|
boolean |
setTargetDiscountRate(String label,
double rate)
Deprecated.
|
boolean |
setTargetLinear(String label,
boolean value)
Deprecated.
|
boolean |
setTreatment(int index,
String treatment,
int year,
boolean managed)
Apply a treatment to a block in a specific year
|
void |
setTreatmentAffinity(TreatmentAffinity[][] affinities)
Set the list of treatments that are allowed to be scheduled in
the same planning period within the same bunch.
|
void |
showAccountExplorer()
Display the AccountExplorer viewer.
|
void |
showGroupExplorer()
Display the GroupExplorer viewer.
|
void |
suspend()
Suspend the sheduler.
|
void |
waitForIterations(int attempts)
This method will wait for a number of scheduling attempts
to pass before returning to the caller.
|
void |
waitForProgress(int attempts,
double percent)
This method will wait for the objective function to
converge before returning to the caller.
|
void |
waitForProgress(int attempts,
double percent,
ConvergenceSpec[] specs,
ScenarioChangeListener asd)
This method will wait for the objective function to
converge before returning to the caller.
|
void |
waitForProgress(int attempts,
double percent,
String[] patterns,
double[] values,
ScenarioChangeListener asd)
Deprecated.
It is recommended that scenario life cycle management
should be handled using the
ScenarioSet ,
ScenarioDescription and ScenarioChangeListener
mechanism. These methods provide self-documentation and
fine-grained customizable control over how scenarios are run,
including the ability to monitor progress and alter simulation
values. |
void |
waitUntilInitialized()
Wait until the model is initialized.
|
public void setConversionFactors(String linearMapUnits, String linearReportUnits, double linearReportToMap, String areaMapUnits, String areaBlockUnits, double areaBlockToMap)
This method allows the specification of the unit labels to be used in reports, and the conversion factors that should be applied between mapping units and reporting units.
More importantly, this class specifies the relationship between the map units used in the block shape file, which would be used to compute topological relationships in map units, and the polygon areas loaded from the input matrix, which are commonly represented in hectares or acres. This conversion is required to properly support calculation of perimeter-to-area ratios.
The default conversion values are
Factor | Meaning | Default value |
---|---|---|
linearMapUnits | The label to describe the map distance measure in the units of the spatial data set | "m" |
linearReportUnits | The label to describe distance units as preferred for reporting | "Km" |
linearReportToMap | A numeric factor that converts from linear reporting units to linear map units (e.g. kilometres to metres, or miles to feet) | 1,000 |
areaMapUnits | The label to describe the map area measures in the units of the spatial data set | "m2" |
areaBlockUnits | The label to describe area units as described in the input matrix | "ha" |
areaBlockToMap | A numeric factor that converts from input matrix area units to area map units (e.g. hectares to m2, or acres to ft2) | 10,000 |
The default values are equivalent to the following command:
control.setConversionFactors("m"", "Km", 1000, "m2, "ha", 10000);
The values to use for typical American measures would be:
control.setConversionFactors("ft", "miles", 5280, "ft2", "acres", 43560);
This method may only be executed in the context of the target initialization section of the PIN file. An error will occur if this command is encountered after the model has initialized.
public ConversionFactors getConversionFactors()
public static void setMaximumEntries(int entries)
entries
- the maximum number of management entries
within a stand over the management planning horizon.public static int getMaximumEntries()
public void inputGroups(File file)
public void inputGroups(String filename)
public void calculateGroups(String expression)
public Topology inputTopology(File file, double distance)
This method may only be executed in the context of the target initialization section of the PIN file. The topology file is loaded as soon as the command is encountered.
The method will open the named file, load the topological relationships,
and return a reference to the Topology
structure. The
topology that was just loaded becomes the default topology that is
used to create patch accounts, and within the MapViewer
to select neighbour polygons.
Multiple topology datasets may be loaded within a single Patchworks session. The most recently loaded topology file becomes the default topology.
file
- The file containing the topological relationships.distance
- A value that is used to filter records from the
topology file. Only neighbours that are within the filter distance
are loaded from the topology file.public Topology reuseOrLoadTopology(String filename, double distance, GeoRelationalStore store, String label)
This routine will return a topology dataset. This routine will not change the default block topology. You may call this routine at any time.
filename
- The file containing the topological relationships.distance
- A value that is used to filter records from the
topology file. Only neighbours that are within the filter distance
are loaded from the topology file.store
- A reference to the spatial coverage that the topology
file describes.label
- The name of the field in the spatial dataset that
uniquely identifies each row.public void addAccount(String group, String attribute, String account)
group
- The group of blocks that the account is applied toattribute
- The attribute to be summed into the accountaccount
- The name of the accountpublic void addAccount(String group, String attribute, String account, double[] factors)
group
- The group of blocks that the account is applied toattribute
- The attribute to be summed into the accountaccount
- The name of the accountfactors
- An array of scaling factors that will be used to
multiply the values from the attribute, with one value per period.
If the array is shorter than the number of periods the last value
will be repeated.public void addAccount(String group, String attribute, String account, double factor)
group
- The group of blocks that the account is applied toattribute
- The attribute to be summed into the accountaccount
- The name of the accountfactor
- A scaling factor that will be used to multiply the
values from attribute.public void addAccount(String group, String attribute, boolean sum, String account)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
group
- The group of blocks that the account is applied toattribute
- The attribute to be summed into the accountsum
- A flag to indicate if the attribute value
should be added or subtracted from the accountaccount
- The name of the accountpublic void removeAccount(String group, String account)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
group
- The group of blocks that the account is applied toaccount
- The name of the account. If the account is not
found in the group then an exception will be thrown.public void duplicateAccount(String master, String child, double[] factors)
master
- The name of the account that holds the
values to be copied.child
- The name of the account that is to receive the
duplicated values.factors
- An array of scaling factors that will be used to
multiply the values from the attribute, with one value per period.
If the array is shorter than the number of periods the last value
will be repeated.public void duplicateAccount(String master, String child, double factor)
master
- The name of the account that holds the
values to be copied.child
- The name of the account that is to receive the
duplicated values.factor
- A scaling factor to be applied to the duplicated account.public void addExclusiveAccount(String match, String account)
match
- The name of the exclusive accountaccount
- The output account that is one of the options
for this exclusive account.public void addExclusiveDependent(String exclusive, String choice, String source, String sink, double[] factors)
exclusive
- The name of the exclusive accountchoice
- The output account that was selected by
the exclusive accountsource
- The account that contains the values to be added
for this exclusive account.sink
- The account to add the values into, if the choice was
selected in the exclusive account.factors
- An array of scaling factors that will be used to
multiply the values from the attribute, with one value per period.
If the array is shorter than the number of periods the last value
will be repeated.public void addExclusiveDependent(String exclusive, String choice, String source, String sink, double factor)
exclusive
- The name of the exclusive accountchoice
- The output account that was selected by
the exclusive accountsource
- The account that contains the values to be added
for this exclusive account.sink
- The account to add the values into, if the choice was
selected in the exclusive account.factor
- A scaling factor to be applied to the source values.public void addPatchTarget(String criteria, String label, double min, double max)
criteria
- The name of the patch criteria account. The first
time the criteria account is referenced a Patcher account will be
created using the current default topology. Any subsequent
patch targets with the same criteria name will be associated with
this Patcher, regardless if the default topology changes.label
- The name to be given to this patch accountmin
- The minimum size of patches in this accountmax
- The maximum size of patches in this accountpublic void setPatchThreshold(String patch, double threshold)
This method will only work after the patch target has been defined
(after calling the addPatchTarget(java.lang.String, java.lang.String, double, double)
method).
patch
- The name of the patch criteria account.threshold
- The threshold criteria value. The criteria must
be greater (on a per unit basis) than this value for the block to
join in a patch. The default value is 0.public void addRouteHaulAccount(String route, String account)
route
- The name of the route of interestaccount
- The name to be given to this accountpublic void addRouteHaulAccount(String route, String account, double factor)
route
- The name of the route of interestaccount
- The name to be given to this accountfactor
- A factor used to multiply haul values.public void addRouteHaulAccount(String route, String account, double[] factors)
route
- The name of the route of interestaccount
- The name to be given to this accountfactors
- An array of scaling factors that will be used to
multiply the values from the attribute, with one value per period.
If the array is shorter than the number of periods the last value
will be repeated.@Deprecated public void addRouteHaulAccount(String route, String account, boolean sum)
addRouteHaulAccount(String, String, double)
instead.route
- The name of the route of interestaccount
- The name to be given to this accountsum
- A flag to indicate if the attribute value
should be added or subtracted from the accountpublic void addRouteBuildAccount(String route, String account)
route
- The name of the route of interestaccount
- The name to be given to this accountpublic void addRouteBuildAccount(String route, String account, double factor)
route
- The name of the route of interestaccount
- The name to be given to this accountfactor
- A factor used to multiply haul values.public void addRouteBuildAccount(String route, String account, double[] factors)
route
- The name of the route of interestaccount
- The name to be given to this accountfactors
- An array of scaling factors that will be used to
multiply the values from the attribute, with one value per period.
If the array is shorter than the number of periods the last value
will be repeated.@Deprecated public void addRouteBuildAccount(String route, String account, boolean sum)
addRouteBuildAccount(String, String, double)
instead.route
- The name of the route of interestaccount
- The name to be given to this accountsum
- A flag to indicate if the attribute value
should be added or subtracted from the accountpublic void addRouteRebuildAccount(String route, String account, double factor)
route
- The name of the route of interestaccount
- The name to be given to this accountfactor
- A factor used to multiply haul values.public void addRouteRebuildAccount(String route, String account, double[] factors)
route
- The name of the route of interestaccount
- The name to be given to this accountfactors
- An array of scaling factors that will be used to
multiply the values from the attribute, with one value per period.
If the array is shorter than the number of periods the last value
will be repeated.public void addRouteRepairAccount(String route, String account)
route
- The name of the route of interestaccount
- The name to be given to this accountpublic void addRouteRepairAccount(String route, String account, double factor)
route
- The name of the route of interestaccount
- The name to be given to this accountfactor
- A factor used to multiply haul values.public void addRouteRepairAccount(String route, String account, double[] factors)
route
- The name of the route of interestaccount
- The name to be given to this accountfactors
- An array of scaling factors that will be used to
multiply the values from the attribute, with one value per period.
If the array is shorter than the number of periods the last value
will be repeated.@Deprecated public void addRouteRepairAccount(String route, String account, boolean sum)
addRouteRepairAccount(String, String, double)
instead.route
- The name of the route of interestaccount
- The name to be given to this accountsum
- A flag to indicate if the attribute value
should be added or subtracted from the accountpublic void addRouteProductAccount(String route, String account)
route
- The name of the route of interestaccount
- The name to be given to this accountpublic void addRouteProductAccount(String route, String account, double factor)
route
- The name of the route of interestaccount
- The name to be given to this accountfactor
- A factor used to multiply haul values.public void addRouteProductAccount(String route, String account, double[] factors)
route
- The name of the route of interestaccount
- The name to be given to this accountfactors
- An array of scaling factors that will be used to
multiply the values from the attribute, with one value per period.
If the array is shorter than the number of periods the last value
will be repeated.@Deprecated public void addRouteProductAccount(String route, String account, boolean sum)
addRouteProductAccount(String, String, double)
instead.route
- The name of the route of interestaccount
- The name to be given to this accountsum
- A flag to indicate if the attribute value
should be added or subtracted from the accountpublic void addMetaAccount(String account, String[] components, double[] factors)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
account
- The name to be given to this accountcomponents
- The names of the accounts that will be summed.factors
- The factors that will be applied to each account.public void addMetaAccount(String account, String[] components, double[][] factors)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
account
- The name to be given to this accountcomponents
- The names of the accounts that will be summed.factors
- Arrays of scaling factors that will be used to
multiply the values from the attribute, with one value per period.
If the array is shorter than the number of periods the last value
will be repeated.public void addFlowRatioAccount(String account, String input, int flowPeriod, boolean skipFirst)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
account
- The name to be given to this accountinput
- The names of the account that the flow policy
will apply to.flowPeriod
- An offest value to specified the relative
period that the flow will be compared to.skipFirst
- If true then do not compare flows between
initial conditions and the first period.FlowRatioTarget
public void addFlowRatioAccount(String account, String input, int[] flowPeriods, double ratioScale)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
The flow ratios are based on the comparison of periodic values.
This is appropriate if the planning periods are the same width,
or if comparing extant inventory values (e.g. features).
If comparing product values between periods of different widths
then use the form
addFlowRatioAccount(String, String, int[], double, boolean)
.
account
- The name to be given to this accountinput
- The names of the account that the flow policy
will apply to.flowPeriods
- An array of offest values to specified the
period that the flow in each period will be compared to. Specify an
offset value the same as the period to skip calculation for that period.ratioScale
- A value used to scale the resulting ratio.
The default value is 100, which will display the values as a
percent.FlowRatioTarget
public void addFlowRatioAccount(String account, String input, FlowSpec flowPeriods, double ratioScale)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
The flow ratios are based on the comparison of periodic values.
This is appropriate if the planning periods are the same width,
or if comparing extant inventory values (e.g. features).
If comparing product values between periods of different widths
then use the form
addFlowRatioAccount(String, String, int[], double, boolean)
.
account
- The name to be given to this accountinput
- The names of the account that the flow policy
will apply to.flowPeriods
- A FlowSpec object that describes how
periods should be compared.ratioScale
- A value used to scale the resulting ratio.
The default value is 100, which will display the values as a
percent.FlowRatioTarget
public void addFlowRatioAccount(String account, String input, int[] flowPeriods, double ratioScale, boolean annual)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
Using the annual flag you may choose between periodic and annualize values for comparison.
account
- The name to be given to this accountinput
- The names of the account that the flow policy
will apply to.flowPeriods
- An array of offest values to specified the
period that the flow in each period will be compared to. Specify an
offset value the same as the period to skip calculation for that period.ratioScale
- A value used to scale the resulting ratio.
The default value is 100, which will display the values as a
percent.annual
- A flag that indicates if the flow ratios should be
based on annualized values (true) or periodic values.FlowRatioTarget
public void addFlowRatioAccount(String account, String input, FlowSpec flowPeriods, double ratioScale, boolean annual)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
Using the annual flag you may choose between periodic and annualize values for comparison.
account
- The name to be given to this accountinput
- The names of the account that the flow policy
will apply to.flowPeriods
- A FlowSpec object that describes how
periods should be compared.ratioScale
- A value used to scale the resulting ratio.
The default value is 100, which will display the values as a
percent.annual
- A flag that indicates if the flow ratios should be
based on annualized values (true) or periodic values.FlowRatioTarget
public void addFlowValueAccount(String account, String input, int flowPeriod, boolean skipFirst)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
account
- The name to be given to this accountinput
- The names of the account that the flow policy
will apply to.flowPeriod
- An offest value to specified the relative
period that the flow will be compared to.skipFirst
- If true then do not compare flows between
initial conditions and the first period.FlowValueTarget
public void addFlowValueAccount(String account, String input, int[] flowPeriods)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
account
- The name to be given to this accountinput
- The names of the account that the flow policy
will apply to.flowPeriods
- An array of offest values to specified the
period that the flow in each period will be compared to. Specify an
offset value the same as the period to skip calculation for that period.FlowValueTarget
public void addFlowValueAccount(String account, String input, FlowSpec flowPeriods)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
account
- The name to be given to this accountinput
- The names of the account that the flow policy
will apply to.flowPeriods
- A FlowSpec object that describes how
periods should be compared.FlowValueTarget
public void addTabulateAccount(String account, String input, int[] tabulatePeriods)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
account
- The name to be given to this accountinput
- The name of the account that provides the values to
sum up.tabulatePeriods
- An array of period values that indicate
the periods in the output account that should receive the values
from the input account. The array has one cell for each planning
period. These cells correspond to the periods in the input account.
The values in the cells identify which output period the value should
be written in to. If the value is negative then the input value
will not be used.TabulateTarget
public void addRatioAccount(String account, String numerator, String denominator, double ratioScale)
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
account
- The name to be given to this accountnumerator
- The name of the account to be used as the numeratordenominator
- The name of the account to be used as
the denominatorratioScale
- A value used to scale the resulting ratio.
The default value is 100, which will display the values as a
percent.RatioTarget
public void addRatioAccount(String account, String numerator, String denominator)
This method is equivalent to
addRatioAccount(account, numerator, denominator, 100);
This method is only valid when called during the account resolution phase (usually in the Patchworks_TargetInit method in the PIN file).
account
- The name to be given to this accountnumerator
- The name of the account to be used as the numeratordenominator
- The name of the account to be used as
the denominatorRatioTarget
public void addEdgeTarget(String account, Topology topology)
addEdgeElement(java.lang.String, java.lang.String, java.lang.String, double)
method to define the edge
contrast matrix.
This target type computes edge metric targets. Edge metrics describe the juxtaposition of one forest type beside another. This metric works by computing the absolute difference in value between edge attributes between two adjacent stands (on a per unit area basis), and multiplying this by the length of shared edge. Polygons that do not touch have no shared edge, and do not count towards this metric.
A scale factor is also allowed in order to more heavily contrast some edge types.
When adding an element, specify the names of the attributes that define the edge, and provide a scaling factor that will be applied to the difference between the two edges. For example:
topology = control.intputTopology("../blocks/blocks_topo.csv", 10); control.addEdgeTarget("feature.Edge.OldYoung", topology); control.addEdgeElement("feature.Edge.OldYoung", "feature.Seral.Old", "feature.Seral.Young", 1);
public void addEdgeElement(String account, String attribute1, String attribute2, double factor)
public void addGroupDistributionAccount(String account, String[] groupNames, double[] groupTotals)
account
- The name of the new account.groupNames
- A list of names of the groups that will participate
in the account. These names must be defined as groups in the
Patchworks model.groupTotals
- A list of area totals for each group. These
values will be used as the denominator in the calculation of the
percent composition of each group, and will be added to the group
sub account that represents the proper proporional sub-account.public void addGroupDistributionSubAccount(String groupAccount, String subAccount, double min, double max)
groupAccount
- The name of the GroupDistributionAccount that
this sub-account should be attached to.subAccount
- The name that should be given to this sub-account.min
- The minimum percent composition value used to limit
group area to be added to this sub-account. The percent composition
value must be greater than this value.max
- The maximum percent composition value used to limit
group area to be added to this sub-account. The percent composition
value must be less than or equal to this value.public void setTreatmentAffinity(TreatmentAffinity[][] affinities)
public void initialize(Task task)
public void waitUntilInitialized() throws InterruptedException
InterruptedException
public void setInitialValue(String label, double value, int period)
label
- the account labelvalue
- the value to set as the baselineperiod
- the period to setpublic void interrupt()
public Set getAttributeLabels()
public void makeDotFile(String filename)
public void makeDotFile(String filename, int width, int height, boolean simplify)
public void close()
public boolean setTargetLinear(String label, boolean value)
control.getTarget("name").setLinear(true);
public boolean setTargetDiscountRate(String label, double rate)
control.getTarget("name").setDiscountRate(1.03);
public long getIteration()
public Component getPerformanceChart()
public void waitForIterations(int attempts) throws InterruptedException
The following example shows typical BeanShell usage:
print("Run simulation and then save"); gui.click("start"); control.waitForIterations(4000000); gui.click("pause"); reportWriter.saveStage("scenario1");
An invocation of this convenience method of the form
control.waitForIterations(4000000);behaves in exactly the same way as the expression
control.waitForProgress(4000000, -1, null, null, null);
attempts
- The number of attempts that must pass before
execution continues.
An attempt is a trial of a change to the schedule. The
number of attempts is usually less than the number of iterations,
because many iterations are discarded as infeasible before being
tested by the scheduling algorithm.InterruptedException
public void waitForProgress(int attempts, double percent) throws InterruptedException
The following example shows typical BeanShell usage:
print("Run simulation and then save"); gui.click("start"); control.waitForProgress(100000, 0.1); gui.click("pause"); reportWriter.saveStage("scenario2");
An invocation of this convenience method of the form
control.waitForIterations(100000, 0.1);behaves in exactly the same way as the expression
control.waitForIterations(100000, 0.1, null, null, null);
attempts
- The number of attempts that must pass
between tests for the convergence of the objective value.
An attempt is a trial of a change to the schedule. The
number of attempts is usually less than the number of iterations,
because many iterations are discarded as infeasible before being
tested by the scheduling algorithm.percent
- The threshold for performance improvement that
must be achieved before the method returns. The change in
objective function value is measured between sampling intervals
specified by the attempts parameter. If the percent
improvement over the interval is less than the percent parameter
the method will return. If the percent value is less than zero, then
return as soon as the number of attempts has been completed.InterruptedException
public void waitForProgress(int attempts, double percent, ConvergenceSpec[] specs, ScenarioChangeListener asd) throws InterruptedException
The following example shows typical BeanShell usage:
print("Run simulation and then save"); gui.click("start"); String[] patterns = {"product.Yield.*", "route.*", "*"}; double[] values = {0.01, 0.5, 0.1}; control.waitForProgress(100000, 0.1, patterns, values, null); gui.click("pause"); reportWriter.saveStage("scenario2");This example will start the silumation, and then call the wait method. The method will wait until 100,000 attemtps have passed, and then test the change in the objective function value against the percent parameter. If the change is less than the percent value, then the method will then test specific target values for change since the last test. If all the specified targets have change less than the specified values, the method will return and the script will continue to pause the simulator and save the scenario. Otherwise the method will wait for another set of attempts to occur before testing again.
attempts
- The number of attempts that must pass
between tests for the convergence of the objective value.
An attempt is a trial of a change to the schedule. The
number of attempts is usually less than the number of iterations,
because many iterations are discarded as infeasible before being
tested by the scheduling algorithm.percent
- The threshold for performance improvement that
must be achieved before the method returns. The change in
objective function value is measured between sampling intervals
specified by the attempts parameter. If the percent
improvement over the interval is less than the percent parameter
the method will then test the specific target values specified in
patterns and values parameters. If the percent value is less than
zero, then return as soon as the number of attempts has been completed.specs
- An array of sub-target convergence criteriaasd
- A reference to an ScenarioChangeListener
object. The scheduler will call the
ScenarioChangeListener.init()
method when the listener is
registered, and then the
ScenarioChangeListener.evaluateBefore()
and
ScenarioChangeListener.evaluateAfter(boolean, ca.spatial.patchworks.ScenarioMonitor)
methods
before and after it evaluates the convergence criteria.
The changeListener may alter the criteria to terminate or extend
the simulation.InterruptedException
public void waitForProgress(int attempts, double percent, String[] patterns, double[] values, ScenarioChangeListener asd) throws InterruptedException
ScenarioSet
,
ScenarioDescription
and ScenarioChangeListener
mechanism. These methods provide self-documentation and
fine-grained customizable control over how scenarios are run,
including the ability to monitor progress and alter simulation
values.The following example shows typical BeanShell usage:
print("Run simulation and then save"); gui.click("start"); String[] patterns = {"product.Yield.*", "route.*", "*"}; double[] values = {0.01, 0.5, 0.1}; control.waitForProgress(100000, 0.1, patterns, values, null); gui.click("pause"); reportWriter.saveStage("scenario2");This example will start the simulation, and then call the wait method. The method will wait until 100,000 attemtps have passed, and then test the change in the objective function value against the percent parameter. If the change is less than the percent value, then the method will then test specific target values for change since the last test. If all the specified targets have change less than the specified values, the method will return and the script will continue to pause the simulator and save the scenario. Otherwise the method will wait for another set of attempts to occur before testing again.
attempts
- The number of attempts that must pass
between tests for the convergence of the objective value.
An attempt is a trial of a change to the schedule. The
number of attempts is usually less than the number of iterations,
because many iterations are discarded as infeasible before being
tested by the scheduling algorithm.percent
- The threshold for performance improvement that
must be achieved before the method returns. The change in
objective function value is measured between sampling intervals
specified by the attempts parameter. If the percent
improvement over the interval is less than the percent parameter
the method will then test the specific target values specified in
patterns and values parameters. If the percent value is less than
zero, then return as soon as the number of attempts has been completed.patterns
- A list of glob-style patterns that describe the
targets to be tested.values
- A list of percentages to be compared against the
targets that match the corresponding patterns.asd
- A reference to an ScenarioChangeListener
object that will receive scenario life cycle events and potentially
alter the course of the simulation. This value may
be null, in which case life cycle events will be ignored.InterruptedException
public void addProgressListener(ObjectiveProgressReport listener)
public void removeProgressListener(ObjectiveProgressReport listener)
public void inputRoute(String label, String filename)
label
- The name of the route to loadfilename
- The name of the file that contains the
saved route information.public void outputRoute(String label, String filename)
label
- The name of the route to savefilename
- The name of the file to contain the
saved route information.public void resume()
public void suspend()
resume()
method.public boolean isSuspended()
public static Control getSharedInstance()
public boolean setTreatment(int index, String treatment, int year, boolean managed)
index
- the block indextreatment
- the name of the treatment to applyyear
- the year to apply the treatmentmanaged
- apply to the managed (true) or unmanaged (false) protion of the blockpublic boolean setBlockAvailable(int row, boolean[] values)
row
- The row number for the blockvalues
- The array of timing values.public void setRandomSeed(long seed)
The Patchworks scheduling hueristic uses the random number stream to guide the allocation process. Pseudo random numbers are generated by an algorithm where the value of the first pseudorandomm number is used to help generate the value of the next, and so on. If you set the value of the first number to a known quantity, the the rest of the number stream is predictable and repeatable.
By default the random number stream is initialized with a seed that is highly likely to be different from any other Patchworks run. Normally you would not want to manually set the seed to the random number stream.
public void cancelTreatments(String label)
public void cancelTreatments()
public Object getClientObject()
public Component getTargetView(String label)
The object that is returned is a component, and must
be placed inside of a windowing container such as a
JFrame
in order to be made visible on the screen.
public Component getTreatmentView(String label)
The object that is returned is a component, and must
be placed inside of a windowing container such as a
JFrame
in order to be made visible on the screen.
public AttributeStore getTargetTable()
The object that is returned is a model (one part of a
model-view-controller paradigm). You can manipulate the
data programatically using this model. If you want to
view the table then instead call the
AttributeStore.showCube(boolean)
method.
public Collection<Target> getTargets()
public double getObjectiveValue(boolean details)
details
- This parameter is historic and is ignored.public GeoRelationalStore getBlockTable()
The object that is returned is a model (one part of a
model-view-controller paradigm). You can manipulate the
data programatically using this model. If you want to
view the table then instead call the
AttributeStore.showCube(boolean)
method.
BlockStore
public StandEventReport getStandEventReport(String filename, String title, String treatedManAreaExpr, String treatedUnmanAreaExpr)
filename
- the name to be given to the output file, having a
.csv extensiontitle
- the title to be shown in the report writertreatedManAreaExpr
- an expression that yields the area of
the managed portion of the stand that has been treated.
May be null in which case the entire area is
affected by the event.treatedUnmanAreaExpr
- an expression that yields the area of
the unmanaged portion of the stand that has been treated.
May be null in which case the entire area is
affected by the event.public ArrayList<EventRecord> getEvents(String id, String treatedManAreaExpr, String treatedUnmanAreaExpr)
id
- the row of interesttreatedManAreaExpr
- an expression to use to determine the area
of the managed part of the block that received treatmentstreatedUnmanAreaExpr
- an expression to use to determine the area
of the unmanaged part of the block that received treatmentspublic void cbmExport()
public void cbmExport(String[] classifiers, String histDist, String lastDist, String[] conSppList, String[] hwdSppList, String sppRegex, int evalYear, String output) throws Exception
classifiers
- a list of strata names to be included in the modelhistDist
- an expression that evaluates to the historic disturbance
condition of the polygonlastDist
- an expression that evaluates to the last disturbance
condition of the polygonconSppList
- a list of stand attributes that define the conifer
volume in the standhwdSppList
- a list of stand attributes that define the hardwood
volume in the standsppRegex
- a regular expression pattern that can be used to
extract the species codes from the yield attributesevalYear
- the year to be used to calculate leading speciesoutput
- the name of the output zip file. If a zip extension
is not present it will be added.Exception
public void cbmExport(String[] classifiers, String histDist, String lastDist, String conYield, String hwdYield, String conLeadSpp, String hwdLeadSpp, int evalYear, String output) throws Exception
classifiers
- a list of strata names to be included in the modelhistDist
- an expression that evaluates to the historic disturbance
condition of the polygonlastDist
- an expression that evaluates to the last disturbance
condition of the polygonconYield
- an expression to calculate the conifer yield component
of the standhwdYield
- an expression to calculate the hardwood yield component
of the standconLeadSpp
- an expression to calculate the conifer leading
specieshwdLeadSpp
- an expression to calculate the hardwood leading
speciesevalYear
- the year to be used to calculate leading speciesoutput
- the name of the output zip file. If a zip extension
is not present it will be added.Exception
public String[] getStrataColumns()
public AccessTableModel getAccessTable()
The object that is returned is a model (one part of a model-view-controller paradigm). You can manipulate the data programatically using this model. If you want to view and edit the table then call the action to open the timing constraints editor:
control.getActions().get("editAccess").perform();
getActions()
,
Actions
public GeoRelationalStore getRouteTable(String label)
public GeoRelationalStore getNetworkTable()
public Vector<String> getDestinationNames()
public Vector<String> getExclusiveAccountNames()
public Report getRouteReport(String filename, String title, String destination)
filename
- The filename used for output. This name must be unique
within the ReportWriter where this report will be cataloged.title
- The report titledestination
- The name of the destination for this route reportpublic Report getRouteCostReport(String filename, String title, String destination)
filename
- The filename used for output. This name must be unique
within the ReportWriter where this report will be cataloged.title
- The report titledestination
- The name of the destination for this route reportpublic Report getNetworkCostReport(String filename, String title)
filename
- The filename used for output. This name must be unique
within the ReportWriter where this report will be cataloged.title
- The report titlepublic Report getTimingConstraintsReport(String filename, String title)
Timing constraints are specified by 'ZONES', which are simply polygons that have the same values for a classification field. The constraints specify if a stand is eligible to be scheduled for treatments.
This file represents one of the input data sets used by the Patchworks model. This file is usually not saved by the model as a 'scenario' data set. This report can be used to optionally save this data.
filename
- The filename used for output. This name must be unique
within the ReportWriter where this report will be cataloged.title
- The report titlepublic void addNote(String details)
ScenarioEventReport
. You can use this method to add
your own annotations and document the scenario.details
- The detailed message string to be added to the log file.public void addNote(String category, String details)
ScenarioEventReport
. You can use this method to add
your own annotations and document the scenario. Tcategory
- The category name of the message.details
- The detailed message string to be added to the log file.public Exclusive getExclusiveAccount(String name)
public Report getExclusiveAssignmentReport(String filename, String title, String exclusive)
filename
- The filename used for output. This name must be unique
within the ReportWriter where this report will be cataloged.title
- The report titleexclusive
- The name of the exclusive account to be savedpublic Report getExclusiveLockReport(String filename, String title, String exclusive)
filename
- The filename used for output. This name must be unique
within the ReportWriter where this report will be cataloged.title
- The report titleexclusive
- The name of the exclusive account to be savedpublic void loadExclusive(String exclusive, String filename)
exclusive
- The name of the exclusive account to be savedfilename
- The filename to be read for input.public void loadExclusiveLocks(String exclusive, String filename)
exclusive
- The name of the exclusive account to be savedfilename
- The filename to be read for input.public void loadSchedule(String filename)
filename
- The filename to be read for input.public void loadSchedule(String filename, boolean cancelPrevious)
filename
- The filename to be read for input.cancelPrevious
- Flag to indicate to cancel all previously
scheduled preatments before loading the specified treatment file.public void loadTargetSummary(String filename)
filename
- The filename to be read for input.public void loadTargetStatus(String filename)
filename
- The filename to be read for input.public void loadAvailable(String filename)
filename
- The filename to be read for input.public void showAccountExplorer()
public void showGroupExplorer()
public Actions getActions()
public ReportWriter getReportWriter()
public ComparisonWriter getComparisonWriter()
public static void identifyPatches(GeoRelationalStore store, Topology topology, String label, String reselect, int period, String output)
store
- The spatial dataset to classifytopology
- The topological relationshipslabel
- A column in the spatial dataset that uniquely identifies
each polygonreselect
- An expression used to select the polygons
that are candidates for patching.period
- The period of interest. For simple spatial datasets
such as shapefiles or coverages this should be 0.output
- The name of the output file that will contain the
patch numbers.For further documentation see the Patchworks User Guide and Reference
Copyright 2001-2020 Spatial Planning Systems. All Rights Reserved.