Module vom_sce_mod
497 :
498 : ! ******************************************************************
499 : ! * Module defining parameters and variables for
500 : ! * SHUFFLED COMPLEX EVOLUTION (sce)
501 : ! * Parameter optimisation algorithm based on a paper by Duan et al.
502 : ! * (1993, J. Opt. Theory and Appl., 76, 501--521).
503 : ! ******************************************************************
504 :
505 : module vom_sce_mod
506 : use vom_file_mod
507 : implicit none
508 :
509 : INTEGER :: n_thread ! Number of threads to be used
510 :
511 : INTEGER :: success ! Indicator wheter optimisation ended successfully
512 :
513 : INTEGER :: ncomp2 ! Number of complexes
514 : INTEGER :: nopt ! Number of optimised parameters
515 : INTEGER :: mopt ! Minimum number of runs per complex
516 : INTEGER :: sopt ! SCE variable s
517 : INTEGER :: qopt ! SCE variable q
518 : INTEGER :: nrun ! Number of runs performed so far
519 : INTEGER :: nloop ! Number of loops performed so far
520 : INTEGER :: nsincebest ! Number of runs since last improvement in objective function
521 :
522 : INTEGER, ALLOCATABLE :: optid(:) ! Pointer to optimisable parameters
523 :
524 : REAL*8 :: ranscal ! Scalar random number
525 : REAL*8 :: worstbest ! Best OF of the worst complex in worstbest for assessment of gene pool mixing
526 : REAL*8 :: bestobj ! Best OF value
527 : REAL*8 :: bestincomp ! Best OF value in complex
528 :
529 : REAL*8, ALLOCATABLE :: wgt(:) ! Probability weights for each optimisable parameter
530 : REAL*8, ALLOCATABLE :: cv_(:) ! Coefficient of variation for each optimisable parameter in last loop
531 : REAL*8, ALLOCATABLE :: ranarr(:) ! Array of random numbers
532 : !REAL*8, ALLOCATABLE :: ranarr_simplex(:) ! Array of random numbers
533 :
534 : REAL*8, ALLOCATABLE :: shufflevar(:,:) ! Population of parameter sets
535 : REAL*8, ALLOCATABLE :: ofvec(:) ! Population of objective function values related to shufflevar
536 :
537 : CHARACTER(12) :: evolution ! Character string explaining how parameter set was generated
538 : CHARACTER(60) :: outformat, loopformat
539 :
540 : ! * allocated variables for sce()
541 : REAL*8, ALLOCATABLE :: sumvar(:)
542 :
543 : ! * allocated variables for initialseed()
544 : INTEGER, ALLOCATABLE :: posarray(:,:)
545 : REAL*8, ALLOCATABLE :: initpop(:,:)
546 :
547 : ! * allocated variables for optsensitivity()
548 : REAL*8, ALLOCATABLE :: dataarray(:,:) ! Parameter sets and objective functions used for sensitivity analysis
549 : REAL*8, ALLOCATABLE :: shufflevar2(:) ! Parameter sets used for sensitivity analysis
550 :
551 : ! * allocated variables for cce()
552 : !INTEGER, ALLOCATABLE :: parentsid(:) ! Pointer to optimisable parameters
553 : !REAL*8, ALLOCATABLE :: objfunsub(:) ! Subset of objective function values for members of population
554 : !REAL*8, ALLOCATABLE :: invarsub(:,:) ! Subset of parameter sets for members of population
555 : !LOGICAL, ALLOCATABLE :: selected(:)
556 :
557 : ! * allocated variables for simplex()
558 : ! REAL*8, ALLOCATABLE :: centroid(:) ! Centroid of parameter sets for simplex procedure
559 : ! REAL*8, ALLOCATABLE :: newpoint(:) ! New parameter set resulting from simplex procedure
560 :
561 : INTEGER, parameter :: nparmax = 16
562 :
563 : ! ************************************
564 : ! * namelist parameters for shufflepar
565 : ! ************************************
566 :
567 : INTEGER :: vom_command ! Indicator of optimisation mode (0 for -optimise, 1 for -continue, 2 for compute, 3 for compute ncp only with pars.txt, 4 for optimise without random_seed)
568 :
569 : INTEGER :: i_ncomp_ ! Initial number of complexes
570 : INTEGER :: i_ncompmin ! Minimum number of complexes
571 : REAL*8 :: i_resolution ! Convergence criterion (fraction of max variation when optimisation stops)
572 : INTEGER :: i_patience ! Number of runs without improvement until optimisation is aborted
573 : INTEGER :: i_nsimp ! Number of simplex runs per complex
574 : REAL*8 :: i_focus ! Spread of the random seed around the initial values (if <1, then limited)
575 : INTEGER :: i_iter ! Maximum iterations in case of random runs
576 : INTEGER :: vom_npar ! Number of model parameters carried through
577 : LOGICAL :: sce_restart ! Restarting SCE or starting from scratch
578 : REAL*8 :: runtime_limit ! Maximum runtime for sce; 1day (= 1440 minutes)
579 :
580 : ! ************************************
581 : ! * namelist parameters for shufflevar
582 : ! ************************************
583 :
584 : CHARACTER(9), ALLOCATABLE :: parname(:) ! Parameter names
585 : REAL*8, ALLOCATABLE :: parval(:) ! Initial parameter values read from shuffle.par
586 : REAL*8, ALLOCATABLE :: parmin(:) ! Minimum parameter values defining search domain
587 : REAL*8, ALLOCATABLE :: parmax(:) ! Maximum parameter values defining search domain
588 : INTEGER, ALLOCATABLE :: paropt(:)
589 :
590 :
591 : LOGICAL :: vd_d_out !flag for ouput file vd_d
592 : LOGICAL :: esoil_out !flag for ouput file esoil
593 : LOGICAL :: jmax25t_out!flag for ouput file jmax25t
594 : LOGICAL :: jmax25g_out!flag for ouput file jmax25g
595 : LOGICAL :: vegcov_out !flag for ouput file vegcov
596 : LOGICAL :: resp_out !flag for ouput file resp_out
597 : LOGICAL :: lambdat_out!flag for ouput file lambdat
598 : LOGICAL :: lambdag_out!flag for ouput file lambdag
599 : LOGICAL :: rrt_out !flag for ouput file rrt
600 : LOGICAL :: rrg_out !flag for ouput file rrg
601 : LOGICAL :: asst_out !flag for ouput file asst
602 : LOGICAL :: assg_out !flag for ouput file assg
603 : LOGICAL :: su_av_out !flag for ouput file su_av
604 : LOGICAL :: zw_out !flag for ouput file zw
605 : LOGICAL :: wsnew_out !flag for ouput file wsnew
606 : LOGICAL :: spgfcf_out !flag for ouput file spgfcf
607 : LOGICAL :: infx_out !flag for ouput file infx
608 : LOGICAL :: etmt_out !flag for ouput file etmt
609 : LOGICAL :: etmg_out !flag for ouput file etmg
610 : LOGICAL :: su1_out !flag for ouput file su1
611 : LOGICAL :: topt_out !flag for ouput file topt
612 :
613 : !$OMP threadprivate(ranscal, bestobj, bestincomp, evolution)
614 :
615 :
616 : end module vom_sce_mod