Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
FORCES
Manage
Activity
Members
Labels
Plan
Issues
14
Issue boards
Milestones
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CHS
FORCES
Commits
6da312a4
Commit
6da312a4
authored
4 months ago
by
Sebastian Müller
🐈
Browse files
Options
Downloads
Patches
Plain Diff
test: update test_mo_anneal to use optimizee input
parent
bec1d851
No related branches found
Branches containing commit
No related tags found
1 merge request
!81
Rework optimization routines
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pf_tests/test_mo_anneal.pf
+10
-13
10 additions, 13 deletions
src/pf_tests/test_mo_anneal.pf
with
10 additions
and
13 deletions
src/pf_tests/test_mo_anneal.pf
+
10
−
13
View file @
6da312a4
...
...
@@ -4,10 +4,9 @@ module test_mo_anneal
use mo_kind, only: dp, i4, i8
use mo_anneal, only: anneal !, anneal_valid
use mo_anneal, only: GetTemperature !, GetTemperature_valid
use mo_cost, only: range_dp, cost_
objective !, cost_valid_
dp
use mo_cost, only: range_dp, cost_dp
use mo_xor4096, only: get_timeseed
use mo_opt_functions, only: eval_dummy
use mo_optimization_utils, only: eval_interface, objective_interface
use mo_optimization_utils, only: function_optimizee
use mo_message, only: error_message
implicit none
...
...
@@ -30,8 +29,7 @@ module test_mo_anneal
real(dp) :: Tstart, Tend
real(dp), dimension(:,:), allocatable :: history
procedure(eval_interface), pointer :: eval
procedure(objective_interface), pointer :: obj_func
type(function_optimizee) :: objective
! time dependent seeds
call get_timeseed(seeds)
...
...
@@ -44,16 +42,15 @@ module test_mo_anneal
para(3) = 0.5_dp
para(4) = 0.4_dp
eval => eval_dummy
obj_func => cost_objective
objective%func_pointer => cost_dp
! Initialization
print*, '-----------------------------------'
print*, ' INITIALIZATION '
print*, '-----------------------------------'
print*, 'Initial parameter set: ',para
print*, 'Initial cost function value: ',
cost_
objective(para(:)
, eval
)
costbestAll =
cost_
objective(para(:)
, eval
)
print*, 'Initial cost function value: ',objective
%evaluate
(para(:))
costbestAll = objective
%evaluate
(para(:))
parabestAll = para(:)
print*, '-----------------------------------'
print*, ' INITIAL TEMPERATURE '
...
...
@@ -62,7 +59,7 @@ module test_mo_anneal
seeds(1) = 854_i8
seeds(2) = seeds(1) + 1000_i8
print*, 'seeds used: ', seeds(1:2)
temperature = GetTemperature(
eval, obj_func
, para, 0.95_dp, &
temperature = GetTemperature(
objective
, para, 0.95_dp, &
! optionals
prange_func=range_dp, &
samplesize=500_i4, &
...
...
@@ -82,7 +79,7 @@ module test_mo_anneal
print*, 'seeds used: ', seeds(1:3)
!
call cpu_time(Tstart)
parabest = anneal(
eval, obj_func
, para, &
parabest = anneal(
objective
, para, &
! optionals
prange_func=range_dp, &
maxit=.false., &
...
...
@@ -122,9 +119,9 @@ module test_mo_anneal
print*, ' parabest = ', parabestAll
! Is program running properly? costbestAll = 3.1142480812726376E-02
@assertEqual(costbestAll, 3.1142480812726376E-02_dp, tolerance=t)
end subroutine test_anneal_dp
end module test_mo_anneal
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment