read_results {hydroMOPSO} | R Documentation |
Reading the output files of a optimised model
Description
Read results saved on disk from an optimization with hydroMOPSO. This feature only applies when fn
is in c("hydromod", "hydromodInR")
Usage
read_results(fn = NULL,
control = list(),
model.FUN = NULL,
model.FUN.args = list()
)
Arguments
fn |
( When |
control |
( |
model.FUN |
( |
model.FUN.args |
( |
Details
The control
argument is a list that can supply any of the following components:
- drty.in
(
character
)
(OPTIONAL) Used only whenfn='hydromod'
Name of the directory storing the input files required for PSO, i.e. ‘ParamRanges.txt’ and ‘ParamFiles.txt’.- drty.out
(
character
)
Path to the directory storing the output files generated by hydroMOPSO.- digits
(
numeric
)
(OPTIONAL) Used only whenwrite2disk=TRUE
Number of significant digits used for writing the output files with scientific notation.- digits.dom
(
numeric
)
Number of decimal places used in dominance check. Fewer decimal places (say, 16, 8, or 4, for example) may be necessary to prevent the algorithm from resulting in solutions that are nearly the same.
By defaultdigits.dom=Inf
, which basically means numbers are not rounded- write2disk
(
logical
)
Indicates if the output files will be written to the disk.
By defaultwrite2disk=TRUE
- verbose
(
logical
)
Indicates if progress messages are to be printed.
By defaultverbose=TRUE
- REPORT
(
integer
)
(OPTIONAL) Used only whenverbose=TRUE
The frequency of report messages printed to the screen.
By defaultREPORT=10
- parallel
(
character
)
Indicates how to parallelise ‘hydroMOPSO’ (to be precise, only the evaluation of the objective functionfn
is parallelised). Valid values are:
-)none: no parallelisation is made (this is the default value)
-)parallel: parallel computations for network clusters or machines with multiple cores or CPUs. A ‘FORK’ cluster is created with themakeForkCluster
function. Whenfn.name='hydromod'
the evaluation of the objective functionfn
is done with theclusterApply
function of the parallel package. Whenfn.name != 'hydromod'
the evaluation of the objective functionfn
is done with theparRapply
function of the parallel package.
-)parallelWin: parallel computations for network clusters or machines with multiple cores or CPUs (this is the only parallel implementation that works on Windows machines). A ‘PSOCK’ cluster is created with themakeCluster
function. Whenfn.name='hydromod'
the evaluation of the objective functionfn
is done with theclusterApply
function of the parallel package. Whenfn.name != 'hydromod'
the evaluation of the objective functionfn
is done with theparRapply
function of the parallel package.- par.nnodes
(
numeric
)
(OPTIONAL) Used only whenparallel!='none'
Indicates the number of cores/CPUs to be used in the local multi-core machine, or the number of nodes to be used in the network cluster.
By defaultpar.nnodes
is set to the amount of cores detected by the functiondetectCores()
(parallel package)- par.pkgs
(
character
)
(OPTIONAL) Used only whenparallel='parallelWin'
List of package names (as characters) that need to be loaded on each node for allowing the objective functionfn
to be evaluated.
Value
(list
)
- MOPSOResults
(
list
)
Particle repository history of all iterations (both phases of NMPSO), detailing:
- ParetoFront (
data.frame
)
History of objectives values of each Pareto Front particles in all iterations (both phases). In thisdata.frame
, the first column indicates the iterationIter
; the second column the phasePhase
(1 or 2); and the following columns are as many as objectives treated, being identified with the assigned name.
- Particles_ParetoFront (data.frame
)
History of positions of each Pareto Front particles in all iterations (both phases). In thisdata.frame
, the first column indicates the iterationIter
; the second column the phasePhase
(1 or 2); then as many columns as objectives treated, being identified with the assigned name; and finally, as many columns as decision variables (parameters).
- MaxMin (data.frame
)
Specification on whether the objectives are maximised or minimised.
- ObjsNames (data.frame
)
Name of each of the objectives (Obj1, Obj2, ...
).
- hydroDetails
(
list
)
(ONLY ADDED WHENfn=='hydromod' | fn=='hydromodInR'
)
Details about the modeling involved in optimisation:
- Dimensions (
data.frame
)
Number of objectives and number of output variables involved in the optimisation.
- NamesAndUnitsVars (data.frame
)
Name and unit of measure of the output variables involved in the optimisation (var1, var1_unit, var2, var2_unit, ...
).
- Obs (list
)
Observed values of each of the variables involved in the optimisation, keeping in mind that the same format indicated as mandatory input dataObs
within theFUN
function is maintained.
- WarmUp (data.frame
)
Time series indicating the warm-up period used in the optimisation.
- DatesCal (data.frame
)
Time series indicating the calibration period used in the optimisation.
- hydroResults
(
list
)
(ONLY ADDED WHENfn=='hydromod' | fn=='hydromodInR'
)
Post-processed results about the modeling involved in optimisation:
- ParticlesFull (
data.frame
)
History of positions of each Pareto Front particles in all iterations. In thisdata.frame
, the first column indicates the simulation numberSim
, in ascending order from the first simulation (first iteration, phase 1) to the last simulation (last iteration, phase 2); then as many columns as objectives treated, being identified with the assigned name; and finally, as many columns as decision variables (parameters).
- FilledPOF (data.frame
)
Filled Pareto front, built from evaluating the dominance of the solutions of all the iterations performed in the optimisation. To prevent the filled Pareto Front from having too many solutions, the parameters and objective values are rounded according to inputDigitsDom
(number of decimal places). In thisdata.frame
, the first column indicates the simulation numberSim
; then as many columns as objectives treated, being identified with the assigned name.
- ParticlesFilledPOF (data.frame
)
Perticles from filled Pareto Front. In thisdata.frame
, the first column indicates the simulation numberSim
; then as many columns as objectives treated, being identified with the assigned name; and finally, as many columns as decision variables (parameters).
- ModelOut (list
)
Time series of the model output variables, for all solutions of the filled Pareto Front. This list has as many objects as output variables, and each one corresponds to an object of class zoo with as many columns as solutions of the filled Pareto Front.
- ParticleBestCS (data.frame
)
Best compromise solution, i.e., the solution with the minimum Euclidean distance from the maximum values of each objective. data.frame with only one row and several columns: the first column indicates the simulation numberSim
; then as many columns as objectives treated, being identified with the assigned name; and finally, as many columns as decision variables (parameters).
- ModelOutBestCS (list
)
Time series of the model output variables, just for the best compromise solution. This list has as many objects as output variables, and each one corresponds to an object of class zoo with a single time serie.
- ParticleBestObjs (list
)
Solutions that minimise/maximise each of the objectives. data.frame with only one row. In a first level, this list has as many objects as objectives involves in the optimisation, each one with a data.frame with only one row and several columns: the first column indicates the simulation numberSim
; then as many columns as objectives treated, being identified with the assigned name; and finally, as many columns as decision variables (parameters).
- ModelOutBestObjs (list
)
Time series of the model output variables, for the maximisation/minimisation of each objective. In a first level, this list has as many objects as objectives involves in the optimisation and, in a second level, each one corresponds to a list with as many objects as output variables, each one corresponding to an object of class zoo with a single time serie.
- AnalysisPeriod (character
)
String indicating the analysis period, in this case"calibration"
.
- DigitsDom (numeric
)
Number of decimal places used in dominance check. Fewer decimal places (say, 16, 8, or 4, for example) may be necessary to prevent the algorithm from resulting in solutions that are nearly the same.
- ObjsNames (data.frame
)
Name of each of the objectives (Obj1, Obj2, ...
).
- MaxMin (data.frame
)
Specification on whether the objectives are maximised or minimised, must be inc("max", "min")
.
- Obs (list
)
Observed values of each of the variables involved in the optimisation, keeping in mind that the same format indicated as mandatory input dataObs
within theFUN
function is maintained.
- Dimensions (data.frame
)
Number of objectives and number of output variables involved in the optimisation.
- NamesAndUnitsVars (data.frame
)
Name and unit of measure of the output variables involved in the optimisation (var1, var1_unit, var2, var2_unit, ...
).
- WarmUp (data.frame
)
Time series indicating the warm-up period used in the optimisation.
- DatesCal (data.frame
)
Time series indicating the calibration period used in the optimisation.
Note
1) The intended workflow is that first you must have the results of the optimisation done with the hydroMOPSO
function, having saved the results to disk (write2disk=TRUE
in hydroMOPSO
)
2) Based on the previous point, the user must ensure that the input arguments fn
, control
, model.FUN
and model.FUN.args
that are entered in the hydroMOPSO
and read_results
functions must be EXACTLY THE SAME
Author(s)
Rodrigo Marinao Rivas ra.marinao.rivas@gmail.com, Mauricio Zambrano-Bigiarini, mzb.devel@gmail.com
See Also
hydroMOPSO