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
Show more breadcrumbs
Torda, Prof. Dr. Andrew Ernest
ackley_mc
Commits
5adfe70b
Commit
5adfe70b
authored
3 years ago
by
Andrew E. Torda
Browse files
Options
Downloads
Patches
Plain Diff
comments and cleaning
parent
61f9235b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mc_work/dorun.go
+5
-4
5 additions, 4 deletions
mc_work/dorun.go
ui/ui_run.go
+1
-4
1 addition, 4 deletions
ui/ui_run.go
with
6 additions
and
8 deletions
mc_work/dorun.go
+
5
−
4
View file @
5adfe70b
...
...
@@ -135,8 +135,9 @@ func setupRun(mcPrm *McPrm, cprm *cprm) error {
return
nil
}
// newx will move just one dimension at a time. Moving all dimensions at once
// required teeny moves.
// newx provides a random step to give us new coordinates.
// An earlier version moved all dimensions at once, but required
// teeny moves.
func
newx
(
xold
[]
float32
,
xT
[]
float32
,
rand
*
rand
.
Rand
,
xDlta
float64
)
{
var
iDim
int
if
(
len
(
xold
))
>
1
{
...
...
@@ -260,7 +261,7 @@ func DoRun(mcPrm *McPrm) (MCresult, error) {
for
n
:=
0
;
n
<
mcPrm
.
NStep
;
n
++
{
var
accept
bool
if
mcPrm
.
AdaptStep
{
if
mcPrm
.
AdaptStep
{
// Are we trying adaptive steps ?
nRunAcc
--
if
nRunAcc
==
0
{
// Do we want to try adjusting the step size ?
xDlta
=
nRunAdj
(
mcPrm
,
n
,
runAcc
,
xDlta
)
...
...
@@ -303,7 +304,7 @@ func DoRun(mcPrm *McPrm) (MCresult, error) {
defer
fmt
.
Println
(
"n accepted:"
,
nAcc
,
"of"
,
mcPrm
.
NStep
)
if
bestX
!=
nil
{
defer
fmt
.
Printf
(
"Best function value: %.2f at %.2v
\n
"
,
bestfval
,
bestX
)
defer
fmt
.
Printf
(
"Best function value: %.2f at %.2v
at step %d
\n
"
,
bestfval
,
bestX
,
bestN
)
}
else
{
defer
fmt
.
Println
(
"bestX was never initialised"
)
}
...
...
This diff is collapsed.
Click to expand it.
ui/ui_run.go
+
1
−
4
View file @
5adfe70b
...
...
@@ -22,7 +22,7 @@ type genParams struct {
chn
chan
workstatus
// To tell the output tab current status
}
// We have a channel
that sends the status to the output tab
.
// We have a channel
used to tell the output tab that there are new results
.
type
status
uint8
const
(
...
...
@@ -57,6 +57,3 @@ func UiDoRun(mcPrm *mcwork.McPrm) error {
win
.
ShowAndRun
()
return
nil
}
func
nothing
(
...
interface
{})
{}
func
breaker
(
...
interface
{})
{}
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