Module sce_mod
341 :
342 :
343 : module sce_mod
344 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
345 : !
346 : ! Module defining parameters and variables for
347 : ! SHUFFLED COMPLEX EVOLUTION
348 : ! Parameter optimisation algorithm based on a paper by Duan et al. (1993,
349 : ! J. Opt. Theory and Appl., 76, 501--521).
350 : !
351 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
352 :
353 : INTEGER :: success = 0 ! Indicator wheter optimisation ended successfully
354 : INTEGER :: npar ! Number of model parameters carried through
355 : INTEGER :: ncomp ! Initial number of complexes
356 : INTEGER :: ncompmin ! Minimum number of complexes
357 : INTEGER :: ncomp2 ! Number of complexes
358 : INTEGER :: nopt ! Number of optimised parameters
359 : INTEGER :: mopt ! Minimum number of runs per complex
360 : INTEGER :: sopt ! SCE variable s
361 : INTEGER :: qopt ! SCE variable q
362 : INTEGER :: alpha ! Number of simplex runs per complex
363 : INTEGER :: nrun ! Number of runs performed so far
364 : INTEGER :: nloop ! Number of loops performed so far
365 : INTEGER :: nsincebest ! Number of runs since last improvement in objective function
366 : INTEGER :: patience ! Number of runs without improvement until optimisation is aborted
367 : INTEGER :: 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)
368 :
369 : INTEGER, ALLOCATABLE :: optid(:) ! Pointer to optimisable parameters
370 :
371 : REAL*8 :: ranscal ! Scalar random number
372 : REAL*8 :: focus ! Spread of the random seed around the initial values (if <1, then limited)
373 : REAL*8 :: worstbest ! Best OF of the worst complex in worstbest for assessment of gene pool mixing
374 : REAL*8 :: bestobj ! Best OF value
375 : REAL*8 :: bestincomp ! Best OF value in complex
376 : REAL*8 :: resolution ! Convergence criterion (fraction of max variation when optimisation stops)
377 :
378 : REAL*8, ALLOCATABLE :: wgt(:) ! Probability weights for each optimisable parameter
379 : REAL*8, ALLOCATABLE :: cv_(:) ! Coefficient of variation for each optimisable parameter in last loop
380 : REAL*8, ALLOCATABLE :: ranarr(:) ! Array of random numbers
381 :
382 : REAL*8, ALLOCATABLE :: shufflevar(:,:) ! Population of parameter sets
383 : REAL*8, ALLOCATABLE :: parval(:) ! Initial parameter values read from shuffle.par
384 : REAL*8, ALLOCATABLE :: parmin(:) ! Minimum parameter values defining search domain
385 : REAL*8, ALLOCATABLE :: parmax(:) ! Maximum parameter values defining search domain
386 : REAL*8, ALLOCATABLE :: ofvec(:) ! Population of objective function values related to shufflevar
387 :
388 : CHARACTER(9), ALLOCATABLE :: parname(:) ! Parameter names
389 : CHARACTER(12) :: evolution ! Character string explaining how parameter set was generated
390 : CHARACTER(60) :: outformat, loopformat
391 :
392 : ! * allocated variables for optsensitivity()
393 : REAL*8, ALLOCATABLE :: dataarray(:,:) ! Parameter sets and objective functions used for sensitivity analysis
394 : REAL*8, ALLOCATABLE :: shufflevar2(:) ! Parameter sets used for sensitivity analysis
395 :
396 : ! * allocated variables for cce()
397 : INTEGER, ALLOCATABLE :: parentsid(:) ! Pointer to optimisable parameters
398 : REAL*8, ALLOCATABLE :: objfunsub(:) ! Subset of objective function values for members of population
399 : REAL*8, ALLOCATABLE :: invarsub(:,:) ! Subset of parameter sets for members of population
400 : LOGICAL, ALLOCATABLE :: selected(:)
401 :
402 : ! * allocated variables for simplex()
403 : REAL*8, ALLOCATABLE :: centroid(:) ! Centroid of parameter sets for simplex procedure
404 : REAL*8, ALLOCATABLE :: newpoint(:) ! New parameter set resulting from simplex procedure
405 :
406 : ! * file codes
407 :
408 : INTEGER :: kfile_sceout = 701
409 : INTEGER :: kfile_shufflepar = 702
410 : INTEGER :: kfile_progress = 703
411 : INTEGER :: kfile_lastloop = 704
412 : INTEGER :: kfile_currentbest = 705
413 : INTEGER :: kfile_bestpars = 706
414 : INTEGER :: kfile_finalbest = 707
415 :
416 : ! * file names
417 :
418 : CHARACTER(80) :: sfile_sceout = 'sce.out'
419 : CHARACTER(80) :: sfile_shufflepar = 'shuffle.par'
420 : CHARACTER(80) :: sfile_progress = 'progress.txt'
421 : CHARACTER(80) :: sfile_lastloop = 'lastloop.txt'
422 : CHARACTER(80) :: sfile_currentbest = 'currentbest.txt'
423 : CHARACTER(80) :: sfile_bestpars = 'bestpars.txt'
424 : CHARACTER(80) :: sfile_finalbest = 'finalbest.txt'
425 :
426 : end module sce_mod