Commit 2e9670ce authored by ofgeorg's avatar ofgeorg

changed some headers - moved the closing of the matlab engine

parent 1ec7340d
......@@ -355,7 +355,8 @@
<Filter Name="matlab">
<File RelativePath=".\libcma\matlab\cma2mat.f90">
<FileConfiguration Name="Debug|Win32" ExcludedFromBuild="true"/>
<FileConfiguration Name="Debug|x64" ExcludedFromBuild="true"/></File></Filter>
<FileConfiguration Name="Debug|x64" ExcludedFromBuild="true"/></File>
<File RelativePath=".\libcma\matlab\matlab_objfunc.f90"/></Filter>
<Filter Name="mpi">
<File RelativePath=".\libcma\mpi\mpi_mod.f90">
<FileConfiguration Name="Debug|Win32" ExcludedFromBuild="true"/>
......
!-------------------------------------------------------------------------
! SUBROUTINE : LJ_POT_COMP
!-------------------------------------------------------------------------
!
! Purpose : calculates LJ Potential with applied compression term
!
! Remarks :
!
! References :
!
! Revisions :
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
! pCMALib: a parallel fortran 90 library for the evolution strategy with
! covariance matrix adaptation
! Christian L. Mueller, Benedikt Baumgartner, Georg Ofenbeck
! MOSAIC group, ETH Zurich, Switzerland
!-------------------------------------------------------------------------
SUBROUTINE LJ_POT_COMP(res,vars,m,n,lbounds,ubounds)
USE cmaes_param_mod
USE cmaes_opts_mod
......
!-------------------------------------------------------------------------
! SUBROUTINE : LJ_POT
!-------------------------------------------------------------------------
!
! Purpose : calculates LJ Potential
!
! Remarks :
!
! References :
!
! Revisions :
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
! pCMALib: a parallel fortran 90 library for the evolution strategy with
! covariance matrix adaptation
! Christian L. Mueller, Benedikt Baumgartner, Georg Ofenbeck
! MOSAIC group, ETH Zurich, Switzerland
!-------------------------------------------------------------------------
SUBROUTINE LJ_POT(res,vars,m,n,lbounds,ubounds)
USE cmaes_param_mod
!USE deriv_class ! make the module accessible
......
!-------------------------------------------------------------------------
! SUBROUTINE : LJ_write_out
!-------------------------------------------------------------------------
!
! Purpose : Writes a pdb file representing a LJ cluster
!
! Remarks :
!
! References :
!
! Revisions :
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
! pCMALib: a parallel fortran 90 library for the evolution strategy with
! covariance matrix adaptation
! Christian L. Mueller, Benedikt Baumgartner, Georg Ofenbeck
! MOSAIC group, ETH Zurich, Switzerland
!-------------------------------------------------------------------------
SUBROUTINE LJ_write_out(filename,X,m,n) !,V,ELJ,GTEST,SECT)
USE cmaes_param_mod
......
!-------------------------------------------------------------------------
! SUBROUTINE : water_write_out
!-------------------------------------------------------------------------
!
! Purpose : Writes a pdb file representing a water cluster
!
! Remarks :
!
! References :
!
! Revisions :
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
! pCMALib: a parallel fortran 90 library for the evolution strategy with
! covariance matrix adaptation
! Christian L. Mueller, Benedikt Baumgartner, Georg Ofenbeck
! MOSAIC group, ETH Zurich, Switzerland
!-------------------------------------------------------------------------
SUBROUTINE water_write_out(filename,X,m,n) !,V,ELJ,GTEST,SECT)
......
......@@ -32,113 +32,4 @@
#endif
!this was done as a test for something in lj_writeout - check out and remove!
REAL(MK), DIMENSION(108) :: tmptest = (/ -1.916, &
& 0.9632,&
& 1.653E+00,&
& -9.544E-01,&
& -5.500E-01,&
& 2.129E-03,&
& -3.117E-01,&
& 5.422E-01,&
& -1.800E+00,&
& 3.884E-04,&
& -1.110E+00,&
& 1.099E-02,&
& -6.297E-01,&
& 1.095E+00,&
& -9.015E-01,&
& -6.325E-01,&
& -2.320E-03,&
& -8.971E-01,&
& 6.388E-01,&
& -3.629E-03,&
& 9.088E-01,&
& -3.168E-01,&
& -5.659E-01,&
& -1.800E+00,&
& 9.577E-01,&
& -5.611E-01,&
& 9.940E-03,&
& 3.241E-01,&
& 1.645E+00,&
& -9.042E-01,&
& -1.276E+00,&
& 1.108E+00,&
& 8.990E-01,&
& 3.197E-01,&
& 5.433E-01,&
& -8.980E-01,&
& -9.500E-01,&
& 5.503E-01,&
& -4.378E-03,&
& -1.280E+00,&
& 4.108E-03,&
& 9.032E-01,&
& -9.499E-01,&
& 1.652E+00,&
& -7.169E-03,&
& -6.389E-01,&
& -1.113E+00,&
& -8.968E-01,&
& -3.106E-01,&
& 1.649E+00,&
& -1.811E+00,&
& -3.181E-01,&
& 5.534E-01,&
& 8.980E-01,&
& -1.593E+00,&
& -5.587E-01,&
& -9.028E-01,&
& 6.490E-01,&
& 1.091E+00,&
& -1.806E+00,&
& -1.912E+00,&
& 1.105E+00,&
& -3.296E-03,&
& 1.281E+00,&
& -1.117E-02,&
& -8.979E-01,&
& -3.200E-01,&
& -5.534E-01,&
& 9.091E-01,&
& 3.192E-01,&
& -5.580E-01,&
& -8.942E-01,&
& -1.269E+00,&
& 1.099E+00,&
& -1.810E+00,&
& 6.458E-01,&
& -1.357E-02,&
& -1.802E+00,&
& 1.284E+00,&
& 1.093E+00,&
& -9.029E-01,&
& 1.498E-03,&
& 1.097E+00,&
& -4.742E-03,&
& 6.406E-01,&
& 1.106E+00,&
& 9.041E-01,&
& 8.506E-03,&
& 2.208E+00,&
& -5.033E-03,&
& 9.558E-01,&
& 5.464E-01,&
& 2.259E-03,&
& -1.589E+00,&
& 1.656E+00,&
& -9.112E-01,&
& -6.314E-01,&
& 2.205E+00,&
& -9.119E-01,&
& -1.271E+00,&
& -1.028E-02,&
& -1.805E+00,&
& -1.587E+00,&
& 5.485E-01,&
& -9.033E-01,&
& -3.144E-01,&
& 1.661E+00,&
& 8.985E-01 /)
END MODULE cmaes_param_mod
\ No newline at end of file
......@@ -1180,11 +1180,7 @@
! Check if any process wants to stop (collect data in stop_proc_mask)
IF(stopflag .NE. '') STOP_FLAG = .TRUE.
CALL mpi_comm_adapt()
IF(stop_me) THEN
! Close MATLAB engine if used
IF (options%matlab_func) THEN
temp=cmaes_funcwrap(arxvalid(:,1),-1,fitfun)
ENDIF
IF(stop_me) THEN
EXIT genLoop
ENDIF
#endif
......
......@@ -124,6 +124,11 @@
#ifdef __HAVE_MATLAB__
WRITE(*,*) 'Calling Matlab Engine to write .mat File'
CALL cma2mat()
! Close MATLAB engine if used
IF (options%use_MATFUNC) THEN
temp=cmaes_funcwrap(arxvalid(:,1),-1,fitfun)
ENDIF
#endif
!-------------------------------------------------------------------------
......
This diff is collapsed.
!-------------------------------------------------------------------------
! Subroutine : tool_realtxt2arr
!-------------------------------------------------------------------------
!
! Purpose : Read data (REAL numbers) from .txt file to an array
!
! Input : filename (C) Name of file to read from
! N (I) Number of rows of output array
! M (I) Number of columns of output array
!
! Output : arr(:,:) (R) Matrix containing values from file
!
! Remarks : txt file must be in ascii format and each value in its
! own line. The Routine reads the file line by line and
! creates an Array (column-wise) with specified
! dimensions.
!
! References :
!
! Revisions :
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
! Subroutine : tool_realtxt2arr
!-------------------------------------------------------------------------
!
! Purpose : Read data (REAL numbers) from .txt file to an array
!
! Input : filename (C) Name of file to read from
! N (I) Number of rows of output array
! M (I) Number of columns of output array
!
! Output : arr(:,:) (R) Matrix containing values from file
!
! Remarks : txt file must be in ascii format and each value in its
! own line. The Routine reads the file line by line and
! creates an Array (column-wise) with specified
! dimensions.
!
! References :
!
! Revisions :
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
! pCMALib: a parallel fortran 90 library for the evolution strategy with
! covariance matrix adaptation
! Christian L. Mueller, Benedikt Baumgartner, Georg Ofenbeck
! MOSAIC group, ETH Zurich, Switzerland
!-------------------------------------------------------------------------
SUBROUTINE tool_realtxt2arr(filename,N,M,arr)
USE cmaes_param_mod
IMPLICIT NONE
CHARACTER(len=30),INTENT(in) :: filename
INTEGER,INTENT(in) :: N
INTEGER,INTENT(in) :: M
REAL(MK),DIMENSION(N,M),INTENT(out) :: arr
INTEGER :: i,j,k
REAL(MK),DIMENSION(N*M) :: vec
INTEGER :: ioerror
!WRITE(*,*) filename
OPEN(unit=50,file=trim(filename),status='old',action='read',iostat=ioerror)
IF(ioerror .EQ. 0) THEN
DO i = 1, N*M
READ(50,*) vec(i)
END DO
ELSE
WRITE(*,*) 'Error reading from file.',filename
END IF
CLOSE(unit=50)
k = 1
DO j=1,M
DO i=1,N
arr(i,j) = vec(k)
k = k+1
END DO
END DO
RETURN
! covariance matrix adaptation
! Christian L. Mueller, Benedikt Baumgartner, Georg Ofenbeck
! MOSAIC group, ETH Zurich, Switzerland
!-------------------------------------------------------------------------
SUBROUTINE tool_realtxt2arr(filename,N,M,arr)
USE cmaes_param_mod
IMPLICIT NONE
CHARACTER(len=30),INTENT(in) :: filename
INTEGER,INTENT(in) :: N
INTEGER,INTENT(in) :: M
REAL(MK),DIMENSION(N,M),INTENT(out) :: arr
INTEGER :: i,j,k
REAL(MK),DIMENSION(N*M) :: vec
INTEGER :: ioerror
!WRITE(*,*) filename
OPEN(unit=50,file=trim(filename),status='old',action='read',iostat=ioerror)
IF(ioerror .EQ. 0) THEN
DO i = 1, N*M
READ(50,*) vec(i)
END DO
ELSE
WRITE(*,*) 'Error reading from file.',filename
END IF
CLOSE(unit=50)
k = 1
DO j=1,M
DO i=1,N
arr(i,j) = vec(k)
k = k+1
END DO
END DO
RETURN
END SUBROUTINE tool_realtxt2arr
\ No newline at end of file
......@@ -18,14 +18,12 @@
!
! Revisions :
!-------------------------------------------------------------------------
! $Log:
!
!-------------------------------------------------------------------------
! pCMALib: a parallel fortran 90 library for the evolution strategy with
! covariance matrix adaptation
! Christian L. Mueller, Benedikt Baumgartner, Georg Ofenbeck
! MOSAIC group, ETH Zurich, Switzerland
!-------------------------------------------------------------------------
! Parallel Random Number Generator Library (LIBPRNG)
! Georg Ofenbeck
! MOSAIC Lab, ETH Zurich, Switzerland
!-------------------------------------------------------------------------
SUBROUTINE invnor(m, n, seq, iseq, inverter)
......
......@@ -34,13 +34,12 @@
!
!
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
! pCMALib: a parallel fortran 90 library for the evolution strategy with
! covariance matrix adaptation
! Christian L. Mueller, Benedikt Baumgartner, Georg Ofenbeck
! MOSAIC group, ETH Zurich, Switzerland
!-------------------------------------------------------------------------
! $Log: qr_generator_mod.f90,v $
!-------------------------------------------------------------------------
!
!
!-------------------------------------------------------------------------
#ifdef __SP
#define __CMA
#endif
......
......@@ -11,14 +11,7 @@
!
! Revisions :
!-------------------------------------------------------------------------
! $Log: CEC2005.f90,v $
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
! doubleFunnel
!-------------------------------------------------------------------------
......
......@@ -5,7 +5,24 @@
#ifdef __DP
#define __CMA
#endif
!-------------------------------------------------------------------------
! Subroutine : benchmark_bobb
!-------------------------------------------------------------------------
!
! Purpose : a fortran interface to the C implementation of the BBOB
!
!
! Remarks :
! References :
!
! Revisions :
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
! pCMALib: a parallel fortran 90 library for the evolution strategy with
! covariance matrix adaptation
! Christian L. Mueller, Benedikt Baumgartner, Georg Ofenbeck
! MOSAIC group, ETH Zurich, Switzerland
!-------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment