coreEngine.reliabilityAnalysis

## Class ScenarioGenerator

- java.lang.Object
- - coreEngine.reliabilityAnalysis.ScenarioGenerator

-     public class ScenarioGenerator
      extends java.lang.Object

  Class that generates the reliability scenarios for FREEVAL reliability analysis.
  Author:
    Lake Trask

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `private class` | `ScenarioGenerator.IncidentInfo` Class for comparing Incidents by severity.
    `class` | `ScenarioGenerator.InvalidSeedDataException` Exception to indicate when the Seed file is not in an appropriate format for reliability analysis.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static java.lang.String[]` | `csvHeader`
    `private float` | `dailyStudyPeriodDuration` Length (in hours) of the daily study period.
    `private boolean` | `debug_output`
    `private DemandData` | `demandData_GP` Data Structure holding the scenario generator GP segment demand information for the Reliability Reporting Period.
    `private DemandData` | `demandData_ML` Data structure holding the scenario generator ML segment demand information for the Reliability Reporting Period.
    `private int[][]` | `excludedDays` Array containing the number of each day type (Mon, Tue, etc) excluded in each month.
    `private boolean` | `incidentBool_GP` Boolean indicating if GP incident events should be included in the Scenario Generation process.
    `private boolean` | `incidentBool_ML` Boolean indicating if GP incident events should be included in the Scenario Generation process.
    `private IncidentData` | `incidentData_GP` Data structure holding the scenario generator GP segment incident information for the Reliability Reporting Period.
    `private IncidentData` | `incidentData_ML` Data structure holding the scenario generator ML segment incident information for the Reliability Reporting Period.
    `private Scenario` | `mlScenario` Scenario instance containing the Adjustment Factors for all generated ML reliability scenarios.
    `private boolean` | `mlUsed` Boolean indicating if the Scenario Generation process has managed lane analysis.
    `static java.lang.String[]` | `monthString` List of names of each month (used in MainWindow Log outputs).
    `private int` | `numReplications` Number of replications for each Demand Combination (Default: 4).
    `private int` | `numScenarios` Number of reliability scenarios generated.
    `private java.util.Random` | `RNG` Instance of Java Random class used as the random number generator.
    `private long` | `rngSeed` Random number generator seed used by the RNG variable.
    `private Scenario` | `scenario` Scenario instance containing the Adjustment Factors for all generated GP reliability scenarios.
    `private java.util.ArrayList<ScenarioInfo>` | `scenarioInfos` List of ScenarioInfos for all generated reliability scenarios.
    `private Seed` | `seed` Seed instance from which the scenarios will be generated.
    `private boolean` | `weatherBool` Boolean indicating if weather events should be included in the Scenario Generation process.
    `private WeatherData` | `weatherData` Data Structure holding the scenario generator weather information for the Reliability Reporting Period.
    `private java.util.ArrayList<WorkZone>` | `workZoneData_GP` List of work zones (GP Only) for the Reliability Reporting Period.
    `private boolean` | `wzBool` Boolean indicating if Work Zones should be included in the Scenario Generation process.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ScenarioGenerator(Seed seed)` Constructor for the Scenario Generator Class

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `private boolean` | `allInputValid()` Method to check if input is valid before the scenario generation procedure can be run.
    `private int` | `argMax(int[] arr)` Method to find the index of the maximum element of an array.
    `private int` | `arraySum(java.util.ArrayList<java.lang.Integer> arr)` Method to sum an ArrayList.
    `private int` | `arraySum(boolean[] arr)` Method to calculate the sum of an array.
    `private float` | `arraySum(float[] arr)` Method to calculate the sum of an array.
    `private int` | `arraySum(int[] arr)` Method to calculate the sum of an array.
    `private int` | `arraySum(int[][] arr)` Method to calculate the sum of an array of arrays.
    `private void` | `assignCurrMonthWeatherEvents(int[] expMonthFreqWT, float[] currMonthScenCumProb, int prevScenarioInfoMarker)` Method to assign the list of weather events (LWE) for the current month to scenarios associated with the current month.
    `private void` | `assignWorkZones()` Method that assigns all work zones (GP only) for the RRP.
    `private int` | `calculateNumberOfScenarios(int[] numDayOfWeekInMonthAP)` Method to calculate the number of scenarios that will be generated by the Hybrid Scenario Generation procedure with the current inputs.
    `private int[][]` | `computeExpFreqOfWeatherEvents(int[] monthChangeIdx)` Method to calculate the expected frequency of events of each weather type occur in each month.
    `private int[][]` | `createAndAssignListIncidentEventsGP(int[] monthChangeIdx)` Method to create and assign the List of Incident Events (LIE) for GP segments.
    `private int[][]` | `createAndAssignListIncidentEventsML(int[] monthChangeIdx)` Method to create and assign the List of Incident Events (LIE) for ML segments.
    `private void` | `createAndAssignWeatherEvents(int[] monthChangeIdx)` Creates the List of Weather Events (LWE) and assigns the weather events to the reliability scenarios.
    `private java.util.ArrayList<java.lang.Integer>` | `createIntegerArrAscending(int length)` Method to create an ArrayList of integers ascending from 0 to one less than the input length (0,1,..,length - 1).
    `private java.util.ArrayList<java.lang.Integer>` | `createIntegerArrDist(int[] distArr)` Method to create an ArrayList of integer values matching a given distribution.
    `private float[]` | `createProbabilities(DemandData demandData)` Method to create the array of probabilities of each reliability scenario.
    `private float[]` | `cumSumNormalize(float[] arr)` Method create an array of the normalized cumulative sums of the elements of the input array.
    `void` | `excludeDates(java.util.ArrayList<CEDate> dates)` Method that excludes all days in the specified list.
    `private void` | `excludeDays(int[] daysArr)` Method to exclude days from the array of the (12x7=84) array of active days.
    `void` | `excludeDaysInMonth(int[] numDays, int month)` Method that excludes any days specified.
    `static void` | `exportRawRLResults(Seed seed)`
    `private long` | `factorial(int value)` Method to calculate the factorial of a non-negative integer.
    `private float[][]` | `generateLogNormalDurationProbabilites(int[] numIncOfEachType)` Method to generate the probabilities of incident durations matching a log normal distribution.
    `private float` | `generateLogNormalProbability(float value, float mean, float stdev)` Calculates the value of a Log-Normal Probability Density Function (PDF) with the input mean and standard deviation at the input value.
    `boolean` | `generateScenarios()` Method to generate reliability scenarios for the RRP.
    `private int` | `getColMax(int[][] arr, int col)` Array to get the max of a column of a matrix (2D array).
    `Scenario` | `getGPScenario()` Getter for GP Scenario object.
    `private float[][]` | `getHCDurProbs()` Deprecated.
    `Scenario` | `getMLScenario()` Getter for ML Scenario Object.
    `int` | `getNumberOfReplications()` Getter for the number of replications of each Demand Combination that will be generated.
    `private int[][]` | `getNumScenAssignedDurationLength(int[] numIncOfEachType)` Method to calculate the number of scenarios assigned each duration length.
    `long` | `getRNGSeed()` Getter for the seed value used by the Random Number Generator during the scenario generation process.
    `java.util.ArrayList<ScenarioInfo>` | `getScenarioInfoList()` Getter for the ArrayList of ScenarioInfo objects.
    `static int[]` | `getSeedDataFormatErrorLocation(Seed seed)` Finds the location of the first data format error for the specified seed.
    `void` | `includeGPWorkZones(boolean val)` Method to indicate whether work zones are included in reliability analysis.
    `void` | `includeIncidentsGP(boolean val)` Method to indicate if GP incidents are included in reliability analysis.
    `void` | `includeIncidentsML(boolean val)` Method to indicate if ML incidents are included in reliability analysis.
    `void` | `includeWeather(boolean val)` Method to indicate if weather events are included in reliability analysis.
    `private float` | `logNormCDF(float value1, float value2, float step, float mu, float sigma)` Calculating the Log-Normal CDF between two values.
    `private void` | `resetRNG()` Resets the Random number generator to a new one based on the RNG Seed.
    `private void` | `resetRNG(long factor)` Resets the Random number generator to a new one based on the RNG Seed times the input factor.
    `void` | `setDemandDataGP(DemandData data)` Setter for the GP demand data used to generate scenarios
    `void` | `setGPIncidentData(IncidentData data)` Setter for the GP segment incident data used to generate scenarios
    `void` | `setMLDemandData(DemandData demandMLData)` Setter for the Managed Lane (ML) segment demand data information.
    `void` | `setMLIncidentData(IncidentData incidentMLData)` Setter for the Managed Lane(ML) segment incident data used to generate scenarios.
    `void` | `setMLUsed(boolean mlUsed)` Setter for the boolean used to indicated if Managed Lanes should be included in Scenario Generation.
    `void` | `setNumberOfReplications(int numReplications)` Setter for the number of replications of each Demand Combination to be generated.
    `void` | `setRNGSeed(long newSeed)` Setter for the seed value for the Random Number Generator used in the Scenario Generation process.
    `void` | `setWeatherData(WeatherData data)` Setter for the weather data used to generate scenarios.
    `void` | `setWorkZoneDataGP(java.util.ArrayList<WorkZone> data)` Setter the work zone data (GP Only) used in scenario generation.
    `static boolean` | `validateSeedForReliabilityAnalysis(Seed seed)` Checks if the Seed data is valid for reliability analysis.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### debug_output

          private final boolean debug_output

      See Also:
        Constant Field Values

    - #### seed

          private Seed seed

      Seed instance from which the scenarios will be generated.

    - #### demandData_GP

          private DemandData demandData_GP

      Data Structure holding the scenario generator GP segment demand information for the Reliability Reporting Period.

    - #### weatherData

          private WeatherData weatherData

      Data Structure holding the scenario generator weather information for the Reliability Reporting Period.

    - #### incidentData_GP

          private IncidentData incidentData_GP

      Data structure holding the scenario generator GP segment incident information for the Reliability Reporting Period.

    - #### workZoneData_GP

          private java.util.ArrayList<WorkZone> workZoneData_GP

      List of work zones (GP Only) for the Reliability Reporting Period.

    - #### wzBool

          private boolean wzBool

      Boolean indicating if Work Zones should be included in the Scenario Generation process.

    - #### weatherBool

          private boolean weatherBool

      Boolean indicating if weather events should be included in the Scenario Generation process.

    - #### incidentBool_GP

          private boolean incidentBool_GP

      Boolean indicating if GP incident events should be included in the Scenario Generation process.

    - #### mlUsed

          private boolean mlUsed

      Boolean indicating if the Scenario Generation process has managed lane analysis.

    - #### incidentData_ML

          private IncidentData incidentData_ML

      Data structure holding the scenario generator ML segment incident information for the Reliability Reporting Period.

    - #### demandData_ML

          private DemandData demandData_ML

      Data structure holding the scenario generator ML segment demand information for the Reliability Reporting Period.

    - #### incidentBool_ML

          private boolean incidentBool_ML

      Boolean indicating if GP incident events should be included in the Scenario Generation process.

    - #### scenario

          private Scenario scenario

      Scenario instance containing the Adjustment Factors for all generated GP reliability scenarios.

    - #### scenarioInfos

          private java.util.ArrayList<ScenarioInfo> scenarioInfos

      List of ScenarioInfos for all generated reliability scenarios.

    - #### mlScenario

          private Scenario mlScenario

      Scenario instance containing the Adjustment Factors for all generated ML reliability scenarios.

    - #### dailyStudyPeriodDuration

          private final float dailyStudyPeriodDuration

      Length (in hours) of the daily study period.

    - #### numReplications

          private int numReplications

      Number of replications for each Demand Combination (Default: 4).

    - #### numScenarios

          private int numScenarios

      Number of reliability scenarios generated.

    - #### excludedDays

          private final int[][] excludedDays

      Array containing the number of each day type (Mon, Tue, etc) excluded in each month.

    - #### RNG

          private java.util.Random RNG

      Instance of Java Random class used as the random number generator.

    - #### rngSeed

          private long rngSeed

      Random number generator seed used by the RNG variable.

    - #### monthString

          public static final java.lang.String[] monthString

      List of names of each month (used in MainWindow Log outputs).

    - #### csvHeader

          private static final java.lang.String[] csvHeader

  - ### Constructor Detail

    - #### ScenarioGenerator

          public ScenarioGenerator(Seed seed)

      Constructor for the Scenario Generator Class
      Parameters:
        `seed` - The Seed instance that will be used to generate scenarios.

  - ### Method Detail

    - #### validateSeedForReliabilityAnalysis

          public static boolean validateSeedForReliabilityAnalysis(Seed seed)

      Checks if the Seed data is valid for reliability analysis. Checks if the number of lanes is constant across all periods for each segment.
      Parameters:
        `seed` - Seed instance to check validity.
      Returns:
        true if the data is valid, false otherwise

    - #### getSeedDataFormatErrorLocation

          public static int[] getSeedDataFormatErrorLocation(Seed seed)

      Finds the location of the first data format error for the specified seed. Assumes the number of lanes in each segment in the first period is ground truth. If there are no data errors, the method will return a null object.
      Parameters:
        `seed` - Seed file to find any format errors any.
      Returns:
        Integer array whose first element is the segment in which the error occurs and whose second element is the period. A null object is returned if there are no errors.

    - #### setDemandDataGP

          public void setDemandDataGP(DemandData data)

      Setter for the GP demand data used to generate scenarios
      Parameters:
        `data` - GP demand data information.

    - #### setWorkZoneDataGP

          public void setWorkZoneDataGP(java.util.ArrayList<WorkZone> data)

      Setter the work zone data (GP Only) used in scenario generation.
      Parameters:
        `data` - ArrayList of GP Work Zones in the RRP

    - #### setWeatherData

          public void setWeatherData(WeatherData data)

      Setter for the weather data used to generate scenarios.
      Parameters:
        `data` - Weather event generation information.

    - #### setGPIncidentData

          public void setGPIncidentData(IncidentData data)

      Setter for the GP segment incident data used to generate scenarios
      Parameters:
        `data` - GP Incident data information.

    - #### setNumberOfReplications

          public void setNumberOfReplications(int numReplications)

      Setter for the number of replications of each Demand Combination to be generated. Controls the total number of reliability scenarios that will be generated: Total Number of Scenarios = Number of Replications * Number of unique Demand Combinations (Overwrites the default value of 4 if used).
      Parameters:
        `numReplications` - New number of replications for each Demand Combination (must be greater than 0).

    - #### setRNGSeed

          public void setRNGSeed(long newSeed)

      Setter for the seed value for the Random Number Generator used in the Scenario Generation process.
      Parameters:
        `newSeed` -

    - #### setMLUsed

          public void setMLUsed(boolean mlUsed)

      Setter for the boolean used to indicated if Managed Lanes should be included in Scenario Generation. If set to true, then reliability scenarios will include demand factors and incident events (if specified) for the managed lanes of the facility.
      Parameters:
        `mlUsed` - Boolean indicator of Managed Lane inclusion.

    - #### setMLIncidentData

          public void setMLIncidentData(IncidentData incidentMLData)

      Setter for the Managed Lane(ML) segment incident data used to generate scenarios.
      Parameters:
        `incidentMLData` - Managed Lane segment incident information.

    - #### setMLDemandData

          public void setMLDemandData(DemandData demandMLData)

      Setter for the Managed Lane (ML) segment demand data information.
      Parameters:
        `demandMLData` - Managed Lane segment demand information.

    - #### includeGPWorkZones

          public void includeGPWorkZones(boolean val)

      Method to indicate whether work zones are included in reliability analysis. If set to true then any specified work zones will be assigned to the scenarios generated.
      Parameters:
        `val` - Boolean indicating the inclusion of work zone events in reliability analysis.

    - #### includeIncidentsGP

          public void includeIncidentsGP(boolean val)

      Method to indicate if GP incidents are included in reliability analysis. If set to true then incidents are generated and assigned to reliability scenarios via the specified GP IncidentData.
      Parameters:
        `val` - Boolean indicating the inclusion of incident events in reliability analysis.

    - #### includeWeather

          public void includeWeather(boolean val)

      Method to indicate if weather events are included in reliability analysis. If set to true then weather events are generated and assigned to reliability scenarios via the specified WeatherData.
      Parameters:
        `val` - Boolean indicating the inclusion of weather events in reliability analysis.

    - #### includeIncidentsML

          public void includeIncidentsML(boolean val)

      Method to indicate if ML incidents are included in reliability analysis. If set to true then incidents are generated and assigned to reliability scenarios via the specified ML IncidentData.
      Parameters:
        `val` - Boolean indicating the inclusion of ML incident events in reliability analysis.

    - #### getGPScenario

          public Scenario getGPScenario()

      Getter for GP Scenario object.
      Returns:
        Scenario Object for General Purpose (GP) segments.

    - #### getMLScenario

          public Scenario getMLScenario()

      Getter for ML Scenario Object.
      Returns:
        Scenario Object for Managed Lane (ML) segments.

    - #### getScenarioInfoList

          public java.util.ArrayList<ScenarioInfo> getScenarioInfoList()

      Getter for the ArrayList of ScenarioInfo objects.
      Returns:
        ArrayLIst containing the ScenarioInfo objects for all generated reliability scenarios.

    - #### getNumberOfReplications

          public int getNumberOfReplications()

      Getter for the number of replications of each Demand Combination that will be generated.
      Returns:
        Number of replications that will be generated of each unique Demand Combination.

    - #### getRNGSeed

          public long getRNGSeed()

      Getter for the seed value used by the Random Number Generator during the scenario generation process.
      Returns:
        Seed value for the Random Number Generator.

    - #### excludeDaysInMonth

          public void excludeDaysInMonth(int[] numDays,
                                         int month)

      Method that excludes any days specified. Used to exclude days which have abnormal demands or other parameters (i.e. Fourth of July). This affects the probabilities of the respective Demand Combinations. Months are indexed 1 (January) to 12 (December), and day types are indexed 0 - Mon, 1 - Tue, 2 - Wed, 3- Thu, 4 - Fri, 5 - Sat, 6 - Sun. Note this process is not additive and should be done once for each month in the Reliability Reporting Period. Example: to exclude just Friday July 4th, 2014, numDays = new int{0,0,0,0,1,0,0}, and month = 7.
      Parameters:
        `numDays` - Array of length 7 containing the number of each day type excluded (0 - Mon, 1 - Tue, 2 - Wed, 3- Thu, 4 - Fri, 5 - Sat, 6 - Sun).
        `month` - Month in which the days excluded occur (1- Jan, 2 - Feb, etc.)

    - #### excludeDates

          public void excludeDates(java.util.ArrayList<CEDate> dates)

      Method that excludes all days in the specified list. Used to exclude days which have abnormal demands or other parameters (i.e. Fourth of July). This affects the probabilities of the respective Demand Combinations. Months are indexed 1 (January) to 12 (December), and day types are indexed 0 - Mon, 1 - Tue, 2 - Wed, 3- Thu, 4 - Fri, 5 - Sat, 6 - Sun. This process is not additive.
      Parameters:
        `dates` - date to exclude

    - #### excludeDays

          private void excludeDays(int[] daysArr)

      Method to exclude days from the array of the (12x7=84) array of active days.
      Parameters:
        `daysArr` - 84 length array of active days

    - #### generateScenarios

          public boolean generateScenarios()

      Method to generate reliability scenarios for the RRP. User should set all necessary demand, weather, incident, and work zone data, as well as whether or each event type is included and whether Managed Lanes are considered. Once the process has been run, the the Scenario(GP and ML if specified) object(s) and ScenarioInfo list will contain the reliability scenarios and relevant information. These should be obtained for any further analysis through their respective getter methods (getGPScenario, getMLScenario, getScenarioInfoList)
      Returns:
        Boolean indicating whether the Scenario Generation process was successful.

    - #### assignWorkZones

          private void assignWorkZones()

      Method that assigns all work zones (GP only) for the RRP. Requires that work zones are turned on (includeWorkZones is set to true), and a valid list of work zones (via setWorkZoneDataGP) is provided by the user.

    - #### createAndAssignWeatherEvents

          private void createAndAssignWeatherEvents(int[] monthChangeIdx)

      Creates the List of Weather Events (LWE) and assigns the weather events to the reliability scenarios. Follows the Hybrid Scenario Generation methodology. Should only be called during the scenario generation process.
      Parameters:
        `monthChangeIdx` - List of indexes where each month ends (created automatically in the generateScenarios method)

    - #### computeExpFreqOfWeatherEvents

          private int[][] computeExpFreqOfWeatherEvents(int[] monthChangeIdx)

      Method to calculate the expected frequency of events of each weather type occur in each month. Uses data calculated from the local weather database.
      Parameters:
        `monthChangeIdx` - Array containing the final group number of scenarios in each month. monthChangeIdx[0] should be the group number of the final set of scenarios in January.
      Returns:
        expFreqWT - float[12][numWT] array containing the expected frequencies of each type of weather event for each month. First index denotes month, second denotes weather type.

    - #### assignCurrMonthWeatherEvents

          private void assignCurrMonthWeatherEvents(int[] expMonthFreqWT,
                                                    float[] currMonthScenCumProb,
                                                    int prevScenarioInfoMarker)

      Method to assign the list of weather events (LWE) for the current month to scenarios associated with the current month. Assigns each weather event to a random scenario, and gives each event a random start time. Encompasses steps 10-13 of the scenario generation work flow.
      Parameters:
        `expMonthFreqWT` - expected frequency of each weather type in each month
        `currMonthScenCumProb` - float[] holding the cumulative sum array of scenario probabilities for the current month.
        `prevScenarioInfoMarker` - Marker for iterating through the scenarioInfos

    - #### createAndAssignListIncidentEventsGP

          private int[][] createAndAssignListIncidentEventsGP(int[] monthChangeIdx)

      Method to create and assign the List of Incident Events (LIE) for GP segments. Follows the methodology of the Hybrid Scenario Generation method. Should only be called in the scenario generation process.
      Parameters:
        `monthChangeIdx` - Indices at which the scenarios change month, i.e. the value of monthChangeIdx[0] is the index of the first scenario of February.
      Returns:
        Array (of arrays) representing the LIE from the Hybrid Scenario Generation Procedure.

    - #### createAndAssignListIncidentEventsML

          private int[][] createAndAssignListIncidentEventsML(int[] monthChangeIdx)

      Method to create and assign the List of Incident Events (LIE) for ML segments. Follows the methodology of the Hybrid Scenario Generation method. Should only be called in the scenario generation process.
      Parameters:
        `monthChangeIdx` - Indices at which the scenarios change month, i.e. the value of monthChangeIdx[0] is the index of the first scenario of February.
      Returns:
        Array (of arrays) representing the LIE from the Hybrid Scenario Generation Procedure.

    - #### allInputValid

          private boolean allInputValid()

      Method to check if input is valid before the scenario generation procedure can be run.
      Returns:
        True if the inputs are valid, false otherwise.

    - #### calculateNumberOfScenarios

          private int calculateNumberOfScenarios(int[] numDayOfWeekInMonthAP)

      Method to calculate the number of scenarios that will be generated by the Hybrid Scenario Generation procedure with the current inputs. Used in the scenario generation method.
      Parameters:
        `numDayOfWeekInMonthAP` - Array with the number of each day type of each month active in the Reliability Reporting Period (automatically generated during the scenario generation process.
      Returns:
        Number of scenarios that will be generated by the scenario generation process.

    - #### createProbabilities

          private float[] createProbabilities(DemandData demandData)

      Method to create the array of probabilities of each reliability scenario.
      Parameters:
        `demandData` - Instance of DemandData for the Reliability Reporting Period.
      Returns:
        Array containing the probability of each reliability scenario.

    - #### arraySum

          private int arraySum(int[] arr)

      Method to calculate the sum of an array.
      Parameters:
        `arr` - Array to sum.
      Returns:
        Sum of the array.

    - #### arraySum

          private int arraySum(int[][] arr)

      Method to calculate the sum of an array of arrays.
      Parameters:
        `arr` - Array of arrays to sum.
      Returns:
        Sum of the array of arrays.

    - #### arraySum

          private int arraySum(java.util.ArrayList<java.lang.Integer> arr)

      Method to sum an ArrayList.
      Parameters:
        `arr` - ArrayList to sum.
      Returns:
        Sum of the ArrayList

    - #### arraySum

          private float arraySum(float[] arr)

      Method to calculate the sum of an array.
      Parameters:
        `arr` - Array to sum.
      Returns:
        Sum of the array.

    - #### arraySum

          private int arraySum(boolean[] arr)

      Method to calculate the sum of an array.
      Parameters:
        `arr` - Array to sum.
      Returns:
        Sum of the array.

    - #### getColMax

          private int getColMax(int[][] arr,
                                int col)

      Array to get the max of a column of a matrix (2D array).
      Parameters:
        `arr` - Matrix to extract the column sum from.
        `col` - Column to sum.
      Returns:
        Sum of the column of the matrix (2D array).

    - #### argMax

          private int argMax(int[] arr)

      Method to find the index of the maximum element of an array.
      Parameters:
        `arr` - Array of integers
      Returns:
        Index of the maximum element in the array.

    - #### cumSumNormalize

          private float[] cumSumNormalize(float[] arr)

      Method create an array of the normalized cumulative sums of the elements of the input array.
      Parameters:
        `arr` - Array of floats
      Returns:
        New array with the normalized cumulative sums.

    - #### factorial

          private long factorial(int value)

      Method to calculate the factorial of a non-negative integer.
      Parameters:
        `value` - Non-negative integer
      Returns:
        Factorial of the input integer

    - #### createIntegerArrAscending

          private java.util.ArrayList<java.lang.Integer> createIntegerArrAscending(int length)

      Method to create an ArrayList of integers ascending from 0 to one less than the input length (0,1,..,length - 1). Returned ArrayList will be of the specified length.
      Parameters:
        `length` - Desired length of the ascending value array.
      Returns:
        Ascending value array with values from 0 to (length-1)

    - #### createIntegerArrDist

          private java.util.ArrayList<java.lang.Integer> createIntegerArrDist(int[] distArr)

      Method to create an ArrayList of integer values matching a given distribution. If input distribution is {10,15}, the output ArrayList will have 10 instances of 0 and 15 instances of 1.
      Parameters:
        `distArr` - Distribution the values of the returned ArrayList will match.
      Returns:
        ArrayList of integer values matching the input distribution.

    - #### generateLogNormalDurationProbabilites

          private float[][] generateLogNormalDurationProbabilites(int[] numIncOfEachType)

      Method to generate the probabilities of incident durations matching a log normal distribution. Method returns a 2D array indicating the number of incidents of each type with each duration. For example, if the return array has value duration[i][j] = 2, this indicates there are 2 i-lane closures (i = 0 is a shoulder closure) closures with j*15 minute durations (j analysis periods).
      Parameters:
        `numIncOfEachType` - Number of each type of incident.
      Returns:
        2D array containing the number of incidents of each type with each duration.

    - #### generateLogNormalProbability

          private float generateLogNormalProbability(float value,
                                                     float mean,
                                                     float stdev)

      Calculates the value of a Log-Normal Probability Density Function (PDF) with the input mean and standard deviation at the input value.
      Parameters:
        `value` - Value at which to find the value of the Log-Normal PDF
        `mean` - Mean of the Log-Normal distribution.
        `stdev` - Standard Deviation of the Log-Normal.
      Returns:
        Value of the Log-Normal distribution.

    - #### logNormCDF

          private float logNormCDF(float value1,
                                   float value2,
                                   float step,
                                   float mu,
                                   float sigma)

      Calculating the Log-Normal CDF between two values. For reference: http://en.wikipedia.org/wiki/Log-normal_distribution
      Parameters:
        `value1` - Lower bound value
        `value2` - Upper bound value
        `step` - Step-size for calculating the integral of the underlying PDF (should be small)
        `mu` - Log-scale/Location parameter
        `sigma` - Shape parameter.
      Returns:
        Value of the Log-Normal CDF between the two specified input values.

    - #### getHCDurProbs

          private float[][] getHCDurProbs()

      Deprecated.
      Returns hard-coded Log-Normal Probabilities for up to 3 Lane incidents.
      Returns:
        2D Array with probability of each duration for each incident severity type.

    - #### getNumScenAssignedDurationLength

          private int[][] getNumScenAssignedDurationLength(int[] numIncOfEachType)

      Method to calculate the number of scenarios assigned each duration length. Follows the Hybrid Scenario Generation methodology. Accounts for rounding issues via the 3rd set of adjustment parameters.
      Parameters:
        `numIncOfEachType` -
      Returns:
        2D array of number of incidents of each duration length.

    - #### resetRNG

          private void resetRNG()

      Resets the Random number generator to a new one based on the RNG Seed.

    - #### resetRNG

          private void resetRNG(long factor)

      Resets the Random number generator to a new one based on the RNG Seed times the input factor.
      Parameters:
        `factor` - Integer by which the RNG seed is multiplied.

    - #### exportRawRLResults

          public static void exportRawRLResults(Seed seed)