https://www.cdslab.org/paramonte/fortran/2
Current view: top level - main - pm_sampling_nest.imp.F90 (source / functions) Hit Total Coverage
Test: ParaMonte 2.0.0 :: Serial Fortran - Code Coverage Report Lines: 0 321 0.0 %
Date: 2024-04-08 03:18:57 Functions: 0 56 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       2             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       3             : !!!!                                                                                                                            !!!!
       4             : !!!!    ParaMonte: Parallel Monte Carlo and Machine Learning Library.                                                           !!!!
       5             : !!!!                                                                                                                            !!!!
       6             : !!!!    Copyright (C) 2012-present, The Computational Data Science Lab                                                          !!!!
       7             : !!!!                                                                                                                            !!!!
       8             : !!!!    This file is part of the ParaMonte library.                                                                             !!!!
       9             : !!!!                                                                                                                            !!!!
      10             : !!!!    LICENSE                                                                                                                 !!!!
      11             : !!!!                                                                                                                            !!!!
      12             : !!!!       https://github.com/cdslaborg/paramonte/blob/main/LICENSE.md                                                          !!!!
      13             : !!!!                                                                                                                            !!!!
      14             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      15             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      16             : 
      17             :     use pm_strASCII, only: SUB
      18             :     use pm_except, only: isNAN
      19             :     use pm_except, only: setNAN
      20             :     use pm_val2str, only: getStr
      21             :     use pm_strASCII, only: getStrLower
      22             :     use pm_kind, only: SKC => SK, SK, IK, LK
      23             :     use pm_sampling_base, only: specbase_type, astatbase_type, sfcbase_type, NL2, NL1
      24             :     use pm_sampling_scio, only: cfcnest_type
      25             : 
      26             :     implicit none
      27             : 
      28             :     character(*,SKC)    , parameter         :: MODULE_NAME = SK_"@pm_sampling_nest"
      29             : 
      30             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      31             :     ! simulation declarations.
      32             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      33             : 
      34             :     ! type for output sample file contents.
      35             :     type, extends(sfcbase_type)             :: sfcnest_type
      36             :     end type
      37             : 
      38             :     type, abstract, extends(astatbase_type) :: astatnest_type
      39             :     end type
      40             : 
      41             :     type, abstract, extends(astatnest_type) :: statnest_type
      42             :         type(cfcnest_type)                  :: cfc
      43             :         type(sfcnest_type)                  :: sfc
      44             :     end type
      45             : 
      46             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      47             :     ! specification declarations.
      48             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      49             : 
      50             :     type                                :: domainPartitionAdaptationCount_type
      51             :         integer(IK)                     :: val
      52             :         integer(IK)                     :: def
      53             :         integer(IK)                     :: null
      54             :         character(:,SKC), allocatable   :: desc
      55             :     end type
      56             : 
      57             :     type                                :: domainPartitionAdaptationPeriod_type
      58             :         integer(IK)                     :: val
      59             :         integer(IK)                     :: def
      60             :         integer(IK)                     :: null
      61             :         character(:,SKC), allocatable   :: desc
      62             :     end type
      63             : 
      64             :     type                                :: domainPartitionBiasCorrectionEnabled_type
      65             :         logical(LK)                     :: val
      66             :         logical(LK)                     :: def
      67             :         character(:,SKC), allocatable   :: desc
      68             :     end type
      69             : 
      70             :     type                                :: domainPartitionCountMax_type
      71             :         integer(IK)                     :: val
      72             :         integer(IK)                     :: def
      73             :         integer(IK)                     :: null
      74             :         character(:,SKC), allocatable   :: desc
      75             :     end type
      76             : 
      77             :     type                                :: domainPartitionFactorExpansion_type
      78             :         real(RKC)                       :: val
      79             :         real(RKC)                       :: def
      80             :        !real(RKC)                       :: null
      81             :         character(:,SKC), allocatable   :: desc
      82             :     end type
      83             : 
      84             :     type                                :: domainPartitionFactorShrinkage_type
      85             :         real(RKC)                       :: val
      86             :         real(RKC)                       :: def
      87             :        !real(RKC)                       :: null
      88             :         character(:,SKC), allocatable   :: desc
      89             :     end type
      90             : 
      91             :     type                                :: domainPartitionKmeansClusterCountMax_type
      92             :         integer(IK)                     :: val
      93             :         integer(IK)                     :: def
      94             :         integer(IK)                     :: null
      95             :         character(:,SKC), allocatable   :: desc
      96             :     end type
      97             : 
      98             :     type                                :: domainPartitionKmeansClusterSizeMin_type
      99             :         integer(IK)                     :: val
     100             :         integer(IK)                     :: def
     101             :         integer(IK)                     :: null
     102             :         character(:,SKC), allocatable   :: desc
     103             :     end type
     104             : 
     105             :     type                                :: domainPartitionKmeansNormalizationEnabled_type
     106             :         logical(LK)                     :: val
     107             :         logical(LK)                     :: def
     108             :         character(:,SKC), allocatable   :: desc
     109             :     end type
     110             : 
     111             :     type                                :: domainPartitionKmeansNumFailMax_type
     112             :         integer(IK)                     :: val
     113             :         integer(IK)                     :: def
     114             :         integer(IK)                     :: null
     115             :         character(:,SKC), allocatable   :: desc
     116             :     end type
     117             : 
     118             :     type                                :: domainPartitionKmeansNumRecursionMax_type
     119             :         integer(IK)                     :: val
     120             :         integer(IK)                     :: def
     121             :         integer(IK)                     :: null
     122             :         character(:,SKC), allocatable   :: desc
     123             :     end type
     124             : 
     125             :     type                                :: domainPartitionKmeansNumTry_type
     126             :         integer(IK)                     :: val
     127             :         integer(IK)                     :: def
     128             :         integer(IK)                     :: null
     129             :         character(:,SKC), allocatable   :: desc
     130             :     end type
     131             : 
     132             :     type                                :: domainPartitionKvolumeNumRecursionMax_type
     133             :         integer(IK)                     :: val
     134             :         integer(IK)                     :: def
     135             :         integer(IK)                     :: null
     136             :         character(:,SKC), allocatable   :: desc
     137             :     end type
     138             : 
     139             :     type                                :: domainPartitionKvolumeWeightExponent_type
     140             :         real(RKC)                       :: val
     141             :         real(RKC)                       :: def
     142             :        !real(RKC)                       :: null
     143             :         character(:,SKC), allocatable   :: desc
     144             :     end type
     145             : 
     146             :     type                                :: domainPartitionMethod_type
     147             :         logical(LK)                     :: isMultiNest = .false._LK
     148             :         logical(LK)                     :: isDynesty = .false._LK
     149             :         logical(LK)                     :: isMinVol = .false._LK
     150             :         logical(LK)                     :: isMaxDen = .false._LK
     151             :         character(9,SKC)                :: multinest = SKC_"multinest"
     152             :         character(7,SKC)                :: dynesty = SKC_"dynesty"
     153             :         character(7,SKC)                :: minvol = SKC_"minvol"
     154             :         character(7,SKC)                :: maxden = SKC_"maxden"
     155             :         character(:,SKC), allocatable   :: val
     156             :         character(:,SKC), allocatable   :: def
     157             :         character(:,SKC), allocatable   :: null
     158             :         character(:,SKC), allocatable   :: desc
     159             :     end type
     160             : 
     161             :     type                                :: domainPartitionObject_type
     162             :         logical(LK)                     :: isBall = .false._LK
     163             :         character(:,SKC), allocatable   :: val
     164             :         character(:,SKC), allocatable   :: def
     165             :         character(:,SKC), allocatable   :: null
     166             :         character(:,SKC), allocatable   :: desc
     167             :     end type
     168             : 
     169             :     type                                :: domainPartitionOptimizationScaleEnabled_type
     170             :         logical(LK)                     :: val
     171             :         logical(LK)                     :: def
     172             :         character(:,SKC), allocatable   :: desc
     173             :     end type
     174             : 
     175             :     type                                :: domainPartitionOptimizationShapeEnabled_type
     176             :         logical(LK)                     :: val
     177             :         logical(LK)                     :: def
     178             :         character(:,SKC), allocatable   :: desc
     179             :     end type
     180             : 
     181             :     type                                :: domainPartitionOptimizationShapeScaleEnabled_type
     182             :         logical(LK)                     :: val
     183             :         logical(LK)                     :: def
     184             :         character(:,SKC), allocatable   :: desc
     185             :     end type
     186             : 
     187             :     type                                :: domainPartitionScaleFactor_type
     188             :         real(RKC)                       :: val
     189             :         real(RKC)                       :: def
     190             :        !real(RKC)                       :: null
     191             :         character(:,SKC), allocatable   :: desc
     192             :     end type
     193             : 
     194             :     type                                :: domainSampler_type
     195             :         logical(LK)                     :: isRejection
     196             :         character(:,SKC), allocatable   :: val
     197             :         character(:,SKC), allocatable   :: def
     198             :         character(:,SKC), allocatable   :: null
     199             :         character(:,SKC), allocatable   :: desc
     200             :     end type
     201             : 
     202             :     type                                :: liveSampleSize_type
     203             :         real(RKC)                       :: log
     204             :         integer(IK)                     :: val
     205             :         integer(IK)                     :: def
     206             :         integer(IK)                     :: null
     207             :         character(:,SKC), allocatable   :: desc
     208             :     end type
     209             : 
     210             :     type                                :: tolerance_type
     211             :         real(RKC)                       :: val
     212             :         real(RKC)                       :: def
     213             :        !real(RKC)                       :: null
     214             :         character(:,SKC), allocatable   :: desc
     215             :     end type
     216             : 
     217             :     type, extends(specbase_type)                                    :: specnest_type
     218             :         type(domainPartitionAdaptationCount_type                )   :: domainPartitionAdaptationCount
     219             :         type(domainPartitionAdaptationPeriod_type               )   :: domainPartitionAdaptationPeriod
     220             :         type(domainPartitionBiasCorrectionEnabled_type          )   :: domainPartitionBiasCorrectionEnabled
     221             :         type(domainPartitionCountMax_type                       )   :: domainPartitionCountMax
     222             :         type(domainPartitionFactorExpansion_type                )   :: domainPartitionFactorExpansion
     223             :         type(domainPartitionFactorShrinkage_type                )   :: domainPartitionFactorShrinkage
     224             :         type(domainPartitionKmeansClusterCountMax_type          )   :: domainPartitionKmeansClusterCountMax
     225             :         type(domainPartitionKmeansClusterSizeMin_type           )   :: domainPartitionKmeansClusterSizeMin
     226             :         type(domainPartitionKmeansNormalizationEnabled_type     )   :: domainPartitionKmeansNormalizationEnabled
     227             :         type(domainPartitionKmeansNumFailMax_type               )   :: domainPartitionKmeansNumFailMax
     228             :         type(domainPartitionKmeansNumRecursionMax_type          )   :: domainPartitionKmeansNumRecursionMax
     229             :         type(domainPartitionKmeansNumTry_type                   )   :: domainPartitionKmeansNumTry
     230             :         type(domainPartitionKvolumeNumRecursionMax_type         )   :: domainPartitionKvolumeNumRecursionMax
     231             :         type(domainPartitionKvolumeWeightExponent_type          )   :: domainPartitionKvolumeWeightExponent
     232             :         type(domainPartitionMethod_type                         )   :: domainPartitionMethod
     233             :         type(domainPartitionObject_type                         )   :: domainPartitionObject
     234             :         type(domainPartitionOptimizationScaleEnabled_type       )   :: domainPartitionOptimizationScaleEnabled
     235             :         type(domainPartitionOptimizationShapeEnabled_type       )   :: domainPartitionOptimizationShapeEnabled
     236             :         type(domainPartitionOptimizationShapeScaleEnabled_type  )   :: domainPartitionOptimizationShapeScaleEnabled
     237             :         type(domainPartitionScaleFactor_type                    )   :: domainPartitionScaleFactor
     238             :         type(domainSampler_type                                 )   :: domainSampler
     239             :         type(liveSampleSize_type                                )   :: liveSampleSize
     240             :         type(tolerance_type                                     )   :: tolerance
     241             :     contains
     242             :         procedure, pass, private                                    :: sanitize
     243             :         procedure, pass, private                                    :: report
     244             :         procedure, pass, public                                     :: set
     245             :     end type
     246             : 
     247             :     interface specnest_type
     248             :         module procedure :: construct
     249             :     end interface
     250             : 
     251             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     252             : 
     253             : contains
     254             : 
     255             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     256             : 
     257           0 :     subroutine killMeAlreadyCMake1_RK5(); use pm_sampling_scio_RK5, only: RKC; end subroutine
     258           0 :     subroutine killMeAlreadyCMake1_RK4(); use pm_sampling_scio_RK4, only: RKC; end subroutine
     259           0 :     subroutine killMeAlreadyCMake1_RK3(); use pm_sampling_scio_RK3, only: RKC; end subroutine
     260           0 :     subroutine killMeAlreadyCMake1_RK2(); use pm_sampling_scio_RK2, only: RKC; end subroutine
     261           0 :     subroutine killMeAlreadyCMake1_RK1(); use pm_sampling_scio_RK1, only: RKC; end subroutine
     262             : 
     263           0 :     subroutine killMeAlreadyCMake2_RK5(); use pm_sampling_base_RK5, only: RKC; end subroutine
     264           0 :     subroutine killMeAlreadyCMake2_RK4(); use pm_sampling_base_RK4, only: RKC; end subroutine
     265           0 :     subroutine killMeAlreadyCMake2_RK3(); use pm_sampling_base_RK3, only: RKC; end subroutine
     266           0 :     subroutine killMeAlreadyCMake2_RK2(); use pm_sampling_base_RK2, only: RKC; end subroutine
     267           0 :     subroutine killMeAlreadyCMake2_RK1(); use pm_sampling_base_RK1, only: RKC; end subroutine
     268             : 
     269             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     270             : 
     271           0 :     function construct(modelr, method, ndim) result(spec)
     272             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     273             :         !DEC$ ATTRIBUTES DLLEXPORT :: construct
     274             : #endif
     275             :         use pm_kind, only: modelr_type
     276             :         type(modelr_type), intent(in) :: modelr
     277             :         character(*,SKC), intent(in) :: method
     278             :         integer(IK), intent(in) :: ndim
     279             :         type(specnest_type) :: spec
     280             : 
     281           0 :         spec%specbase_type = specbase_type(modelr, method, ndim)
     282             : 
     283             :         domainPartitionAdaptationCount_block: block
     284             :             use pm_sampling_scio, only: domainPartitionAdaptationCount
     285           0 :             spec%domainPartitionAdaptationCount%def = huge(0_IK)
     286           0 :             spec%domainPartitionAdaptationCount%null = -huge(0_IK)
     287             :             spec%domainPartitionAdaptationCount%desc = &
     288             :             SKC_"The simulation specification `domainPartitionAdaptationCount` is a positive-valued scalar of type `integer` of default kind representing the total number of adaptive &
     289             :                 &updates to make to the parameters of the domain sampler to increase the efficiency of the sampler thus increasing the overall sampling efficiency. &
     290             :                 &Every `domainPartitionAdaptationPeriod` number of calls to the objective function, the parameters of the domain sampler &
     291             :                 &will be updated until either the total number of adaptive updates reaches the value of `domainPartitionAdaptationCount`. &
     292             :                 &If the condition `domainPartitionAdaptationCount == 0`, then the domain sampler parameters will be fixed to &
     293             :                 &the initial input values throughout the entire sampling/integration. &
     294           0 :                 &The default value is `"//getStr(spec%domainPartitionAdaptationCount%def)//SKC_"`."
     295             :             !$omp master
     296           0 :             domainPartitionAdaptationCount = spec%domainPartitionAdaptationCount%null
     297             :             !$omp end master
     298             :         end block domainPartitionAdaptationCount_block
     299             : 
     300             :         domainPartitionAdaptationPeriod_block: block
     301             :             use pm_sampling_scio, only: domainPartitionAdaptationPeriod
     302           0 :             spec%domainPartitionAdaptationPeriod%def = 500_IK ! + 1_IK ! max(nd+1_IK,100_IK)
     303           0 :             spec%domainPartitionAdaptationPeriod%null = -huge(0_IK)
     304             :             spec%domainPartitionAdaptationPeriod%desc = &
     305             :             SKC_"The simulation specification `domainPartitionAdaptationPeriod` is a positive-valued scalar of type `integer` of default kind. &
     306             :                 &Every `domainPartitionAdaptationPeriod` calls to the objective function, the approximated shape of the domain of the objective function will be updated. &
     307             :                 &The smaller the value of `domainPartitionAdaptationPeriod`, the easier it will be for the integrator to adapt the domain sampler to the constrained &
     308             :                 &shape of the domain of the objective function. However, this will happen at the expense of slower simulation runtime because the adaptation &
     309             :                 &process is generally computationally expensive, in particular, for very high dimensional objective functions (`ndim >> 1`). &
     310             :                 &The larger the value of `domainPartitionAdaptationPeriod`, the easier it will be for the integrator kernel to keep the &
     311             :                 &sampling efficiency close to the requested target acceptance rate range (specified via the `targetAcceptanceRate`). &
     312             :                 &However, too large values for `domainPartitionAdaptationPeriod` will only delay the adaptation of the domain &
     313             :                 &sampler to the global structure of the domain of the objective function that is being sampled. &
     314           0 :                 &The default value is `"//getStr(spec%domainPartitionAdaptationPeriod%def)//SKC_"`."
     315             :             !$omp master
     316           0 :             domainPartitionAdaptationPeriod = spec%domainPartitionAdaptationPeriod%null
     317             :             !$omp end master
     318             :         end block domainPartitionAdaptationPeriod_block
     319             : 
     320             :         domainPartitionBiasCorrectionEnabled_block: block
     321             :             use pm_sampling_scio, only: domainPartitionBiasCorrectionEnabled
     322           0 :             spec%domainPartitionBiasCorrectionEnabled%def = .true._LK
     323             :             spec%domainPartitionBiasCorrectionEnabled%desc = &
     324             :             SKC_"The simulation specification `domainPartitionBiasCorrectionEnabled` is a scalar of type `logical` (Boolean) of default kind. &
     325             :                 &When `domainPartitionBiasCorrectionEnabled` is set to the logical true value (equivalent to `.true.`, `.t.`, or `true`, all case-INsensitive, &
     326             :                 &in an external input file, or True from within Python environment or true from within a MATLAB session), the final scales of the partitions of &
     327             :                 &the live points of the sampler will be optimized. This will minimize the inaccuracies in the partitioning of the domain of the objective &
     328           0 :                 &function, although, it comes with an extra cost in terms of sampler runtime efficiency. The default value is `"//getStr(spec%domainPartitionBiasCorrectionEnabled%def)//SKC_"`."
     329             :             !$omp master
     330           0 :             domainPartitionBiasCorrectionEnabled = spec%domainPartitionBiasCorrectionEnabled%def
     331             :             !$omp end master
     332             :         end block domainPartitionBiasCorrectionEnabled_block
     333             : 
     334             :         domainPartitionCountMax_block: block
     335             :             use pm_sampling_scio, only: domainPartitionCountMax
     336           0 :             spec%domainPartitionCountMax%def  = huge(0_IK)
     337           0 :             spec%domainPartitionCountMax%null = -huge(0_IK)
     338             :             spec%domainPartitionCountMax%desc = &
     339             :             SKC_"The simulation specification `domainPartitionCountMax` is a positive-valued scalar of type `integer` of default kind, &
     340             :                 &representing the maximum number of partitions to be used in constraining the domain of the objective function as defined &
     341             :                 &by the live (active) points at any stage of the simulation. When the condition `domainPartitionCountMax == 1` holds, &
     342             :                 &a single partition (e.g., ellipsoid) will be used to constrain the domain of the objective function. &
     343             :                 &Note that the condition `1 =< domainPartitionCountMax =< liveSampleSize / (ndim + 1)` must hold in all simulations where `ndim` &
     344             :                 &is the number of dimensions of the domain of the density function to be sampled. Do not set this simulation specification to small &
     345           0 :                 &numbers unless you know the consequences. Doing so, may cause the sampler to become highly inefficient. The default value is `"//getStr(spec%domainPartitionCountMax%def)//SKC_"`."
     346             :             !$omp master
     347           0 :             domainPartitionCountMax = spec%domainPartitionCountMax%null
     348             :             !$omp end master
     349             :         end block domainPartitionCountMax_block
     350             : 
     351             :         domainPartitionFactorExpansion_block: block
     352             :             use pm_sampling_scio, only: domainPartitionFactorExpansion
     353           0 :             spec%domainPartitionFactorExpansion%def = 1._RKC !1.1_RKC
     354             :             spec%domainPartitionFactorExpansion%desc = &
     355             :             SKC_"The simulation specification `domainPartitionFactorExpansion` is a positive-valued scalar of type `real` of the highest precision &
     356             :                 &available within the ParaMonte library, representing the factor by which the volume of the bounding regions of the live (active) &
     357             :                 &points are enlarged after the partitioning of the domain of the objective function. &
     358             :                 &Setting `domainPartitionFactorExpansion << 1` may lead to biased and unreliable results. &
     359             :                 &Conversely, setting `domainPartitionFactorExpansion >> 1` will lead to conservative inefficient &
     360             :                 &partitioning of the domain and slow sampling and integration of the objective function. &
     361           0 :                 &The default value is `"//getStr(spec%domainPartitionFactorExpansion%def)//SKC_"`."
     362             :                 !&If ellipsoidalBoundingVolume < domainPartitionFactorExpansion * actualLivePointVolume, then, further partitioning of the live &
     363             :                 !&points will be performed. Conversely, if ellipsoidalBoundingVolume >= domainPartitionFactorExpansion * actualLivePointVolume, &
     364             :                 !&then, no further partitioning of the live points will be performed and the estimated ellipsoidalBoundingVolume will be enlarged &
     365             :                 !&to match domainPartitionFactorExpansion * actualLivePointVolume.
     366             :             !$omp master
     367           0 :             call setNAN(domainPartitionFactorExpansion)
     368             :             !$omp end master
     369             :         end block domainPartitionFactorExpansion_block
     370             : 
     371             :         domainPartitionFactorShrinkage_block: block
     372             :             use pm_sampling_scio, only: domainPartitionFactorShrinkage
     373           0 :             spec%domainPartitionFactorShrinkage%def = 1._RKC !1.1_RKC
     374             :             spec%domainPartitionFactorShrinkage%desc = &
     375             :             SKC_"The simulation specification `domainPartitionFactorShrinkage` is a positive-valued scalar of type `real` of the highest precision &
     376             :                 &available within the ParaMonte library, representing the factor by which the volume of the bounding regions of the live (active) &
     377             :                 &points is multiplied before its usage in ellipsoidal partitioning. If the condition &
     378             :                 &`ellipsoidalBoundingVolume < domainPartitionFactorShrinkage * actualLivePointVolume` holds, then, further partitioning of the live points &
     379             :                 &will be performed. Conversely, if the condition `ellipsoidalBoundingVolume >= domainPartitionFactorShrinkage * actualLivePointVolume` holds, &
     380             :                 & no further partitioning of the live points will be performed and the estimated `ellipsoidalBoundingVolume` will be enlarged &
     381             :                 &to match `domainPartitionFactorShrinkage * actualLivePointVolume`. This is a low-level simulation specification. &
     382             :                 &Setting `domainPartitionFactorShrinkage << 1` may lead to biased and unreliable results. &
     383             :                 &Conversely, setting `domainPartitionFactorShrinkage >> 1` will lead to conservative inefficient partitioning of &
     384           0 :                 &the domain and slow sampling and integration of the objective function. The default value is `"//getStr(spec%domainPartitionFactorShrinkage%def)//SKC_"`."
     385             :             !$omp master
     386           0 :             call setNAN(domainPartitionFactorShrinkage)
     387             :             !$omp end master
     388             :         end block domainPartitionFactorShrinkage_block
     389             : 
     390             :         domainPartitionKmeansClusterCountMax_block: block
     391             :             use pm_sampling_scio, only: domainPartitionKmeansClusterCountMax
     392           0 :             spec%domainPartitionKmeansClusterCountMax%def  = 2_IK ! 10000_IK
     393           0 :             spec%domainPartitionKmeansClusterCountMax%null = -huge(0_IK)
     394             :             spec%domainPartitionKmeansClusterCountMax%desc = &
     395             :             SKC_"The simulation specification `domainPartitionKmeansClusterCountMax` is a scalar positive `integer` of default kind that sets &
     396             :                 &the maximum number of clusters to be found by the Kmeans clustering algorithm at any level of partitioning of the live sample. &
     397             :                 &Note that the condition `1 <= domainPartitionKmeansClusterCountMax <= domainPartitionCountMax` must hold. &
     398           0 :                 &The default value is `min("//getStr(spec%domainPartitionKmeansClusterCountMax%def)//SKC_", domainPartitionCountMax)`."
     399             :             !$omp master
     400           0 :             domainPartitionKmeansClusterCountMax = spec%domainPartitionKmeansClusterCountMax%null
     401             :             !$omp end master
     402             :         end block domainPartitionKmeansClusterCountMax_block
     403             : 
     404             :         domainPartitionKmeansClusterSizeMin_block: block
     405             :             use pm_sampling_scio, only: domainPartitionKmeansClusterSizeMin
     406           0 :             spec%domainPartitionKmeansClusterSizeMin%def  = 0_IK
     407           0 :             spec%domainPartitionKmeansClusterSizeMin%null = -huge(0_IK)
     408             :             spec%domainPartitionKmeansClusterSizeMin%desc = &
     409             :             SKC_"The simulation specification `domainPartitionKmeansClusterSizeMin` in a scalar non-negative `integer` of default kind representing the minimum &
     410             :             &size of the clusters allowed to be identified by the Kmeans clustering algorithms when partitioning any subsets of the live sample of the sampler. &
     411             :             &Note that the condition `0 <= domainPartitionKmeansClusterSizeMin <= liveSampleSize` must hold. Do not set this simulation specification to values &
     412             :             &significantly larger than `ndim + 1` where `ndim` is the number of dimensions of the domain of the objective function. Doing so may cause the &
     413           0 :             &sampler to become highly inefficient. The default value is `"//getStr(spec%domainPartitionKmeansClusterSizeMin%def)//SKC_"`."
     414             :             !$omp master
     415           0 :             domainPartitionKmeansClusterSizeMin = spec%domainPartitionKmeansClusterSizeMin%null
     416             :             !$omp end master
     417             :         end block domainPartitionKmeansClusterSizeMin_block
     418             : 
     419             :         domainPartitionKmeansNormalizationEnabled_block: block
     420             :             use pm_sampling_scio, only: domainPartitionKmeansNormalizationEnabled
     421           0 :             spec%domainPartitionKmeansNormalizationEnabled%def = .true._LK
     422             :             spec%domainPartitionKmeansNormalizationEnabled%desc = &
     423             :             SKC_"The simulation specification `domainPartitionKmeansNormalizationEnabled` is a scalar of type `logical` (Boolean) of default kind. &
     424             :                 &When `domainPartitionKmeansNormalizationEnabled` is set to the logical (Boolean) true value (equivalent to `.true.`, `.t.`, or `true`, all case-INsensitive, &
     425             :                 &from inside the input file or `True` from inside Python or `true` from inside MATLAB), any subset of live points will be standardized before being passed &
     426             :                 &to the Kmeans algorithm. Enabling this option will lead to better behavior of the Kmeans algorithm and potentially better &
     427             :                 &identification of the subclusters in data. This improvement, however, comes with an extra cost in terms of runtime &
     428           0 :                 &efficiency of the "//spec%method%val//SKC_" sampler. The default value is `"//getStr(spec%domainPartitionKmeansNormalizationEnabled%def)//SKC_"`."
     429             :             !$omp master
     430           0 :             domainPartitionKmeansNormalizationEnabled = spec%domainPartitionKmeansNormalizationEnabled%def
     431             :             !$omp end master
     432             :         end block domainPartitionKmeansNormalizationEnabled_block
     433             : 
     434             :         domainPartitionKmeansNumFailMax_block: block
     435             :             use pm_sampling_scio, only: domainPartitionKmeansNumFailMax
     436           0 :             spec%domainPartitionKmeansNumFailMax%def  = 10_IK ! 10000_IK
     437           0 :             spec%domainPartitionKmeansNumFailMax%null = -huge(0_IK)
     438             :             spec%domainPartitionKmeansNumFailMax%desc = &
     439             :             SKC_"The simulation specification `domainPartitionKmeansNumFailMax` is a positive-valued scalar of type `integer` of default kind &
     440             :                 &that sets the maximum allowed number of Kmeans clustering failures at each clustering try within simulations that employ the rejection sampling method. &
     441             :                 &This is a low-level simulation specification whose value should not be changed from the default unless the consequences are well understood. &
     442             :                 &Setting this simulation property to a small value, for example, on the order of ten, may lead to highly inefficient simulations. &
     443           0 :                 &The default value is `"//getStr(spec%domainPartitionKmeansNumFailMax%def)//SKC_"`."
     444             :             !$omp master
     445           0 :             domainPartitionKmeansNumFailMax = spec%domainPartitionKmeansNumFailMax%null
     446             :             !$omp end master
     447             :         end block domainPartitionKmeansNumFailMax_block
     448             : 
     449             :         domainPartitionKmeansNumRecursionMax_block: block
     450             :             use pm_sampling_scio, only: domainPartitionKmeansNumRecursionMax
     451           0 :             spec%domainPartitionKmeansNumRecursionMax%def  = 10_IK ! 10000_IK
     452           0 :             spec%domainPartitionKmeansNumRecursionMax%null = -huge(0_IK)
     453             :             spec%domainPartitionKmeansNumRecursionMax%desc = &
     454             :             SKC_"The simulation specification `domainPartitionKmeansNumRecursionMax` is a positive scalar of type `integer` of default kind &
     455             :                 &that sets the maximum allowed number of Kmeans convergence iterations in simulations that employ the rejection sampling method. &
     456             :                 &This is a low-level simulation specification whose value should not be changed from the default unless the consequences are well understood. &
     457             :                 &Setting this simulation property to a small value, for example, on the order of ten, may lead to highly inefficient "//spec%method%val//SKC_" simulations. &
     458           0 :                 &The default value is `"//getStr(spec%domainPartitionKmeansNumRecursionMax%def)//SKC_"`."
     459             :             !$omp master
     460           0 :             domainPartitionKmeansNumRecursionMax = spec%domainPartitionKmeansNumRecursionMax%null
     461             :             !$omp end master
     462             :         end block domainPartitionKmeansNumRecursionMax_block
     463             : 
     464             :         domainPartitionKmeansNumTry_block: block
     465             :             use pm_sampling_scio, only: domainPartitionKmeansNumTry
     466           0 :             spec%domainPartitionKmeansNumTry%def  = 10_IK ! 10000_IK
     467           0 :             spec%domainPartitionKmeansNumTry%null = -huge(0_IK)
     468             :             spec%domainPartitionKmeansNumTry%desc = &
     469             :             SKC_"The simulation specification `domainPartitionKmeansNumTry` is a positive scalar of type `integer` of default kind &
     470             :                 &that sets the number of Kmeans clustering tries at each level of partitioning of the set of live points during the simulation. &
     471             :                 &This simulation specification should be not be set to very large values (e.g., >> 10) because the simulation will significantly &
     472           0 :                 &slow down. The default value is `"//getStr(spec%domainPartitionKmeansNumTry%def)//SKC_"`."
     473             :             !$omp master
     474           0 :             domainPartitionKmeansNumTry = spec%domainPartitionKmeansNumTry%null
     475             :             !$omp end master
     476             :         end block domainPartitionKmeansNumTry_block
     477             : 
     478             :         domainPartitionKvolumeNumRecursionMax_block: block
     479             :             use pm_sampling_scio, only: domainPartitionKvolumeNumRecursionMax
     480           0 :             spec%domainPartitionKvolumeNumRecursionMax%def  = 300_IK
     481           0 :             spec%domainPartitionKvolumeNumRecursionMax%null = -huge(0_IK)
     482             :             spec%domainPartitionKvolumeNumRecursionMax%desc = &
     483             :             "The simulation specification `domainPartitionKvolumeNumRecursionMax` is a positive scalar of type `integer` of default kind &
     484             :             &that sets the maximum allowed number of volume minimization convergence iterations in simulations that employ the rejection sampling method. &
     485             :             &This is a low-level simulation specification whose value should not be changed from the default unless the consequences are well understood. &
     486             :             &Setting this simulation property to a small value, for example, on the order of ten, may lead to highly inefficient "//spec%method%val//SKC_" simulations. &
     487           0 :             &The default value is `"//getStr(spec%domainPartitionKvolumeNumRecursionMax%def)//SKC_"`."
     488             :             !$omp master
     489           0 :             domainPartitionKvolumeNumRecursionMax = spec%domainPartitionKvolumeNumRecursionMax%null
     490             :             !$omp end master
     491             :         end block domainPartitionKvolumeNumRecursionMax_block
     492             : 
     493             :         domainPartitionKvolumeWeightExponent_block: block
     494             :             use pm_sampling_scio, only: domainPartitionKvolumeWeightExponent
     495           0 :             spec%domainPartitionKvolumeWeightExponent%def = 0._RKC
     496             :            !spec%domainPartitionKvolumeWeightExponent%null = NULL_RKC
     497             :             spec%domainPartitionKvolumeWeightExponent%desc = &
     498             :             SKC_"The simulation specification `domainPartitionKvolumeWeightExponent` is a positive scalar of type `real` of the highest precision available &
     499             :                 &within the ParaMonte library, representing the exponent of the power-law density weights `domainPartitionKvolumeWeightExponent` weights of &
     500             :                 &the Mahalanobis distances of live (active) points from their corresponding cluster centers when the rejection sampling method is employed. &
     501             :                 &Reasonable values include `0` or `1`. This is a low-level simulation specification whose value should not be changed from the default &
     502             :                 &unless the consequences are well understood. Setting this simulation property to any values other than the default value can drastically &
     503             :                 &affect the performance or even convergence and success of the simulations when the rejection sampling method is used. &
     504           0 :                 &The default value for `domainPartitionKvolumeWeightExponent` is `"//getStr(spec%domainPartitionKvolumeWeightExponent%def)//SKC_"`."
     505             :             !$omp master
     506           0 :             call setNAN(domainPartitionKvolumeWeightExponent)
     507             :             !$omp end master
     508             :         end block domainPartitionKvolumeWeightExponent_block
     509             : 
     510             :         domainPartitionMethod_block: block
     511             :             use pm_sampling_scio, only: domainPartitionMethod
     512           0 :             spec%domainPartitionMethod%def = "ParaMonte-OptDen"
     513           0 :             spec%domainPartitionMethod%null = repeat(SUB, len(domainPartitionMethod))
     514             :             spec%domainPartitionMethod%desc = &
     515             :             SKC_"The simulation specification `domainPartitionMethod` is a scalar string of default kind of maximum length "//getStr(domainPartitionMethod)//SKC_" containing &
     516             :                 &the name of the method to be used for the domain partitioning within the Nested sampler. The string value must be enclosed by either single or double &
     517             :                 &quotation marks when provided as input. Options that are currently supported include:"//NL2//&
     518             :             SKC_"+   domainPartitionMethod = 'ParaMonte' or 'ParaMonte optimal', all case-INsensitive."//NL2//&
     519             :             SKC_"    This is equivalent to the constrained rejection sampling via partitions &
     520             :                      &formed by bounding objects around the set of live (active) points using a complex method that optimizes the shapes &
     521             :                      &and count of bounding objects for the most-likely (optimal) density of live points within each bounding object."//NL2//&
     522             :             SKC_"+   domainPartitionMethod = 'ParaMonte MinVol' or 'ParaMonte Minimum Volume', all case-INsensitive."//NL2//&
     523             :             SKC_"    This is equivalent to the constrained rejection sampling via partitions &
     524             :                      &formed by bounding objects around the set of live (active) points using a complex method that optimizes the shapes &
     525             :                      &and count of the bounding objects to achieve a minimum overall domain volume."//NL2//&
     526             :             SKC_"+   domainPartitionMethod = 'MultiNest', all case-INsensitive."//NL2//&
     527             :             SKC_"    in which case, the method of partitioning based on volume-minimization used by the MultiNest Fortran &
     528             :                      &library will be used to find the optimal partitioning of the domain of the objective function. &
     529             :                      &The 'MultiNest' method of partitioning is similar to 'ParaMonte-MinVol' in the sense that both methods &
     530             :                      &minimize the collective volumes of the bounding objects. However, the minimization approach taken by MultiNest is much &
     531             :                      &more aggressive and often results in systematically biased results, especially in high-dimensional problems."//NL2//&
     532             :             SKC_"+   domainPartitionMethod = 'Dynesty', all case-INsensitive."//NL2//&
     533             :             SKC_"    in which case, the method of partitioning based on volume-minimization used by the Dynesty Python &
     534             :                      &library will be used to find the optimal partitioning of the domain of the objective function. &
     535             :                      &The 'often' method of partitioning is similar to 'ParaMonte-MinVol' in the sense that both methods &
     536             :                      &minimize the collective volumes of the bounding objects. However, the minimization approach taken by often is less &
     537             :                      &aggressive and often results in lower efficiencies for the Nested Sampler."//NL2//&
     538             :             SKC_"Note that all values are case-INsensitive and all hyphens (dashes, -), white-space, or other separators are ignored.&
     539             :                 &The default value is `'"//spec%domainPartitionMethod%def//SKC_"'`. Choose the other non-default methods ONLY if you know the implications or &
     540           0 :                 &if you want to perform benchmarks."
     541             :             !$omp master
     542           0 :             domainPartitionMethod = spec%domainPartitionMethod%null
     543             :             !$omp end master
     544             :         end block domainPartitionMethod_block
     545             : 
     546             :         domainPartitionObject_block: block
     547             :             use pm_sampling_scio, only: domainPartitionObject
     548           0 :             spec%domainPartitionObject%def = SKC_"hyper-ellipsoid"
     549           0 :             spec%domainPartitionObject%null = repeat(SUB, len(domainPartitionObject))
     550             :             spec%domainPartitionObject%desc = &
     551             :             SKC_"The simulation specification `domainPartitionObject` is a scalar string of default kind of maximum length "//getStr(domainPartitionObject)//SKC_" containing &
     552             :                 &the name of the ndim-dimensional geometrical object to be used for partitioning of the domain of the objective function. The string value must be enclosed &
     553             :                 &by either single or double quotation marks when specified from within an external input file. Options that are currently supported include:"//NL2//&
     554             :             SKC_"    domainPartitionObject = 'ball'"//NL2//&
     555             :             SKC_"            This is equivalent to using hyper-ellipsoids to partition the domain of the objective function."//NL2//&
     556             :             SKC_"Note that all values are case-INsensitive and all hyphens (dashes, -) and white-space characters are ignored.&
     557           0 :                 &The default value is `'"//spec%domainPartitionObject%def//SKC_"'`."
     558             :             !$omp master
     559           0 :             domainPartitionObject = spec%domainPartitionObject%null
     560             :             !$omp end master
     561             :         end block domainPartitionObject_block
     562             : 
     563             :         domainPartitionOptimizationScaleEnabled_block: block
     564             :             use pm_sampling_scio, only: domainPartitionOptimizationScaleEnabled
     565           0 :             spec%domainPartitionOptimizationScaleEnabled%def = .true._LK
     566             :             spec%domainPartitionOptimizationScaleEnabled%desc = &
     567             :             SKC_"The simulation specification `domainPartitionOptimizationScaleEnabled` is a scalar of type `logical` (Boolean). &
     568             :                 &When `domainPartitionOptimizationScaleEnabled` is set to the logical true value (equivalent to `.true.`, `.t.` or `true`, all case-INsensitive, &
     569             :                 &from within an external input file or `True` from inside Python or `true` from inside MATLAB, the final scales of the partitions of the live &
     570             :                 &points of the sampler will be optimized. This will minimize the inaccuracies in the partitioning of the domain of the objective &
     571             :                 &function, although, it comes with an extra cost in terms of runtime efficiency of the "//spec%method%val//SKC_" sampler. &
     572           0 :                 &The default value is `"//getStr(spec%domainPartitionOptimizationScaleEnabled%def)//SKC_"`."
     573             :             !$omp master
     574           0 :             domainPartitionOptimizationScaleEnabled = spec%domainPartitionOptimizationScaleEnabled%def
     575             :             !$omp end master
     576             :         end block domainPartitionOptimizationScaleEnabled_block
     577             : 
     578             :         domainPartitionOptimizationShapeEnabled_block: block
     579             :             use pm_sampling_scio, only: domainPartitionOptimizationShapeEnabled
     580           0 :             spec%domainPartitionOptimizationShapeEnabled%def = .true._LK
     581             :             spec%domainPartitionOptimizationShapeEnabled%desc = &
     582             :             SKC_"The simulation specification `domainPartitionOptimizationShapeEnabled` is a scalar of type `logical` (Boolean). &
     583             :                 &When domainPartitionOptimizationShapeEnabled = .true. (or .t. or true, all case-INsensitive, from inside the input file) &
     584             :                 &or True (from inside Python) or true (from inside MATLAB), the final centers and shapes and sizes of the partitions of the &
     585             :                 &live points of the sampler will be optimized. This will minimize the inaccuracies in the partitioning of the domain of &
     586             :                 &the objective function, although, it comes with an extra cost in terms of runtime efficiency of the "//spec%method%val//SKC_" sampler. &
     587           0 :                 &The default value is `"//getStr(spec%domainPartitionOptimizationShapeEnabled%def)//SKC_"`."
     588             :             !$omp master
     589           0 :             domainPartitionOptimizationShapeEnabled = spec%domainPartitionOptimizationShapeEnabled%def
     590             :             !$omp end master
     591             :         end block domainPartitionOptimizationShapeEnabled_block
     592             : 
     593             :         domainPartitionOptimizationShapeScaleEnabled_block: block
     594             :             use pm_sampling_scio, only: domainPartitionOptimizationShapeScaleEnabled
     595           0 :             spec%domainPartitionOptimizationShapeScaleEnabled%def = .true._LK
     596             :             spec%domainPartitionOptimizationShapeScaleEnabled%desc = &
     597             :             SKC_"The simulation specification `domainPartitionOptimizationShapeScaleEnabled` = .true. (or .t. or true, all case-INsensitive, from inside the input file) &
     598             :                 &When `domainPartitionOptimizationShapeScaleEnabled` is set to the logical true value (equivalent to `.true.`, `.t.` or `true`, all case-INsensitive, &
     599             :                 &from within an external input file or `True` from inside Python or `true` from inside MATLAB, the final centers and shapes and sizes of the partitions &
     600             :                 &of the live live points of the sampler will be enlarged for as much as possible. This will minimize the inaccuracies in the &
     601             :                 &partitioning of the domain of the objective function, although, it comes with an extra cost in terms of runtime efficiency &
     602           0 :                 &of the "//spec%method%val//SKC_" sampler. The default value is `"//getStr(spec%domainPartitionOptimizationShapeScaleEnabled%def)//SKC_"`."
     603             :             !$omp master
     604           0 :             domainPartitionOptimizationShapeScaleEnabled = spec%domainPartitionOptimizationShapeScaleEnabled%def
     605             :             !$omp end master
     606             :         end block domainPartitionOptimizationShapeScaleEnabled_block
     607             : 
     608             :         domainPartitionScaleFactor_block: block
     609             :             use pm_sampling_scio, only: domainPartitionScaleFactor
     610           0 :             spec%domainPartitionScaleFactor%def = 1.5_RKC
     611             :             spec%domainPartitionScaleFactor%desc = &
     612             :             SKC_"The simulation specification `domainPartitionScaleFactor` is a positive-valued scalar of type `real` of the highest precision available within the &
     613             :                 &ParaMonte library representing the factor by which the effective radius of the rejection sampling region is enlarged to ensure a minimally-biased integration. &
     614             :                 &Values smaller than 1 will lead to highly biased simulation results whereas values significantly larger than 1 will lead to highly inefficient simulations. &
     615             :                 &Relevant `domainPartitionScaleFactor` values are generally bound to the range `1 < domainPartitionScaleFactor < 2`. &
     616           0 :                 &The default value for `domainPartitionScaleFactor` is `"//getStr(spec%domainPartitionScaleFactor%def)//SKC_"`."
     617             :             !$omp master
     618           0 :             call setNAN(domainPartitionScaleFactor)
     619             :             !$omp end master
     620             :         end block domainPartitionScaleFactor_block
     621             : 
     622             :         domainSampler_block: block
     623             :             use pm_sampling_scio, only: domainSampler
     624           0 :             spec%domainSampler%def = SKC_"rejection" ! spec%%rejection//SKC_"-"//spec%%ellipsoidal
     625           0 :             spec%domainSampler%null = repeat(SUB, len(domainSampler))
     626             :             spec%domainSampler%desc = &
     627             :             SKC_"The simulation specification `domainSampler` is a scalar string of default kind of maximum length "//getStr(domainSampler)//SKC_" containing the name of &
     628             :                 &the domain sampler for the Nested sampling integration. The string value must be singly or doubly quoted when specified within an external input file. &
     629             :                 &Options that are currently supported include:"//NL2//&
     630             :             SKC_"    domainSampler = 'rejection'"//NL2//&
     631             :             SKC_"            This is equivalent to the constrained rejection sampling via partitions formed by bounding objects around the set of live (active) points."//NL2//&
     632           0 :             SKC_"Note that all values are case-INsensitive and all hyphens (dashes, -) and white-space characters are ignored. The default value for `domainSampler` is `'"//spec%domainSampler%def//SKC_"'`."
     633             :             !$omp master
     634           0 :             domainSampler = spec%domainSampler%null
     635             :             !$omp end master
     636             :         end block domainSampler_block
     637             : 
     638             :         liveSampleSize_block: block
     639             :             use pm_sampling_scio, only: liveSampleSize
     640           0 :             spec%liveSampleSize%def  = 1000_IK ! @todo: perhaps an intelligent setting strategy here would be useful.
     641           0 :             spec%liveSampleSize%null = -huge(0_IK)
     642             :             spec%liveSampleSize%desc = &
     643             :             SKC_"The simulation specification `liveSampleSize` is a positive scalar of type `integer` of default kind representing the number of live (active) &
     644             :                 &points that are initially sampled uniformly from the domain of the objective function. New points will be subsequently added to this sample &
     645             :                 &throughout the simulation and the lowest-value will be removed such that the size of the live (active) sample of points at any stage during &
     646             :                 &the simulation remains fixed as specified by the input simulation specification `liveSampleSize`. &
     647             :                 &The condition `ndim < liveSampleSize` must hold at all times, where `ndim` is number of dimensions of the domain of the objective function. &
     648             :                 &The specified value for `liveSampleSize` should be preferably an integer on the order of hundreds or thousands. The larger the value &
     649             :                 &of `liveSampleSize` is, the better the odds of capturing all modes of the objective function will be. &
     650             :                 &You can think of `liveSampleSize` (the number of live (active) points) as a random meshing of the integration domain of objective function. &
     651             :                 &Therefore, a larger `liveSampleSize` means a finer mesh for the integration, thus yielding more accurate results. &
     652             :                 &In general, higher-dimensional domains require larger the values specified for `liveSampleSize`. &
     653           0 :                 &The default value for `liveSampleSize` is `"//getStr(spec%liveSampleSize%def)//SKC_"`."
     654             :             !$omp master
     655           0 :             liveSampleSize = spec%liveSampleSize%null
     656             :             !$omp end master
     657             :         end block liveSampleSize_block
     658             : 
     659             :         tolerance_block: block
     660             :             use pm_sampling_scio, only: tolerance
     661           0 :             spec%tolerance%def = 0.01_RKC
     662             :            !spec%tolerance%null = NULL_RKC
     663             :             spec%tolerance%desc = &
     664             :             SKC_"The simulation specification `tolerance` is a positive scalar of type `real` of the highest precision available within the ParaMonte library &
     665             :                 &representing the threshold below which the integration of the objective function by the "//spec%method%val//" sampler is assumed to have converged. &
     666             :                 &Typical values are around `0.1 - 1`. Avoid setting this number to extremely tiny values on the order of `1e-6` or smaller, otherwise the integration &
     667           0 :                 &result is not guaranteed to converge and the simulation might never end. The default value for `tolerance` is `"//getStr(spec%tolerance%def)//SKC_"`."
     668             :             !$omp master
     669           0 :             call setNAN(tolerance)
     670             :             !$omp end master
     671             :         end block tolerance_block
     672             : 
     673           0 :     end function
     674             : 
     675             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     676             : 
     677           0 :     function set(spec, sampler) result(err)
     678             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     679             :         !DEC$ ATTRIBUTES DLLEXPORT :: set
     680             : #endif
     681             :         use pm_err, only: err_type
     682             :         use pm_sampling, only: paranest_type
     683             :         use pm_sampling, only: sampler_type
     684             :         class(specnest_type), intent(inout) :: spec
     685             :         class(sampler_type), intent(in), optional :: sampler
     686             :         type(err_type) :: err
     687             : 
     688             :         select type(sampler)
     689             :         type is (paranest_type)
     690             : 
     691           0 :             err = spec%specbase_type%set(sampler%sampler_type)
     692           0 :             if (err%occurred) return
     693             : 
     694             :             domainPartitionAdaptationCount_block: block
     695             :                 use pm_sampling_scio, only: domainPartitionAdaptationCount
     696           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionAdaptationCount)) then
     697           0 :                     spec%domainPartitionAdaptationCount%val = sampler%domainPartitionAdaptationCount
     698             :                 else
     699           0 :                     spec%domainPartitionAdaptationCount%val = domainPartitionAdaptationCount
     700             :                 end if
     701           0 :                 if (spec%domainPartitionAdaptationCount%val == spec%domainPartitionAdaptationCount%null) spec%domainPartitionAdaptationCount%val = spec%domainPartitionAdaptationCount%def
     702             :             end block domainPartitionAdaptationCount_block
     703             : 
     704             :             domainPartitionAdaptationPeriod_block: block
     705             :                 use pm_sampling_scio, only: domainPartitionAdaptationPeriod
     706           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionAdaptationPeriod)) then
     707           0 :                     spec%domainPartitionAdaptationPeriod%val = sampler%domainPartitionAdaptationPeriod
     708             :                 else
     709           0 :                     spec%domainPartitionAdaptationPeriod%val = domainPartitionAdaptationPeriod
     710             :                 end if
     711           0 :                 if (spec%domainPartitionAdaptationPeriod%val == spec%domainPartitionAdaptationPeriod%null) spec%domainPartitionAdaptationPeriod%val = spec%domainPartitionAdaptationPeriod%def
     712             :             end block domainPartitionAdaptationPeriod_block
     713             : 
     714             :             domainPartitionBiasCorrectionEnabled_block: block
     715             :                 use pm_sampling_scio, only: domainPartitionBiasCorrectionEnabled
     716           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionBiasCorrectionEnabled)) then
     717           0 :                     spec%domainPartitionBiasCorrectionEnabled%val = sampler%domainPartitionBiasCorrectionEnabled
     718             :                 else
     719           0 :                     spec%domainPartitionBiasCorrectionEnabled%val = domainPartitionBiasCorrectionEnabled
     720             :                 end if
     721             :             end block domainPartitionBiasCorrectionEnabled_block
     722             : 
     723             :             domainPartitionCountMax_block: block
     724             :                 use pm_sampling_scio, only: domainPartitionCountMax
     725           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionCountMax)) then
     726           0 :                     spec%domainPartitionCountMax%val = sampler%domainPartitionCountMax
     727             :                 else
     728           0 :                     spec%domainPartitionCountMax%val = domainPartitionCountMax
     729             :                 end if
     730           0 :                 if (spec%domainPartitionCountMax%val == spec%domainPartitionCountMax%null) spec%domainPartitionCountMax%val = spec%domainPartitionCountMax%def
     731             :             end block domainPartitionCountMax_block
     732             : 
     733             :             domainPartitionFactorExpansion_block: block
     734             :                 use pm_sampling_scio, only: domainPartitionFactorExpansion
     735           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionFactorExpansion)) then
     736           0 :                     spec%domainPartitionFactorExpansion%val = real(sampler%domainPartitionFactorExpansion, RKC)
     737             :                 else
     738           0 :                     spec%domainPartitionFactorExpansion%val = domainPartitionFactorExpansion
     739             :                 end if
     740           0 :                 if (isNAN(spec%domainPartitionFactorExpansion%val)) spec%domainPartitionFactorExpansion%val = spec%domainPartitionFactorExpansion%def
     741             :             end block domainPartitionFactorExpansion_block
     742             : 
     743             :             domainPartitionFactorShrinkage_block: block
     744             :                 use pm_sampling_scio, only: domainPartitionFactorShrinkage
     745           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionFactorShrinkage)) then
     746           0 :                     spec%domainPartitionFactorShrinkage%val = real(sampler%domainPartitionFactorShrinkage, RKC)
     747             :                 else
     748           0 :                     spec%domainPartitionFactorShrinkage%val = domainPartitionFactorShrinkage
     749             :                 end if
     750           0 :                 if (isNAN(spec%domainPartitionFactorShrinkage%val)) spec%domainPartitionFactorShrinkage%val = spec%domainPartitionFactorShrinkage%def
     751             :             end block domainPartitionFactorShrinkage_block
     752             : 
     753             :             domainPartitionKmeansClusterCountMax_block: block
     754             :                 use pm_sampling_scio, only: domainPartitionKmeansClusterCountMax
     755           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionKmeansClusterCountMax)) then
     756           0 :                     spec%domainPartitionKmeansClusterCountMax%val = sampler%domainPartitionKmeansClusterCountMax
     757             :                 else
     758           0 :                     spec%domainPartitionKmeansClusterCountMax%val = domainPartitionKmeansClusterCountMax
     759             :                 end if
     760           0 :                 if (spec%domainPartitionKmeansClusterCountMax%val == spec%domainPartitionKmeansClusterCountMax%null) spec%domainPartitionKmeansClusterCountMax%val = spec%domainPartitionKmeansClusterCountMax%def
     761             :             end block domainPartitionKmeansClusterCountMax_block
     762             : 
     763             :             domainPartitionKmeansClusterSizeMin_block: block
     764             :                 use pm_sampling_scio, only: domainPartitionKmeansClusterSizeMin
     765           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionKmeansClusterSizeMin)) then
     766           0 :                     spec%domainPartitionKmeansClusterSizeMin%val = sampler%domainPartitionKmeansClusterSizeMin
     767             :                 else
     768           0 :                     spec%domainPartitionKmeansClusterSizeMin%val = domainPartitionKmeansClusterSizeMin
     769             :                 end if
     770           0 :                 if (spec%domainPartitionKmeansClusterSizeMin%val == spec%domainPartitionKmeansClusterSizeMin%null) spec%domainPartitionKmeansClusterSizeMin%val = spec%domainPartitionKmeansClusterSizeMin%def
     771             :             end block domainPartitionKmeansClusterSizeMin_block
     772             : 
     773             :             domainPartitionKmeansNormalizationEnabled_block: block
     774             :                 use pm_sampling_scio, only: domainPartitionKmeansNormalizationEnabled
     775           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionKmeansNormalizationEnabled)) then
     776           0 :                     spec%domainPartitionKmeansNormalizationEnabled%val = sampler%domainPartitionKmeansNormalizationEnabled
     777             :                 else
     778           0 :                     spec%domainPartitionKmeansNormalizationEnabled%val = domainPartitionKmeansNormalizationEnabled
     779             :                 end if
     780             :             end block domainPartitionKmeansNormalizationEnabled_block
     781             : 
     782             :             domainPartitionKmeansNumFailMax_block: block
     783             :                 use pm_sampling_scio, only: domainPartitionKmeansNumFailMax
     784           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionKmeansNumFailMax)) then
     785           0 :                     spec%domainPartitionKmeansNumFailMax%val = sampler%domainPartitionKmeansNumFailMax
     786             :                 else
     787           0 :                     spec%domainPartitionKmeansNumFailMax%val = domainPartitionKmeansNumFailMax
     788             :                 end if
     789           0 :                 if (spec%domainPartitionKmeansNumFailMax%val == spec%domainPartitionKmeansNumFailMax%null) spec%domainPartitionKmeansNumFailMax%val = spec%domainPartitionKmeansNumFailMax%def
     790             :             end block domainPartitionKmeansNumFailMax_block
     791             : 
     792             :             domainPartitionKmeansNumRecursionMax_block: block
     793             :                 use pm_sampling_scio, only: domainPartitionKmeansNumRecursionMax
     794           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionKmeansNumRecursionMax)) then
     795           0 :                     spec%domainPartitionKmeansNumRecursionMax%val = sampler%domainPartitionKmeansNumRecursionMax
     796             :                 else
     797           0 :                     spec%domainPartitionKmeansNumRecursionMax%val = domainPartitionKmeansNumRecursionMax
     798             :                 end if
     799           0 :                 if (spec%domainPartitionKmeansNumRecursionMax%val == spec%domainPartitionKmeansNumRecursionMax%null) spec%domainPartitionKmeansNumRecursionMax%val = spec%domainPartitionKmeansNumRecursionMax%def
     800             :             end block domainPartitionKmeansNumRecursionMax_block
     801             : 
     802             :             domainPartitionKmeansNumTry_block: block
     803             :                 use pm_sampling_scio, only: domainPartitionKmeansNumTry
     804           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionKmeansNumTry)) then
     805           0 :                     spec%domainPartitionKmeansNumTry%val = sampler%domainPartitionKmeansNumTry
     806             :                 else
     807           0 :                     spec%domainPartitionKmeansNumTry%val = domainPartitionKmeansNumTry
     808             :                 end if
     809           0 :                 if (spec%domainPartitionKmeansNumTry%val == spec%domainPartitionKmeansNumTry%null) spec%domainPartitionKmeansNumTry%val = spec%domainPartitionKmeansNumTry%def
     810             :             end block domainPartitionKmeansNumTry_block
     811             : 
     812             :             domainPartitionKvolumeNumRecursionMax_block: block
     813             :                 use pm_sampling_scio, only: domainPartitionKvolumeNumRecursionMax
     814           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionKvolumeNumRecursionMax)) then
     815           0 :                     spec%domainPartitionKvolumeNumRecursionMax%val = sampler%domainPartitionKvolumeNumRecursionMax
     816             :                 else
     817           0 :                     spec%domainPartitionKvolumeNumRecursionMax%val = domainPartitionKvolumeNumRecursionMax
     818             :                 end if
     819           0 :                 if (spec%domainPartitionKvolumeNumRecursionMax%val == spec%domainPartitionKvolumeNumRecursionMax%null) spec%domainPartitionKvolumeNumRecursionMax%val = spec%domainPartitionKvolumeNumRecursionMax%def
     820             :             end block domainPartitionKvolumeNumRecursionMax_block
     821             : 
     822             :             domainPartitionKvolumeWeightExponent_block: block
     823             :                 use pm_sampling_scio, only: domainPartitionKvolumeWeightExponent
     824           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionKvolumeWeightExponent)) then
     825           0 :                     spec%domainPartitionKvolumeWeightExponent%val = real(sampler%domainPartitionKvolumeWeightExponent, RKC)
     826             :                 else
     827           0 :                     spec%domainPartitionKvolumeWeightExponent%val = domainPartitionKvolumeWeightExponent
     828             :                 end if
     829           0 :                 if (isNAN(spec%domainPartitionKvolumeWeightExponent%val)) spec%domainPartitionKvolumeWeightExponent%val = spec%domainPartitionKvolumeWeightExponent%def
     830             :             end block domainPartitionKvolumeWeightExponent_block
     831             : 
     832             :             domainPartitionMethod_block: block
     833             :                 use pm_sampling_scio, only: domainPartitionMethod
     834           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionMethod)) then
     835           0 :                     spec%domainPartitionMethod%val = sampler%domainPartitionMethod
     836             :                 else
     837           0 :                     spec%domainPartitionMethod%val = getStrLower(trim(adjustl(domainPartitionMethod)))
     838             :                 end if
     839           0 :                 if (spec%domainPartitionMethod%val == spec%domainPartitionMethod%null) spec%domainPartitionMethod%val = getStrLower(spec%domainPartitionMethod%def)
     840           0 :                 spec%domainPartitionMethod%isMinVol = index(spec%domainPartitionMethod%val, SKC_"minvol") > 0
     841           0 :                 spec%domainPartitionMethod%isMaxDen = index(spec%domainPartitionMethod%val, SKC_"maxden") > 0
     842           0 :                 spec%domainPartitionMethod%isDynesty = index(spec%domainPartitionMethod%val, SKC_"dynesty") > 0
     843           0 :                 spec%domainPartitionMethod%isMultiNest = index(spec%domainPartitionMethod%val, SKC_"multinest") > 0
     844             :             end block domainPartitionMethod_block
     845             : 
     846             :             domainPartitionObject_block: block
     847             :                 use pm_sampling_scio, only: domainPartitionObject
     848           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionObject)) then
     849           0 :                     spec%domainPartitionObject%val = sampler%domainPartitionObject
     850             :                 else
     851           0 :                     spec%domainPartitionObject%val = getStrLower(trim(adjustl(domainPartitionObject)))
     852             :                 end if
     853           0 :                 if (spec%domainPartitionObject%val == spec%domainPartitionObject%null) spec%domainPartitionObject%val = spec%domainPartitionObject%def
     854           0 :                 spec%domainPartitionObject%isBall = index(spec%domainPartitionObject%val, SKC_"ellipsoid") > 0 .or. index(spec%domainPartitionObject%val, SKC_"ball") > 0
     855             :             end block domainPartitionObject_block
     856             : 
     857             :             domainPartitionOptimizationScaleEnabled_block: block
     858             :                 use pm_sampling_scio, only: domainPartitionOptimizationScaleEnabled
     859           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionOptimizationScaleEnabled)) then
     860           0 :                     spec%domainPartitionOptimizationScaleEnabled%val = sampler%domainPartitionOptimizationScaleEnabled
     861             :                 else
     862           0 :                     spec%domainPartitionOptimizationScaleEnabled%val = domainPartitionOptimizationScaleEnabled
     863             :                 end if
     864             :             end block domainPartitionOptimizationScaleEnabled_block
     865             : 
     866             :             domainPartitionOptimizationShapeEnabled_block: block
     867             :                 use pm_sampling_scio, only: domainPartitionOptimizationShapeEnabled
     868           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionOptimizationShapeEnabled)) then
     869           0 :                     spec%domainPartitionOptimizationShapeEnabled%val = sampler%domainPartitionOptimizationShapeEnabled
     870             :                 else
     871           0 :                     spec%domainPartitionOptimizationShapeEnabled%val = domainPartitionOptimizationShapeEnabled
     872             :                 end if
     873             :             end block domainPartitionOptimizationShapeEnabled_block
     874             : 
     875             :             domainPartitionOptimizationShapeScaleEnabled_block: block
     876             :                 use pm_sampling_scio, only: domainPartitionOptimizationShapeScaleEnabled
     877           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionOptimizationShapeScaleEnabled)) then
     878           0 :                     spec%domainPartitionOptimizationShapeScaleEnabled%val = sampler%domainPartitionOptimizationShapeScaleEnabled
     879             :                 else
     880           0 :                     spec%domainPartitionOptimizationShapeScaleEnabled%val = domainPartitionOptimizationShapeScaleEnabled
     881             :                 end if
     882             :             end block domainPartitionOptimizationShapeScaleEnabled_block
     883             : 
     884             :             domainPartitionScaleFactor_block: block
     885             :                 use pm_sampling_scio, only: domainPartitionScaleFactor
     886           0 :                 if (spec%overridable .and. allocated(sampler%domainPartitionScaleFactor)) then
     887           0 :                     spec%domainPartitionScaleFactor%val = real(sampler%domainPartitionScaleFactor, RKC)
     888             :                 else
     889           0 :                     spec%domainPartitionScaleFactor%val = domainPartitionScaleFactor
     890             :                 end if
     891           0 :                 if (isNAN(spec%domainPartitionScaleFactor%val)) spec%domainPartitionScaleFactor%val = spec%domainPartitionScaleFactor%def
     892             :             end block domainPartitionScaleFactor_block
     893             : 
     894             :             domainSampler_block: block
     895             :                 use pm_sampling_scio, only: domainSampler
     896           0 :                 if (spec%overridable .and. allocated(sampler%domainSampler)) then
     897           0 :                     spec%domainSampler%val = sampler%domainSampler
     898             :                 else
     899           0 :                     spec%domainSampler%val = getStrLower(trim(adjustl(domainSampler)))
     900             :                 end if
     901           0 :                 if (spec%domainSampler%val == spec%domainSampler%null) spec%domainSampler%val = spec%domainSampler%def
     902           0 :                 spec%domainSampler%isRejection = index(spec%domainSampler%val, SKC_"rejection") > 0
     903             :             end block domainSampler_block
     904             : 
     905             :             liveSampleSize_block: block
     906             :                 use pm_sampling_scio, only: liveSampleSize
     907           0 :                 if (spec%overridable .and. allocated(sampler%liveSampleSize)) then
     908           0 :                     spec%liveSampleSize%val = sampler%liveSampleSize
     909             :                 else
     910           0 :                     spec%liveSampleSize%val = liveSampleSize
     911             :                 end if
     912           0 :                 if (spec%liveSampleSize%val == spec%liveSampleSize%null) spec%liveSampleSize%val = spec%liveSampleSize%def
     913             :             end block liveSampleSize_block
     914             : 
     915             :             tolerance_block: block
     916             :                 use pm_sampling_scio, only: tolerance
     917           0 :                 if (spec%overridable .and. allocated(sampler%tolerance)) then
     918           0 :                     spec%tolerance%val = real(sampler%tolerance, RKC)
     919             :                 else
     920           0 :                     spec%tolerance%val = tolerance
     921             :                 end if
     922           0 :                 if (isNAN(spec%tolerance%val)) spec%tolerance%val = spec%tolerance%def
     923             :             end block tolerance_block
     924             : 
     925             :             !$omp barrier
     926             : 
     927             :             ! Now resolve the conflicts.
     928             : 
     929           0 :             spec%domainPartitionKmeansClusterCountMax%val = min(spec%domainPartitionKmeansClusterCountMax%def, spec%domainPartitionCountMax%val)
     930             : 
     931             :             ! open output files, report and sanitize.
     932             : 
     933           0 :             if (spec%image%is%leader) call spec%report() ! if (spec%run%is%new)
     934           0 :             call spec%sanitize(err)
     935             : 
     936             :         class default
     937             :             error stop "The input `sampler` must be of type `paranest_type`." ! LCOV_EXCL_LINE
     938             :         end select
     939             : 
     940           0 :     end function set
     941             : 
     942             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     943             : 
     944           0 :     subroutine report(spec)
     945             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
     946             :         !DEC$ ATTRIBUTES DLLEXPORT :: report
     947             : #endif
     948             :         class(specnest_type), intent(inout) :: spec
     949             : 
     950           0 :         call spec%disp%text%wrap(NL1//spec%method%val//SKC_" simulation Nest specifications"//NL1)
     951             : 
     952             :         associate(ndim => spec%ndim%val, format => spec%reportFile%format%generic)
     953             : 
     954           0 :             call spec%disp%show("domainPartitionAdaptationCount")
     955           0 :             call spec%disp%show(spec%domainPartitionAdaptationCount%val, format = format)
     956           0 :             call spec%disp%note%show(spec%domainPartitionAdaptationCount%desc)
     957             : 
     958           0 :             call spec%disp%show("domainPartitionAdaptationPeriod")
     959           0 :             call spec%disp%show(spec%domainPartitionAdaptationPeriod%val, format = format)
     960           0 :             call spec%disp%note%show(spec%domainPartitionAdaptationPeriod%desc)
     961             : 
     962           0 :             call spec%disp%show("domainPartitionBiasCorrectionEnabled")
     963           0 :             call spec%disp%show(spec%domainPartitionBiasCorrectionEnabled%val, format = format)
     964           0 :             call spec%disp%note%show(spec%domainPartitionBiasCorrectionEnabled%desc)
     965             : 
     966           0 :             call spec%disp%show("domainPartitionCountMax")
     967           0 :             call spec%disp%show(spec%domainPartitionCountMax%val, format = format)
     968           0 :             call spec%disp%note%show(spec%domainPartitionCountMax%desc)
     969             : 
     970           0 :             call spec%disp%show("domainPartitionFactorExpansion")
     971           0 :             call spec%disp%show(spec%domainPartitionFactorExpansion%val, format = format)
     972           0 :             call spec%disp%note%show(spec%domainPartitionFactorExpansion%desc)
     973             : 
     974           0 :             call spec%disp%show("domainPartitionFactorShrinkage")
     975           0 :             call spec%disp%show(spec%domainPartitionFactorShrinkage%val, format = format)
     976           0 :             call spec%disp%note%show(spec%domainPartitionFactorShrinkage%desc)
     977             : 
     978           0 :             call spec%disp%show("domainPartitionKmeansClusterCountMax")
     979           0 :             call spec%disp%show(spec%domainPartitionKmeansClusterCountMax%val, format = format)
     980           0 :             call spec%disp%note%show(spec%domainPartitionKmeansClusterCountMax%desc)
     981             : 
     982           0 :             call spec%disp%show("domainPartitionKmeansClusterSizeMin")
     983           0 :             call spec%disp%show(spec%domainPartitionKmeansClusterSizeMin%val, format = format)
     984           0 :             call spec%disp%note%show(spec%domainPartitionKmeansClusterSizeMin%desc)
     985             : 
     986           0 :             call spec%disp%show("domainPartitionKmeansNormalizationEnabled")
     987           0 :             call spec%disp%show(spec%domainPartitionKmeansNormalizationEnabled%val, format = format)
     988           0 :             call spec%disp%note%show(spec%domainPartitionKmeansNormalizationEnabled%desc)
     989             : 
     990           0 :             call spec%disp%show("domainPartitionKmeansNumFailMax")
     991           0 :             call spec%disp%show(spec%domainPartitionKmeansNumFailMax%val, format = format)
     992           0 :             call spec%disp%note%show(spec%domainPartitionKmeansNumFailMax%desc)
     993             : 
     994           0 :             call spec%disp%show("domainPartitionKmeansNumRecursionMax")
     995           0 :             call spec%disp%show(spec%domainPartitionKmeansNumRecursionMax%val, format = format)
     996           0 :             call spec%disp%note%show(spec%domainPartitionKmeansNumRecursionMax%desc)
     997             : 
     998           0 :             call spec%disp%show("domainPartitionKmeansNumTry")
     999           0 :             call spec%disp%show(spec%domainPartitionKmeansNumTry%val, format = format)
    1000           0 :             call spec%disp%note%show(spec%domainPartitionKmeansNumTry%desc)
    1001             : 
    1002           0 :             call spec%disp%show("domainPartitionKvolumeNumRecursionMax")
    1003           0 :             call spec%disp%show(spec%domainPartitionKvolumeNumRecursionMax%val, format = format)
    1004           0 :             call spec%disp%note%show(spec%domainPartitionKvolumeNumRecursionMax%desc)
    1005             : 
    1006           0 :             call spec%disp%show("domainPartitionKvolumeWeightExponent")
    1007           0 :             call spec%disp%show(spec%domainPartitionKvolumeWeightExponent%val, format = format)
    1008           0 :             call spec%disp%note%show(spec%domainPartitionKvolumeWeightExponent%desc)
    1009             : 
    1010           0 :             call spec%disp%show("domainPartitionMethod")
    1011           0 :             call spec%disp%show(spec%domainPartitionMethod%val, format = format)
    1012           0 :             call spec%disp%note%show(spec%domainPartitionMethod%desc)
    1013             : 
    1014           0 :             call spec%disp%show("domainPartitionObject")
    1015           0 :             call spec%disp%show(spec%domainPartitionObject%val, format = format)
    1016           0 :             call spec%disp%note%show(spec%domainPartitionObject%desc)
    1017             : 
    1018           0 :             call spec%disp%show("domainPartitionOptimizationScaleEnabled")
    1019           0 :             call spec%disp%show(spec%domainPartitionOptimizationScaleEnabled%val, format = format)
    1020           0 :             call spec%disp%note%show(spec%domainPartitionOptimizationScaleEnabled%desc)
    1021             : 
    1022           0 :             call spec%disp%show("domainPartitionOptimizationShapeEnabled")
    1023           0 :             call spec%disp%show(spec%domainPartitionOptimizationShapeEnabled%val, format = format)
    1024           0 :             call spec%disp%note%show(spec%domainPartitionOptimizationShapeEnabled%desc)
    1025             : 
    1026           0 :             call spec%disp%show("domainPartitionOptimizationShapeScaleEnabled")
    1027           0 :             call spec%disp%show(spec%domainPartitionOptimizationShapeScaleEnabled%val, format = format)
    1028           0 :             call spec%disp%note%show(spec%domainPartitionOptimizationShapeScaleEnabled%desc)
    1029             : 
    1030           0 :             call spec%disp%show("domainPartitionScaleFactor")
    1031           0 :             call spec%disp%show(spec%domainPartitionScaleFactor%val, format = format)
    1032           0 :             call spec%disp%note%show(spec%domainPartitionScaleFactor%desc)
    1033             : 
    1034           0 :             call spec%disp%show("domainSampler")
    1035           0 :             call spec%disp%show(spec%domainSampler%val, format = format)
    1036           0 :             call spec%disp%note%show(spec%domainSampler%desc)
    1037             : 
    1038           0 :             call spec%disp%show("liveSampleSize")
    1039           0 :             call spec%disp%show(spec%liveSampleSize%val, format = format)
    1040           0 :             call spec%disp%note%show(spec%liveSampleSize%desc)
    1041             : 
    1042           0 :             call spec%disp%show("tolerance")
    1043           0 :             call spec%disp%show(spec%tolerance%val, format = format)
    1044           0 :             call spec%disp%note%show(spec%tolerance%desc)
    1045             : 
    1046             :         end associate
    1047             : 
    1048           0 :     end subroutine
    1049             : 
    1050             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1051             : 
    1052           0 :     subroutine sanitize(spec, err)
    1053             : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
    1054             :         !DEC$ ATTRIBUTES DLLEXPORT :: sanitize
    1055             : #endif
    1056             :         use pm_err, only: err_type, getFine
    1057             :         type(err_type), intent(inout) :: err
    1058             :         class(specnest_type), intent(inout) :: spec
    1059             :         character(*,SKC), parameter :: PROCEDURE_NAME = MODULE_NAME//SKC_"@sanitize()"
    1060             : 
    1061           0 :         call spec%disp%text%wrap(NL1//spec%method%val//SKC_".simulation.specifications.nest"//NL1)
    1062             : 
    1063             :         domainPartitionAdaptationCount_block: block
    1064           0 :             if (spec%domainPartitionAdaptationCount%val < 0_IK) then
    1065           0 :                 err%occurred = .true._LK
    1066             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1067             :                             &The specified value for `domainPartitionAdaptationCount` ("//getStr(spec%domainPartitionAdaptationCount%val)//SKC_") cannot be negative. &
    1068             :                             &If you are unsure of the appropriate value for `domainPartitionAdaptationCount`, drop it from the input list. The "//&
    1069           0 :                             spec%method%val//SKC_" sampler will automatically assign an appropriate value to it."
    1070             :             end if
    1071             :         end block domainPartitionAdaptationCount_block
    1072             : 
    1073             :         domainPartitionAdaptationPeriod_block: block
    1074           0 :             if (spec%domainPartitionAdaptationPeriod%val<1_IK) then
    1075           0 :                 err%occurred = .true._LK
    1076             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1077             :                             &Invalid requested value for `domainPartitionAdaptationPeriod`. &
    1078             :                             &The specified value for `domainPartitionAdaptationPeriod` ("//getStr(spec%domainPartitionAdaptationPeriod%val)//SKC_") cannot be less than 1. &
    1079             :                             &If you are unsure of the appropriate value for `domainPartitionAdaptationPeriod`, drop it from the input list. The "//&
    1080           0 :                             spec%method%val//SKC_" sample will automatically assign an appropriate value to it."
    1081             :             end if
    1082             :         end block domainPartitionAdaptationPeriod_block
    1083             : 
    1084             :         domainPartitionBiasCorrectionEnabled_block: block
    1085             :         end block domainPartitionBiasCorrectionEnabled_block
    1086             : 
    1087             :         domainPartitionCountMax_block: block
    1088           0 :             if (spec%domainPartitionCountMax%val < 1_IK) then
    1089           0 :                 err%occurred = .true._LK
    1090             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1091             :                             &The specified value for `domainPartitionCountMax` ("//getStr(spec%domainPartitionCountMax%val)//SKC_") &
    1092             :                             &cannot be less than `1` or larger than `liveSampleSize / (ndim + 1)`, where `ndim` is the number of dimensions of &
    1093             :                             &the domain of the objective function. If you are unsure of the appropriate value for `domainPartitionCountMax`, drop it &
    1094           0 :                             &from the input list. The "//spec%method%val//SKC_" sampler will automatically assign an appropriate value to it."
    1095             :             end if
    1096             :         end block domainPartitionCountMax_block
    1097             : 
    1098             :         domainPartitionFactorExpansion_block: block
    1099           0 :             if (spec%domainPartitionFactorExpansion%val <= 0._RKC) then
    1100           0 :                 err%occurred = .true._LK
    1101             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1102             :                             &The input variable `domainPartitionFactorExpansion` ("//getStr(spec%domainPartitionFactorExpansion%val)//") must be positive. &
    1103             :                             &If you are unsure of the appropriate value for `domainPartitionFactorExpansion`, drop it from the input list. &
    1104           0 :                             &The "//spec%method%val//SKC_" sampler will automatically assign an appropriate value to it."
    1105             :             end if
    1106             :         end block domainPartitionFactorExpansion_block
    1107             : 
    1108             :         domainPartitionFactorShrinkage_block: block
    1109           0 :             if (spec%domainPartitionFactorShrinkage%val <= 0._RKC) then
    1110           0 :                 err%occurred = .true._LK
    1111             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1112             :                             &The input variable `domainPartitionFactorShrinkage` ("//getStr(spec%domainPartitionFactorShrinkage%val)//SKC_") must be positive. &
    1113             :                             &If you are unsure of the appropriate value for `domainPartitionFactorExpansion`, drop it from the input list. &
    1114           0 :                             &The "//spec%method%val//SKC_" sampler will automatically assign an appropriate value to it."
    1115             :             end if
    1116             :         end block domainPartitionFactorShrinkage_block
    1117             : 
    1118             :         domainPartitionKmeansClusterCountMax_block: block
    1119           0 :             if (spec%domainPartitionKmeansClusterCountMax%val < 1_IK .or. spec%domainPartitionCountMax%val < spec%domainPartitionKmeansClusterCountMax%val) then
    1120           0 :                 err%occurred = .true._LK
    1121             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1122             :                             &The specified value for `domainPartitionKmeansClusterCountMax` ("//getStr(spec%domainPartitionKmeansClusterCountMax%val)//SKC_") &
    1123             :                             &can not be less than `1` or larger than the value of `domainPartitionCountMax` ("//getStr(spec%domainPartitionCountMax%val)//SKC_"). &
    1124             :                             &If you are unsure about the appropriate value for domainPartitionKmeansClusterCountMax, drop it from the input list. &
    1125           0 :                             &The "//spec%method%val//SKC_" sampler will automatically assign an appropriate value to it."
    1126             :             end if
    1127             :         end block domainPartitionKmeansClusterCountMax_block
    1128             : 
    1129             :         domainPartitionKmeansClusterSizeMin_block: block
    1130           0 :             if (spec%domainPartitionKmeansClusterSizeMin%val < 0_IK) then
    1131           0 :                 err%occurred = .true._LK
    1132             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1133             :                             &The specified value for `domainPartitionKmeansClusterSizeMin` ("//getStr(spec%domainPartitionKmeansClusterSizeMin%val)//SKC_") &
    1134             :                             &cannot be less than 0 or larger than liveSampleSize. If you are unsure of the appropriate value for &
    1135             :                             &`domainPartitionKmeansClusterSizeMin`, drop it from the input list. The "//spec%method%val//SKC_" &
    1136           0 :                             &sampler will automatically assign an appropriate value to it."
    1137             :             end if
    1138             :         end block domainPartitionKmeansClusterSizeMin_block
    1139             : 
    1140             :         domainPartitionKmeansNormalizationEnabled_block: block
    1141             :         end block domainPartitionKmeansNormalizationEnabled_block
    1142             : 
    1143             :         domainPartitionKmeansNumFailMax_block: block
    1144           0 :             if (spec%domainPartitionKmeansNumFailMax%val < 0_IK) then
    1145           0 :                 err%occurred = .true._LK
    1146             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1147             :                             &The specified value for `domainPartitionKmeansNumFailMax` ("//getStr(spec%domainPartitionKmeansNumFailMax%val)//SKC_") &
    1148             :                             &cannot be negative. If you are unsure of the appropriate value for `domainPartitionKmeansNumFailMax`, drop it &
    1149           0 :                             &from the input list. "//spec%method%val//SKC_" will automatically assign an appropriate value to it."
    1150             :             end if
    1151             :         end block domainPartitionKmeansNumFailMax_block
    1152             : 
    1153             :         domainPartitionKmeansNumRecursionMax_block: block
    1154           0 :             if (spec%domainPartitionKmeansNumRecursionMax%val < 0_IK) then
    1155           0 :                 err%occurred = .true._LK
    1156             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1157             :                             &The specified value for `domainPartitionKmeansNumRecursionMax` ("//getStr(spec%domainPartitionKmeansNumRecursionMax%val)//SKC_") &
    1158             :                             &cannot be negative. If you are unsure of the appropriate value for `domainPartitionKmeansNumRecursionMax`, drop it &
    1159           0 :                             &from the input list. "//spec%method%val//SKC_" will automatically assign an appropriate value to it."
    1160             :             end if
    1161             :         end block domainPartitionKmeansNumRecursionMax_block
    1162             : 
    1163             :         domainPartitionKmeansNumTry_block: block
    1164           0 :             if (spec%domainPartitionKmeansNumTry%val < 1_IK) then
    1165           0 :                 err%occurred = .true._LK
    1166             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1167             :                             &The specified value for `domainPartitionKmeansNumTry` ("//getStr(spec%domainPartitionKmeansNumTry%val)//SKC_") &
    1168             :                             &can not be less than 1. If you are unsure about the appropriate value for `domainPartitionKmeansNumTry`, drop it &
    1169           0 :                             &from the input list. The "//spec%method%val//SKC_" sampler will automatically assign an appropriate value to it."
    1170             :             end if
    1171             :         end block domainPartitionKmeansNumTry_block
    1172             : 
    1173             :         domainPartitionKvolumeNumRecursionMax_block: block
    1174           0 :             if (spec%domainPartitionKvolumeNumRecursionMax%val < 0_IK) then
    1175           0 :                 err%occurred = .true._LK
    1176             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1177             :                             &The specified value for domainPartitionKvolumeNumRecursionMax ("//getStr(spec%domainPartitionKvolumeNumRecursionMax%val)//SKC_") &
    1178             :                             &cannot be negative. If you are unsure of the appropriate value for domainPartitionKvolumeNumRecursionMax, drop it &
    1179           0 :                             &from the input list. "//spec%method%val//SKC_" will automatically assign an appropriate value to it."
    1180             :             end if
    1181             :         end block domainPartitionKvolumeNumRecursionMax_block
    1182             : 
    1183             :         domainPartitionKvolumeWeightExponent_block: block
    1184             :             !if (spec%domainPartitionKvolumeWeightExponent%val <= 0._RKC) then
    1185             :             !    err%occurred = .true._LK
    1186             :             !    err%msg =   err%msg//NL2//&
    1187             :             !                PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1188             :             !                &The input variable `domainPartitionKvolumeWeightExponent` ("//getStr(spec%domainPartitionKvolumeWeightExponent%val)//&
    1189             :             !                ") cannot be less than 0. If you are unsure of the appropriate value for `domainPartitionKvolumeWeightExponent`, drop it &
    1190             :             !                &from the input list. "//spec%method%val//SKC_" will automatically assign an appropriate value to it."
    1191             :             !end if
    1192             :         end block domainPartitionKvolumeWeightExponent_block
    1193             : 
    1194             :         domainPartitionMethod_block: block
    1195             :             if (count(  [ spec%domainPartitionMethod%isMinVol & ! LCOV_EXCL_LINE
    1196             :                         , spec%domainPartitionMethod%isMaxDen & ! LCOV_EXCL_LINE
    1197             :                         , spec%domainPartitionMethod%isDynesty & ! LCOV_EXCL_LINE
    1198             :                         , spec%domainPartitionMethod%isMultiNest & ! LCOV_EXCL_LINE
    1199             :                         ]) /= 1_IK) then
    1200           0 :                 err%occurred = .true._LK
    1201             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1202             :                             &The specified value for `domainPartitionMethod` ("//spec%domainPartitionMethod%val//SKC_") is not supported. &
    1203             :                             &The variable `domainPartitionMethod` cannot be set to anything other than the possible values described &
    1204             :                             &in the description of the simulation specification `domainPartitionMethod`. &
    1205           0 :                             &Please specify only one partitioning method."
    1206             :             end if
    1207             :         end block domainPartitionMethod_block
    1208             : 
    1209             :         domainPartitionObject_block: block
    1210           0 :             if  (.not. spec%domainPartitionObject%isBall) then
    1211           0 :                 err%occurred = .true._LK
    1212             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1213             :                             &The specified value for the `domainPartitionObject` ("//spec%domainPartitionObject%val//SKC_") is not supported. &
    1214             :                             &The variable `domainPartitionObject` cannot be set to anything other than the possible values described &
    1215             :                             &in the description of the simulation specification `domainPartitionObject`. &
    1216           0 :                             &Please specify only one partitioning object."
    1217             :             end if
    1218             :         end block domainPartitionObject_block
    1219             : 
    1220             :         domainPartitionOptimizationScaleEnabled_block: block
    1221             :         end block domainPartitionOptimizationScaleEnabled_block
    1222             : 
    1223             :         domainPartitionOptimizationShapeEnabled_block: block
    1224             :         end block domainPartitionOptimizationShapeEnabled_block
    1225             : 
    1226             :         domainPartitionOptimizationShapeScaleEnabled_block: block
    1227             :         end block domainPartitionOptimizationShapeScaleEnabled_block
    1228             : 
    1229             :         domainPartitionScaleFactor_block: block
    1230           0 :             if (spec%domainPartitionScaleFactor%val <= 0._RKC) then
    1231           0 :                 err%occurred = .true._LK
    1232             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1233             :                             &The specified value for `domainPartitionScaleFactor` ("//getStr(spec%domainPartitionScaleFactor%val)//SKC_") cannot be less than 0. &
    1234             :                             &If you are unsure of the appropriate value for `domainPartitionScaleFactor`, drop it from the input list. &
    1235           0 :                             &The "//spec%method%val//SKC_" sampler will automatically assign an appropriate value to it."
    1236             :             end if
    1237             :         end block domainPartitionScaleFactor_block
    1238             : 
    1239             :         domainSampler_block: block
    1240           0 :             if (.not. spec%domainSampler%isRejection) then
    1241           0 :                 err%occurred = .true._LK
    1242             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1243             :                             &The specified value for `domainSampler` ("//spec%domainSampler%val//SKC_") is unsupported. &
    1244             :                             &The specification `domainSampler` cannot be set to anything other than the values described &
    1245           0 :                             &in the description of the simulation specification `domainSampler`."
    1246             :             end if
    1247             :         end block domainSampler_block
    1248             : 
    1249             :         liveSampleSize_block: block
    1250           0 :             if (spec%liveSampleSize%val < spec%ndim%val + 1_IK) then
    1251           0 :                 err%occurred = .true._LK
    1252             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1253             :                             &The specified value for liveSampleSize ("//getStr(spec%liveSampleSize%val)//SKC_") &
    1254             :                             &cannot be less than or equal to the number of dimensions of the domain of the objective function. &
    1255             :                             &If you are unsure of the appropriate value for liveSampleSize, drop it from the input list&. &
    1256           0 :                             &The "//spec%method%val//SKC_" sampler will automatically assign an appropriate value to it."
    1257             :             else
    1258           0 :                 spec%liveSampleSize%log = log(real(spec%liveSampleSize%val, RKC))
    1259             :             end if
    1260             :         end block liveSampleSize_block
    1261             : 
    1262             :         tolerance_block: block
    1263           0 :             if (spec%tolerance%val <= 0._RKC) then
    1264           0 :                 err%occurred = .true._LK
    1265             :                 err%msg =   err%msg//NL2//PROCEDURE_NAME//getFine(__FILE__, __LINE__)//SKC_": Error occurred. &
    1266             :                             &The specified value for `tolerance` ("//getStr(spec%tolerance%val)//SKC_") must be positive. &
    1267             :                             &If you are unsure of the appropriate value for tolerance, drop it from the input list. &
    1268           0 :                             &The "//spec%method%val//SKC_" will automatically assign an appropriate value to it."
    1269             :             end if
    1270             :         end block tolerance_block
    1271             : 
    1272           0 :     end subroutine
    1273             : 
    1274             :     !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ParaMonte: Parallel Monte Carlo and Machine Learning Library 
The Computational Data Science Lab
© Copyright 2012 - 2024