cmaes_out_mod.f90 5.31 KB
Newer Older
ofgeorg's avatar
ofgeorg committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
 	  !-------------------------------------------------------------------------
      !  Module       :                   cmaes_out_mod
      !-------------------------------------------------------------------------
      !
      !  Purpose      : This module contains routines and variables
      !					for CMA output
      !                
      !  Remarks      : 
      !
      !  References   :
      !
      !  Revisions    :
      !-------------------------------------------------------------------------
      !-------------------------------------------------------------------------
15
      !  pCMALib: a parallel fortran 90 library for the evolution strategy with
ofgeorg's avatar
ofgeorg committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
      !           covariance matrix adaptation
      !  Christian L. Mueller, Benedikt Baumgartner, Georg Ofenbeck
      !  MOSAIC group, ETH Zurich, Switzerland
      !-------------------------------------------------------------------------
	  MODULE cmaes_out_mod
	  USE cmaes_param_mod
	  IMPLICIT NONE
	  SAVE
	  
	    !-----------------------------------------------------------------------
      	!  bestever solution struct (accessed via solution struct)
      	!-----------------------------------------------------------------------	
		TYPE best
			REAL(MK),ALLOCATABLE,DIMENSION(:)	:: x
			REAL(MK)							:: f
			INTEGER								:: evals
		END TYPE best
		
		!-----------------------------------------------------------------------
      	!  Mean struct (accessed via history struct)
      	!-----------------------------------------------------------------------	
		TYPE mean
			REAL(MK),ALLOCATABLE,DIMENSION(:)	:: x
			REAL(MK)							:: f
			INTEGER								:: evals
		END TYPE mean
		
		!-----------------------------------------------------------------------
      	!  Recentbest struct (accessed via history struct)
      	!-----------------------------------------------------------------------	
		TYPE recBest
			REAL(MK),ALLOCATABLE,DIMENSION(:)	:: x
			REAL(MK)							:: f
			INTEGER								:: evals
		END TYPE recBest
		
		!-----------------------------------------------------------------------
      	!  Recentworst struct (accessed via history struct)
      	!-----------------------------------------------------------------------	
		TYPE recWorst
			REAL(MK),ALLOCATABLE,DIMENSION(:)	:: x
			REAL(MK)							:: f
			INTEGER								:: evals
		END TYPE recWorst
		
		!-----------------------------------------------------------------------
      	!  Single parameters struct (accessed via history struct)
      	!-----------------------------------------------------------------------	
		TYPE param
			INTEGER								:: evals
			INTEGER								:: iterations
			REAL(MK)							:: sigma
			REAL(MK)							:: maxstd
			REAL(MK)							:: minstd
			REAL(MK)							:: maxD
			REAL(MK)							:: minD
			INTEGER								:: maxstdidx
			INTEGER								:: minstdidx
			!Comment see line 602
		END TYPE param
		
		!-----------------------------------------------------------------------
      	!  History struct (accessed via output struct)
      	!-----------------------------------------------------------------------	
		TYPE history
			TYPE(recBest) 	:: recentbest
			TYPE(recWorst) 	:: recentworst
			TYPE(mean) 		:: mean
			TYPE(param) 	:: param
			INTEGER 		:: evals
			INTEGER 		:: iterations
		END TYPE history

		!-----------------------------------------------------------------------
      	!  Parameter array struct (accessed via output struct)
      	!-----------------------------------------------------------------------				
		TYPE paramArr
			INTEGER 							:: evals
			INTEGER 							:: iterations
			REAl(MK)							:: sigma
			REAL(MK),ALLOCATABLE,DIMENSION(:)	:: diagD
			REAL(MK),ALLOCATABLE,DIMENSION(:)	:: stds
			REAL(MK),ALLOCATABLE,DIMENSION(:)	:: Bmax
			REAL(MK),ALLOCATABLE,DIMENSION(:)	:: Bmin
			! comment line 614
		END TYPE paramArr
		
		!-----------------------------------------------------------------------
      	!  Soultion struct (accessed via output struct)
      	!-----------------------------------------------------------------------	
		TYPE sol
			INTEGER	   		:: evals
			TYPE(best) 		:: bestever
			TYPE(mean) 		:: mean
			TYPE(recBest)	:: recentbest
			TYPE(recWorst)	:: recentworst
		END TYPE sol
		
		!-----------------------------------------------------------------------
      	!  Output struct
      	!-----------------------------------------------------------------------	
		TYPE :: output
			TYPE(sol) 		:: solutions
			TYPE(history) 	:: hist
			TYPE(paramArr) 	:: histParamArr
			INTEGER	  		:: evals
			REAL(MK)	  	:: stopflag
		END TYPE output
		
		!-----------------------------------------------------------------------
		!  The following variables are directly accessible to program routines
		!-----------------------------------------------------------------------
		TYPE(output) :: out ! gives access to all the other variables defined
							! in this module
		TYPE(best)	 :: bestever
		INTEGER		 :: outiter

        !-----------------------------------------------------------------------
      	!  Variables used to save information to be written into .mat files
      	!----------------------------------------------------------------------
        REAL(MK)     :: be3 = -1d0 
        REAL(MK)     :: be4 = -1d0
        REAL(MK)     :: be5 = -1d0
        REAL(MK),ALLOCATABLE,DIMENSION(:)     :: besthist
        
        INTEGER     :: acc_evals = -1
		  
ofgeorg's avatar
ofgeorg committed
143
	  END MODULE cmaes_out_mod