Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ackley_mc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Wartung heute um 18:25 wegen einer Sicherheitswarnung von GitLab
Show more breadcrumbs
Torda, Prof. Dr. Andrew Ernest
ackley_mc
Commits
c0b1771e
Commit
c0b1771e
authored
3 years ago
by
Andrew E. Torda
Browse files
Options
Downloads
Patches
Plain Diff
Cleaning of tests and output files.
parent
3cb50a6e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ackwork/ackwork_test.go
+31
-80
31 additions, 80 deletions
ackwork/ackwork_test.go
with
31 additions
and
80 deletions
ackwork/ackwork_test.go
+
31
−
80
View file @
c0b1771e
...
...
@@ -19,111 +19,62 @@ ini_temp = 1
final_temp 0
x_ini 0.8,0.8,0.8
x_delta, "0.4"
n_step = 100000
fOutNamen testReal`
n_step = 100000`
func
TestTypo
(
t
*
testing
.
T
)
{
// Make sure a typo in input does provoke an error
if
err
:=
realmain
(
strings
.
NewReader
(
sTypo
));
err
==
nil
{
t
.
Fatal
(
"line with typo should provoke error
\n
"
,
err
,
"
\n
Input"
,
sTypo
)
}
}
type
gentest
struct
{
params
,
basename
string
}
var
s1d
=
`
var
set1
=
[]
gentest
{
{
`
ini_temp 1e-10
final_temp 1e-12
x_ini 1,1,1
n_step 10000`
,
"cold"
},
{
`
ini_temp 1
final_temp 0.05
x_ini 15
n_step 10000
fOutName testanneal1d`
var
s16d
=
`
n_step 10000`
,
"s1d"
},
{
`
ini_temp 0.02
final_temp 0.001
x_ini 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
n_step 1000000
x_delta 1
fPltName anneal16d.svg
xPltName anneal16dtrajplt
fOutName anneal16d`
var
sCold
=
`
ini_temp 1e-10
final_temp 1e-12
x_ini 1,1,1
n_step 10000
fOutName testcold`
var
sHot
=
`
x_delta 1`
,
"s16d"
},
{
`
ini_temp 1
final_temp 1
x_ini 1,1,1
n_step 10000
fOutName testhot`
var
sRealAnneal
=
`
ini_temp 0.5
final_temp 0.05
x_ini 7,1,7
n_step 100000
fOutName ""`
// These values seem to work well. There is something of a phase
// transition near temperature 0.09. Good values for an optimisation
// seem to be 0.17 and 0.01 (initial and final temperatures), but this
// needs a few steps (500000).
// constant temp..
// 0.75 jump around and nicely visits all locations
// 0.1 jumps around, acceptance is too high and really uncontrolled.
// 0.09375 visit 0, 1, 2, 3, 4, 5, 6, .. Can fully explore local minima and sometimes get to next
// 0.0875 visits 6.7, 6.8, .. 7.2
// 0.075 only see points at 6.8, 6.9, 7.0, 7.1
// 0.05 only see points at 6.8, 6.9, 7.0, 7.1
var
sPhaseTrans
=
`
fOutName testhot`
,
"hot"
},
{
`
ini_temp 0.18
final_temp 0.01
x_ini 7,1,7
n_step 100000
fOutName testphase`
var
csv_test
=
[]
string
{
s1d
,
sHot
,
sCold
,
sRealAnneal
,
sPhaseTrans
,
s16d
}
n_step 100000`
,
"phasetrans"
},
func
TestCsv
(
t
*
testing
.
T
)
{
for
_
,
s
:=
range
csv_test
{
if
err
:=
realmain
(
strings
.
NewReader
(
s
));
err
!=
nil
{
t
.
Fatal
(
"csv failed with
\n
"
,
err
,
"
\n
Input:"
,
s
)
}
}
}
var
s9dplot
=
`
ini_temp 0.0925
final_temp 0.09
x_ini 15,10,11,12,14,18,-12,-8,-9
n_step 50000
x_delta 0.2
fOutName test9d
fPltName testplot.svg
xPltName testrajplt`
var
s9bdplot
=
`
ini_temp 0.0925
final_temp 0.05
x_ini 15,10,11,12,14,0,-12,-8,-9
n_step 50000
x_delta 0.2
fOutName test9db
fPltName test9dbf
xPltName test9dbtraj`
var
plotTest
=
[]
string
{
s9dplot
,
s9bdplot
,
// add OutNames uses the basename field and makes output names for
// the value and x trajectory plot files and the csv file
func
addOutNames
(
s
gentest
)
string
{
a
:=
[]
string
{
"xPltName"
,
"fPltName"
,
"fOutName"
}
ret
:=
s
.
params
for
_
,
ss
:=
range
a
{
ret
+=
"
\n
"
+
ss
+
" "
+
s
.
basename
}
func
TestPlot
(
t
*
testing
.
T
)
{
for
_
,
s
:=
range
plotTest
{
if
err
:=
realmain
(
strings
.
NewReader
(
s
));
err
!=
nil
{
t
.
Fatal
(
"plot test failed with
\n
"
,
err
,
"
\n
Input"
,
s
)
return
ret
+
"
\n
"
}
func
Test1
(
t
*
testing
.
T
)
{
for
_
,
s
:=
range
set1
{
instring
:=
addOutNames
(
s
)
if
err
:=
realmain
(
strings
.
NewReader
(
instring
));
err
!=
nil
{
t
.
Fatal
(
"set1 failed with
\n
"
,
err
,
"
\n
Input:"
,
s
)
}
}
}
...
...
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