Module implementing the optimization methods and main procedures for reading the "main.txt" file, launching the optimization, and reporting results.
When adding more optimization methods, variables nb_methods
and
method_names
must updated.
When adding more report parameters, variables nb_rprt_params
and
rport_params
) must be updated.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | nb_methods | = | 2 |
Number of methods implemented |
character(len=20), | public, | parameter, dimension(nb_methods) | :: | method_names | = | (/"GD ", "NR "/) |
The names of the methods themselves |
integer, | public, | parameter | :: | nb_rprt_params | = | 3 |
Number of report parameters. |
character(len=256), | public, | parameter, dimension(nb_rprt_params) | :: | rprt_params | = | (/"freq ", "format", "print "/) |
Names of the report parameters. |
GRADIENT DESCENT
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=20) | :: | format_str |
formatting string |
|||
character(len=1000) | :: | output_str |
Actual x and y values for reportting. |
Subroutine for handling the optimization runs.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer | :: | nb_methods |
The total number of optimization methods currently implemented |
|||
integer | :: | nb_rprt_params |
Number of report parameters currently implemented. |
|||
character(len=20), | dimension(nb_methods) | :: | method_names |
Array of optimization methods' names/labels. |
||
character(len=256), | dimension(nb_rprt_params) | :: | rprt_params |
Array of report parameters' names/labels. |
Subroutine for handling the method's hyper parameters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer | :: | nb_hprparams |
The total number of hyper parameters possible for the optimization method. |
|||
integer | :: | size_hprdata |
Size of hprdata second dimension (usually dimx, extended for generality). |
|||
character(len=256), | dimension(nb_hprparams) | :: | hprnames |
Array of hyper parameter names/labels. |
||
real(kind=8), | dimension(nb_hprparams, size_hprdata) | :: | hprdata |
Array of data (each hyperparameter value). Will have a lot of unused elements, since not all hyper parameters will have the same dimension. Each line is a different hyper parameter, in the same order as in hprnames. |
||
integer, | dimension(nb_hprparams) | :: | hprdim |
Dimension of each hyper parameter, again in order. |
||
logical, | dimension(nb_hprparams) | :: | hprbool |
Boolean array indicating which hyper parameters have been informed by the user (.true.) and which weren't (.false.). |
||
logical, | dimension(nb_hprparams) | :: | requiredbool |
Which hyper parameters are required (.true.) and
which are optional (.false.). This argument is
not used in this subroutine, but directly in
|
Subroutine for handling file reading errors.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer | :: | filestatus |
File reading status (indicates errors) |
|||
character(len=256) | :: | errormsg |
Error message and read line |
Subroutine for checking which hyper parameters were informed by the user.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer | :: | nb_hprparams | ||||
character(len=256), | dimension(nb_hprparams) | :: | hprnames |
Hyperparameter names. |
||
real(kind=8), | dimension(nb_hprparams, dimx) | :: | hprdata |
Where data will be saved |
||
integer, | dimension(nb_hprparams) | :: | hprdim |
Dimension of each hprparam. |
||
logical, | dimension(nb_hprparams) | :: | hprbool |
Bool array: hprparam present or not |
||
logical, | dimension(nb_hprparams) | :: | requiredbool |
Bool array: hprparam optional or not |
Small function for formatting data according to a format string.
Argument value_str
is the output string containing the
x
and y
values.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=8), | intent(in), | dimension(dimx) | :: | x |
Input variable |
|
real(kind=8), | intent(in) | :: | y |
Function value at x |
||
character(len=20) | :: | format_str |
Formatting string |
|||
character(len=1000) | :: | value_str |
Output string |