| writeControlFile {foreSIGHT} | R Documentation |
Writes a sample controlFile.json file
Description
writeControlFile() writes a sample controlFile.json file. The controlFile.json file is used to specify alternate model and optimisation options and used as an input to the function generateScenarios.
The user may use the sample file created by this function as a guide to create an "controlFile.json" file for their application.
Usage
writeControlFile(
jsonfile = "sample_controlFile.json",
basic = TRUE,
nml = NULL
)
Arguments
jsonfile |
string; to specify the name of the json file to be written. The default name of the sample file is "sample_controlFile.json". The file will be written to the working directory of the user. |
basic |
logical ( |
nml |
list; the namelist to be written to the json file, as an R list. This argument may be used to create a JSON file using an controlFile from an existing simulation. If this argument is set to NULL, the function writes the default model/optimisation options defined in the package to the json file. |
Details
The function may be used without any input arguments to write a "basic" sample controlFile.
Value
A json file. The file may be used as an example to create an "controlFile.json" file for input to generateScenarios.
An "controlFile.json" file may contain any subset of the fields listed below. The user may delete the unused fields from the file.
The exception cases where it is mandatory to specify two fields together in controlFile are detailed as part of the list below.
-
modelType: a list by variable. Each element of the list is a string specifying the type of stochastic model. ifmodelTypeis specified for a variable in controlFile,modelParameterVariationshould also be specified. This is because these two fields together define the stochastic model. UseviewModels()to view the valid options formodelTypeby variable. -
modelParameterVariation: a list by variable. Each element of the list is a string specifying the type of the parameter variation (annual, seasonal, harmonic etc.) of the stochastic model. ifmodelParameterVariationis specified for a variable in controlFile,modelTypeshould also be specified. This is because these two fields together define the stochastic model. UseviewModels()to view valid options formodelParameterVariationby variable. -
modelParameterBounds: a nested list by variable. Each element is a list containing the bounds of the parameters of the chosen stochastic model. This field exists to provide an option to overwrite the default bounds of the parameters of the stochastic model. Careful consideration is recommended prior to settingmodelParameterBoundsin the controlFile to overwrite the defaults provided in the package. -
optimisationArguments: a list. Contains the optimisation options used by functiongafrom thegapackage. Brief definitions are given below.-
optimizer: the numerical optimization routine. Options include'RGN'for Robust Gauss Newton (usingRGN::rgn),'NM'for Nelder-Mead (usingdfoptim::nmkb),'SCE'for Shuffled Complex Evolution (usingSoilHyP::SCEoptim).'GA'for Genetic Algorithm (usingGA::ga), Defaults to 'RGN'. -
seed: random seed used (for first multistart) in numerical optimization (often for determining random initial parameter values). Default is 1. -
obj.func: the type of objective function used (important only when penalty weights are not equal. -
suggestions: suggestions for starting values of parameters for optimisation. Options include'WSS'(weighted sum of squares) andSS_absPenalty(sum of squares plus absolute penalty) -
nMultiStart: the number of multistarts used in optimization. Default is 5. -
RGN.control: RGN optional arguments specified bycontrollist inRGN::rgn. -
NM.control: NM optional arguments specified bycontrollist indfoptim::nmkb. -
SCE.control: SCE optional arguments specified bycontrollist inSoilHyP::SCEoptim. -
GA.args: GA optional arguments specified inGA::ga.
-
-
penaltyAttributes: a character vector of climate attributes to place specific focus on during targeting via the use of a penalty function during the optimisation process. ThepenaltyAttributesshould belong toattPerturborattHoldthat are specified in the exposure space used as input togenerateScenarios. IfpenaltyAttributesare specified in the controlFile,penaltyWeightsshould also be specified. -
penaltyWeights: a numeric vector; the length of the vector should be equal to the length ofpenaltyAttributes.penaltyWeightsare the multipliers of the correspondingpenaltyAttributesused during the optimisation.
See Also
generateScenarios, viewModels, viewDefaultOptimArgs
Examples
## Not run:
# To write a sample controlFile
writeControlFile()
# To write an advanced sample controlFile
writeControlFile(jsonfile = "sample_controlFile_advanced.json", basic = FALSE)
## End(Not run)